weave-basis · crate
Source declarations, signatures and documentation for crate.
Reviewed implementation boundary: Basis::new starts with an empty in-memory HNSW index; BasisStore::open does not replay persisted vector records. Snapshots are unimplemented. Present-id remove can deadlock by retaining the strand write lock while private rebuild requests a read lock. Caller validation is required for equal vector dimensions and finite values. See /libraries/basis/snapshot-recovery.
Source: sigil/weave/models/basis/src/lib.rs. SHA-256: 222b3f180b9a8fb56f3ef52802532b72e8024f85287ffcc62bab3d968b4f839f.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
::BasisError
Error types for Basis operations.
#[derive(Debug, Error)]
pub enum BasisError {
/// The underlying strand storage returned an error.
#[error("Strand error: {0}")]
Strand(String),
/// Serialization or deserialization failed.
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
/// Vector not found.
#[error("Vector with id {0} not found")]
VectorNotFound(Uuid),
/// Member not found.
#[error("Member with identity {0} not found")]
MemberNotFound(String),
}Source line: 46.
::Result
A result type for Basis operations.
pub type Result<T> = std::result::Result<T, BasisError>;Source line: 62.
::VectorEntry
Represents an entry in the vector strand log.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum VectorEntry {
Add { id: Uuid, vector: Vec<f32> },
Remove { id: Uuid },
}Source line: 66.
::Basis
The Basis, a distributed vector store.
pub struct Basis {
}Source line: 77.
::Basis::new
Creates a new Basis instance.
pub fn new(vector_strand: Arc<RwLock<Strand>>, index_strand: Arc<RwLock<Strand>>) -> Self;Source line: 93.
::Basis::add
Adds a vector to the store.
pub async fn add(&self, id: Uuid, vector: &[f32]) -> Result<()>;Source line: 105.
::Basis::search
Searches for the k nearest neighbors to a query vector.
pub async fn search(&self, query: &[f32], k: usize) -> Result<Vec<(Uuid, f32)>>;Source line: 134.
::Basis::remove
Removes a vector from the store.
pub async fn remove(&self, id: Uuid) -> Result<()>;Source line: 170.
::Basis::remove_member
Remove a member from the Basis
pub async fn remove_member(&self, identity_str: &str) -> Result<()>;Source line: 248.
::Basis::is_member
Check if an identity is a member
pub async fn is_member(&self, identity_str: &str) -> bool;Source line: 257.