docs(8.0): Phase F — deep clean across 21 docs
Aligned every public doc to the 8.0 contract: filesystem + memory adapters
only, vector index provider terminology (config.vector with recall +
quantization + persistMode knobs), no cloud storage adapters, no closed-
source product names.
Tier 1 — heavier rewrites:
- docs/architecture/storage-architecture.md
- docs/architecture/data-storage-architecture.md
- docs/architecture/distributed-storage.md DELETED — content was 100%
cloud-coordination examples with no 8.0 substance.
- docs/guides/distributed-system.md DELETED — same reason; no inbound refs.
- docs/SCALING.md rewritten for single-node guidance.
- docs/PLUGINS.md, docs/augmentations/{COMPLETE-REFERENCE,README}.md:
HnswProvider→VectorIndexProvider, hnsw→vector key.
- docs/PERFORMANCE.md, docs/BATCHING.md cloud-detection + sharding
sections replaced with single-node vector tuning + filesystem framing.
Tier 2 — surgical renames + cloud-section deletions:
- architecture/{index,initialization-and-rebuild,overview}.md
- transactions.md, DEVELOPER_LEARNING_PATH.md
- vfs/{VFS_API_GUIDE,COMMON_PATTERNS}.md
- api/README.md, guides/{inspection,import-flow}.md
Tier 3 — light edits:
- docs/README.md, architecture/augmentation-system-audit.md
MIGRATION-V3-TO-V4.md untouched (internal migration doc, no stale terms).
This commit is contained in:
parent
2626ab8d62
commit
adda1570f3
22 changed files with 570 additions and 2658 deletions
|
|
@ -11,7 +11,7 @@ Brainy's transaction system provides **atomic operations** with automatic rollba
|
|||
- **Atomicity**: All operations succeed or all rollback
|
||||
- **Consistency**: Indexes and storage remain consistent
|
||||
- **Automatic**: Transparently used by all `brain.add()`, `brain.update()`, `brain.delete()`, and `brain.relate()` operations
|
||||
- **Compatible**: Works seamlessly with COW, sharding, type-aware storage, and distributed storage
|
||||
- **Compatible**: Works seamlessly with COW, sharding, and type-aware storage
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
@ -154,37 +154,27 @@ await brain.update({
|
|||
- Storage layer uses O(1) ID-first path construction
|
||||
- No type cache needed (removed in a previous version)
|
||||
- Type counters adjusted on commit/rollback
|
||||
- 40x faster on cloud storage (eliminates 42-type search)
|
||||
- 40x faster path lookups (eliminates 42-type search)
|
||||
|
||||
### Distributed Storage
|
||||
### Storage Adapter Interface
|
||||
|
||||
✅ **Fully Compatible**
|
||||
|
||||
Transactions work with distributed/remote storage:
|
||||
Transactions go through the `StorageAdapter` interface, so both shipped adapters (filesystem, memory) and any custom plugin adapter inherit the same atomicity guarantees:
|
||||
|
||||
```typescript
|
||||
// Works with S3, Azure, GCS, etc.
|
||||
const brain = new Brainy({
|
||||
storage: {
|
||||
type: 's3Compatible',
|
||||
config: { /* S3 config */ }
|
||||
}
|
||||
storage: { type: 'filesystem', rootDirectory: './data' }
|
||||
})
|
||||
|
||||
// Transactions ensure atomicity at write coordinator level
|
||||
await brain.add({ data: { name: 'Remote Entity' }, type: NounType.Thing })
|
||||
await brain.add({ data: { name: 'Entity' }, type: NounType.Thing })
|
||||
```
|
||||
|
||||
**How It Works:**
|
||||
- Transactions operate through `StorageAdapter` interface
|
||||
- Remote storage adapters implement same interface
|
||||
- Atomicity guaranteed at write-coordinator level
|
||||
- Read-after-write consistency maintained
|
||||
|
||||
**Design Philosophy:**
|
||||
- **Single-node writes** (most common): Fully atomic ✅
|
||||
- **Distributed reads + centralized writes**: Transactions on primary ✅
|
||||
- **Multi-primary**: Transactions per-instance, cross-instance via coordinator ✅
|
||||
- Custom adapters registered via the plugin system implement the same interface
|
||||
- Atomicity guaranteed at the write-coordinator level
|
||||
- Read-after-write consistency maintained inside a single Brainy process
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
@ -404,17 +394,17 @@ setInterval(() => {
|
|||
### 5. Understand Atomicity Guarantees
|
||||
|
||||
**What Transactions GUARANTEE:**
|
||||
- ✅ Atomicity within single Brainy instance
|
||||
- ✅ Atomicity within a single Brainy process
|
||||
- ✅ Consistent state across all indexes
|
||||
- ✅ Automatic rollback on failure
|
||||
- ✅ Works with all storage adapters (local, remote, COW, sharded)
|
||||
- ✅ Works with all storage adapters (filesystem, memory, custom plugin adapters)
|
||||
|
||||
**What Transactions DON'T Provide:**
|
||||
- ❌ Two-phase commit across multiple Brainy instances
|
||||
- ❌ Distributed locking across nodes
|
||||
- ❌ Distributed locking across processes
|
||||
- ❌ Cross-datacenter ACID guarantees
|
||||
|
||||
**Design:** Transactions ensure atomicity at the **write coordinator level**. For multi-instance scenarios, use `DistributedCoordinator`.
|
||||
**Design:** Transactions ensure atomicity at the **write-coordinator level** inside one process. Cross-instance coordination, if you need it, lives in your service layer.
|
||||
|
||||
## Testing Transactions
|
||||
|
||||
|
|
@ -453,7 +443,6 @@ See `tests/transaction/integration/` for comprehensive integration tests coverin
|
|||
- COW integration (`cow-transactions.test.ts`)
|
||||
- Sharding integration (`sharding-transactions.test.ts`)
|
||||
- TypeAware integration (`typeaware-transactions.test.ts`)
|
||||
- Distributed storage integration (`distributed-transactions.test.ts`)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
|
@ -552,7 +541,7 @@ interface StorageAdapter {
|
|||
}
|
||||
```
|
||||
|
||||
**Key Insight:** All storage adapters (filesystem, S3, Azure, GCS, memory) implement this interface. Transactions work with **any** storage adapter automatically.
|
||||
**Key Insight:** Both shipped storage adapters (filesystem, memory) — and any custom plugin adapter — implement this interface. Transactions work with **any** storage adapter automatically.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
|
|
@ -565,13 +554,13 @@ interface StorageAdapter {
|
|||
|
||||
- Initial transaction system release
|
||||
- Atomic operations with rollback
|
||||
- Compatible with COW, sharding, type-aware, distributed
|
||||
- Compatible with COW, sharding, type-aware storage
|
||||
- 36/36 unit tests passing
|
||||
- 35 integration test scenarios
|
||||
|
||||
## Summary
|
||||
|
||||
Brainy's transaction system provides **production-ready atomic operations** with automatic rollback. It works transparently with all Brainy APIs and is fully compatible with advanced features like COW, sharding, type-aware storage, and distributed storage.
|
||||
Brainy's transaction system provides **production-ready atomic operations** with automatic rollback. It works transparently with all Brainy APIs and is fully compatible with advanced features like COW, sharding, and type-aware storage.
|
||||
|
||||
**Key Takeaways:**
|
||||
- ✅ **Automatic**: No manual transaction management needed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue