Expand description
SochDB Database Kernel
The shared core that powers both embedded mode (SochConnection::open) and
server mode (sochdb-server). This is the “SQLite engine” equivalent.
§Architecture
┌──────────────────────────────────────────────────────────────────┐
│ Database Kernel │
│ Arc<Database> - shared by all connections │
├──────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌────────────────┐ │
│ │ DurableStorage │ │ Catalog │ │ Vector Index │ │
│ │ (WAL + MVCC) │ │ (Schema Mgmt) │ │ (HNSW/Vamana) │ │
│ └────────┬────────┘ └────────┬────────┘ └───────┬────────┘ │
│ │ │ │ │
│ └─────────────────────┴─────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Query Executor (Path-Native) │ │
│ │ - Path resolution: O(|path|) │ │
│ │ - Column projection: 80% I/O reduction │ │
│ │ - Context selection: Token-aware chunking │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────┘
Deployment Modes:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Embedded │ │ IPC Server │ │ TCP Server │
│ (in-proc) │ │ (Unix sock)│ │ (remote) │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└─────────────────┴─────────────────┘
│
Arc<Database>§Latency Model
Let K = kernel processing cost for a query
- Embedded: L_emb ≈ K (function call overhead negligible)
- IPC: L_ipc ≈ K + δ_ipc (δ_ipc = ~10-50µs for Unix socket)
- TCP: L_tcp ≈ K + δ_net (δ_net = 100µs-10ms depending on network)
For LLM context queries where K >> δ_ipc, IPC is “nearly embedded”.
Re-exports§
pub use crate::durable_storage::RecoveryStats;
Structs§
- Column
Def - Column definition
- Columnar
Query Result - Columnar query result - SIMD-friendly format for analytics
- Columnar
RowView - Zero-allocation row view into a
ColumnarQueryResult. - Database
- The SochDB Database Kernel
- Database
Config - Database configuration
- Group
Commit Settings - Group commit settings - mirrors SQLite’s WAL mode tuning
- Query
Builder - Query builder for fluent query construction
- Query
Result - Query result from the kernel
- Query
RowIterator - Lazy iterator over query results
- Stats
- Public statistics snapshot
- Table
Schema - Table schema for the kernel
- TxnHandle
- Transaction handle for kernel operations
- Vector
Search Result - Vector search result
Enums§
- Column
Type - Column types
- Sync
Mode - WAL sync mode - matches SQLite’s PRAGMA synchronous semantics