pub fn spawn(
pool: &ConnectionPool,
capacity: usize,
) -> Result<WriterTaskHandle, SqliteError>Expand description
Spawn the write-owner task (ADR-067 Component A) on the current Tokio runtime.
Opens a dedicated standalone writer connection
(ConnectionPool::open_standalone_writer), independent of the pool’s
Mutex-guarded writer() connection used by unmigrated paths. Returns the
cloneable WriterTaskHandle sender half; the task runs until every
handle clone is dropped and the channel closes.
capacity bounds the channel (PoolConfig::write_queue_capacity /
KHIVE_WRITE_QUEUE_CAPACITY, ADR-067 recommends 256).
§Errors
Must be called from within a Tokio runtime context (calls
tokio::spawn). Returns an error if the pool cannot open a standalone
writer connection (e.g. an in-memory pool has no standalone-connection
support). See crates/khive-db/docs/api/writer-task.md for the
migration-slice scope this commits per BEGIN IMMEDIATE.