khive_db/lib.rs
1//! SQLite storage backend for the khive knowledge graph runtime.
2//!
3//! Provides entity, note, event, edge, FTS5 text search, and optional
4//! `sqlite-vec` vector storage over a WAL-mode connection pool.
5
6/// Concrete storage backend providing capability-trait factories.
7pub mod backend;
8/// Periodic WAL checkpoint task.
9pub mod checkpoint;
10/// Read-only-by-intent WAL/checkpoint diagnostics operator surface.
11pub mod diagnostics;
12/// Error types for the SQLite layer.
13pub mod error;
14/// SQLite extension registration (sqlite-vec auto-extension).
15pub mod extension;
16/// Schema migration system (versioned migrations).
17pub mod migrations;
18/// WAL-mode connection pool: one writer, N concurrent readers.
19pub mod pool;
20/// `SqlAccess` trait bridge to `ConnectionPool`.
21pub mod sql_bridge;
22/// Per-substrate store implementations (entity, note, graph, event, text, vectors, sparse).
23pub mod stores;
24/// Cross-process WAL-pin attribution sidecar (ADR-091 Amendment 2 Plank B).
25/// The sidecar write path (heartbeat/beacon) and identity primitives are
26/// portable; directory enumeration (`enumerate_live`) is Unix-only — its
27/// only caller is the daemon's checkpoint task, and daemon mode itself
28/// requires Unix (see `khive-mcp/src/serve.rs`).
29pub mod walpin;
30/// Single-writer task and bounded write queue (ADR-067 Component A).
31pub mod writer_task;
32
33pub use backend::StorageBackend;
34pub use checkpoint::{
35 checkpoint_once, run_checkpoint_task, CheckpointConfig, CheckpointLifecycleOwner,
36 CheckpointTick,
37};
38pub use checkpoint::{run_session_sweep_task, SessionSweepConfig, SweepBackend};
39pub use error::SqliteError;
40pub use migrations::{
41 inspect_schema_version, query_embedding_models, read_schema_version, run_migrations,
42 EmbeddingModelRegistryRecord, Migration, ServiceSchemaPlan, VersionedMigration, MIGRATIONS,
43};
44pub use pool::{ConnectionPool, PoolConfig, ReaderGuard, WriterGuard};
45pub use sql_bridge::SqlBridge;
46pub use writer_task::WriterTaskHandle;