Skip to main content

Module async_pool

Module async_pool 

Source
Expand description

Multi-connection async pool for the knowledge graph.

Unlike AsyncGraph (single Arc<Mutex<Connection>>), this module maintains a bounded pool of rusqlite connections gated by a tokio Semaphore. Multiple read queries can execute concurrently in WAL mode, while the semaphore bounds total concurrency.

use llm_kernel::graph::AsyncPoolGraph;

let pool = AsyncPoolGraph::open("my.db", 4).await?;
pool.upsert_node(llm_kernel::graph::GraphNode {
    id: "n1".into(),
    node_type: "concept".into(),
    title: "Example".into(),
    body: String::new(),
    tags: vec![],
    projects: vec![],
    agents: vec![],
    created: "2026-01-01T00:00:00Z".into(),
    updated: "2026-01-01T00:00:00Z".into(),
    importance: 0.5,
    access_count: 0,
    accessed_at: String::new(),
}).await?;

Structs§

AsyncPoolGraph
Bounded async connection pool for the knowledge graph.