Skip to main content

Crate kweb_db_core

Crate kweb_db_core 

Source
Expand description

Storage-only primitives for a provenance-backed knowledge web.

Kmap owns one SQLite database and a sibling immutable-artifact store. It records current knowledge nodes, append-only provenance history, ordered connection identifier arrays, and permanent mutation-idempotency receipts. The caller owns concurrency, graph policy, user/root mappings, HTTP, and all multi-call orchestration.

§Minimal example

use kweb_db_core::{IdempotencyId, Kmap, NewProvenance};

let mut kweb = Kmap::open(":memory:")?;
let provenance_id = kweb.create_provenance(
    IdempotencyId::random(),
    NewProvenance {
        data: "Imported source material".into(),
        source: "example".into(),
        source_created_at: "2026-07-18T00:00:00Z".into(),
    },
)?;
assert_eq!(kweb.get_provenance(provenance_id)?.data, "Imported source material");

See the crate README and Specification.md in the published package for validation rules, persistence details, and deliberate limitations.

Structs§

CreateNode
Complete input for Kmap::create_node.
IdempotencyId
A caller-generated 16-byte identifier for one logical mutation.
Kmap
A serialized handle to one Kweb DB Core SQLite database and artifact directory.
NewProvenance
Input for creating one immutable provenance record.
NewProvenanceArtifact
One immutable byte artifact attached to new provenance.
Node
The complete current state of a knowledge node.
NodeId
A durable 20-byte knowledge-node identifier.
Provenance
One immutable provenance record and its ordered artifact metadata.
ProvenanceArtifact
Metadata for one stored provenance artifact.
ProvenanceStorage
Artifact-storage input for Kmap::create_provenance_with_storage.
Stats
Additively extensible statistics over current knowledge-node text.
UpdateNode
Complete replacement input for Kmap::update_node.

Enums§

Error
Error returned by Kweb DB Core storage operations.
Owner
Ownership state supplied during a node create or update.

Type Aliases§

ProvenanceId
The identifier of an immutable provenance record.