pub struct DeltaSyncVectorStore { /* private fields */ }Expand description
An in-memory vector store with a full append-only change log enabling efficient delta synchronisation between replicas.
Implementations§
Source§impl DeltaSyncVectorStore
impl DeltaSyncVectorStore
Sourcepub fn insert(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
pub fn insert(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
Insert a new vector. Returns an error if the key already exists.
Sourcepub fn insert_with_metadata(
&mut self,
key: String,
vector: Vec<f32>,
metadata: HashMap<String, String>,
) -> Result<u64>
pub fn insert_with_metadata( &mut self, key: String, vector: Vec<f32>, metadata: HashMap<String, String>, ) -> Result<u64>
Insert with explicit metadata. Returns an error if the key already exists.
Sourcepub fn update(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
pub fn update(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
Update an existing vector. Returns an error if the key does not exist.
Sourcepub fn update_with_metadata(
&mut self,
key: String,
vector: Vec<f32>,
metadata: HashMap<String, String>,
) -> Result<u64>
pub fn update_with_metadata( &mut self, key: String, vector: Vec<f32>, metadata: HashMap<String, String>, ) -> Result<u64>
Update with explicit metadata. Returns an error if the key does not exist.
Sourcepub fn upsert(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
pub fn upsert(&mut self, key: String, vector: Vec<f32>) -> Result<u64>
Insert or update a vector (upsert semantics).
Sourcepub fn delete(&mut self, key: &str) -> Result<u64>
pub fn delete(&mut self, key: &str) -> Result<u64>
Delete a vector by key. Returns an error if the key does not exist.
Sourcepub fn get(&self, key: &str) -> Option<&StoredEntry>
pub fn get(&self, key: &str) -> Option<&StoredEntry>
Look up a vector by key.
Sourcepub fn current_seq(&self) -> u64
pub fn current_seq(&self) -> u64
The current (latest) sequence number.
Sourcepub fn export_delta(&self, since_seq: u64) -> StoreDelta
pub fn export_delta(&self, since_seq: u64) -> StoreDelta
Export all changes with seq > since_seq as a StoreDelta.
Pass since_seq = 0 to export the full history.
Sourcepub fn merge_delta(&mut self, delta: &StoreDelta) -> Result<MergeResult>
pub fn merge_delta(&mut self, delta: &StoreDelta) -> Result<MergeResult>
Apply a StoreDelta received from a remote replica.
Uses last-writer-wins based on sequence number; records whose sequence number is ≤ the current local version of that key are skipped.
The local sequence counter is NOT advanced by merges — only by local write operations. This keeps sequence numbers local-only and avoids gaps in the log.
Sourcepub fn stats(&self) -> DeltaStoreStats
pub fn stats(&self) -> DeltaStoreStats
Return store statistics.
Sourcepub fn compact_log(&mut self)
pub fn compact_log(&mut self)
Compact the change log, retaining only the most-recent operation for each key plus any delete tombstones whose key no longer exists.
After compaction the log covers the same logical state but may be shorter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeltaSyncVectorStore
impl RefUnwindSafe for DeltaSyncVectorStore
impl Send for DeltaSyncVectorStore
impl Sync for DeltaSyncVectorStore
impl Unpin for DeltaSyncVectorStore
impl UnsafeUnpin for DeltaSyncVectorStore
impl UnwindSafe for DeltaSyncVectorStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.