Skip to main content

Kmap

Struct Kmap 

Source
pub struct Kmap { /* private fields */ }
Expand description

A serialized handle to one Kweb DB Core SQLite database and artifact directory.

The caller must serialize access and must not expect multi-call atomicity.

Implementations§

Source§

impl Kmap

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, Error>

Opens or creates a database and derives its sibling artifact directory.

kweb.sqlite3 derives kweb-provenance-artifacts. This enables foreign keys, WAL journaling, a five-second busy timeout, and initializes the current schema when opening a new database.

Source

pub fn open_with_artifacts( path: impl AsRef<Path>, artifact_path: impl AsRef<Path>, ) -> Result<Self, Error>

Opens or creates a database with an explicit artifact-directory path.

Source

pub fn artifact_path(&self) -> &Path

Returns the configured artifact-directory path.

Source

pub fn create_provenance( &mut self, idempotency_id: IdempotencyId, input: NewProvenance, ) -> Result<ProvenanceId, Error>

Creates immutable provenance without explicit attached artifacts.

Main data larger than 256 KiB is stored externally. An exact replay of idempotency_id and input returns the original identifier without a second write.

Source

pub fn create_provenance_with_storage( &mut self, idempotency_id: IdempotencyId, input: NewProvenance, storage: ProvenanceStorage, ) -> Result<ProvenanceId, Error>

Creates immutable provenance with ordered attached artifacts.

storage.data_filename names the main data if it crosses the 256 KiB external-storage threshold. An exact replay returns the original ID.

Source

pub fn create_node( &mut self, idempotency_id: IdempotencyId, input: CreateNode, ) -> Result<Node, Error>

Creates a knowledge node, its first history entry, and both connections.

All referenced provenance, owner, and connection nodes must exist. An exact idempotent replay adds no history and returns the current node.

Source

pub fn update_node( &mut self, idempotency_id: IdempotencyId, id: NodeId, input: UpdateNode, ) -> Result<Node, Error>

Replaces a knowledge node and appends one provenance-history entry.

Both connection arrays are complete replacements. An exact idempotent replay appends no history and returns the current node.

Source

pub fn get_node(&self, id: NodeId) -> Result<Node, Error>

Returns a complete knowledge node by durable identifier.

Source

pub fn get_provenance(&self, id: ProvenanceId) -> Result<Provenance, Error>

Returns immutable provenance and ordered artifact metadata.

Externally stored main UTF-8 data is read transparently. Explicit attached artifact bytes are not loaded into the result.

Source

pub fn get_node_history(&self, id: NodeId) -> Result<Vec<ProvenanceId>, Error>

Returns the node’s complete provenance history, newest first.

The traversal detects a corrupt cycle and returns Error::Conflict.

Source

pub fn stats(&self) -> Result<Stats, Error>

Calculates extensible statistics over current node text.

Auto Trait Implementations§

§

impl !Freeze for Kmap

§

impl !RefUnwindSafe for Kmap

§

impl !Sync for Kmap

§

impl !UnwindSafe for Kmap

§

impl Send for Kmap

§

impl Unpin for Kmap

§

impl UnsafeUnpin for Kmap

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V