feat: ID-first storage architecture + remove memory-unsafe APIs (v6.0.0)
BREAKING CHANGES:
**ID-First Storage Paths**
- Direct O(1) entity access without type lookups
- Before: entities/nouns/{TYPE}/metadata/{SHARD}/{ID}.json
- After: entities/nouns/{SHARD}/{ID}/metadata.json
- Migration handled automatically on first init()
**Removed Memory-Unsafe APIs**
- Removed brain.merge() - loaded all entities into memory
- Removed brain.diff() - loaded all entities into memory
- Removed brain.data().backup() - loaded all entities into memory
- Removed brain.data().restore() - depended on backup()
- Removed CLI commands: backup, restore, cow merge
**Migration Paths**
- merge() → Use checkout() or manually copy entities with pagination
- diff() → Use asOf() with manual paginated comparison
- backup() → Use fork() for instant COW snapshots
- restore() → Use checkout() to switch to snapshot branch
Core Improvements:
- ✅ All 8 storage adapters properly call super.init()
- ✅ GraphAdjacencyIndex integration in BaseStorage.init()
- ✅ Fixed ID-first path bugs (vector.json → vectors.json)
- ✅ Fixed MemoryStorage.initializeCounts() for ID-first paths
- ✅ New VFS APIs: du(), access(), find()
- ✅ Comprehensive documentation with migration guides
Storage Adapters Fixed:
- MemoryStorage, FileSystemStorage, AzureBlobStorage
- GCSStorage, R2Storage, S3CompatibleStorage
- OPFSStorage, HistoricalStorageAdapter
Files Changed: 28 files, +1,075/-1,933 lines (net -858)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9730ca41e5
commit
42ae5be455
28 changed files with 1079 additions and 1937 deletions
|
|
@ -296,12 +296,8 @@ await experiment.updateAll({ /* migration logic */ })
|
|||
// Commit your work
|
||||
await experiment.commit({ message: 'Add test user', author: 'dev@example.com' })
|
||||
|
||||
// Merge back to main with conflict resolution
|
||||
const result = await brain.merge('test-migration', 'main', {
|
||||
strategy: 'last-write-wins'
|
||||
})
|
||||
|
||||
console.log(result) // { added: 1, modified: 0, conflicts: 0 }
|
||||
// Switch to experimental branch to make it active
|
||||
await brain.checkout('test-migration')
|
||||
|
||||
// Time-travel: Query database at any past commit (read-only)
|
||||
const commits = await brain.getHistory({ limit: 10 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue