pub struct VersionStore { /* private fields */ }Expand description
In-memory version store backed by a BTreeMap.
Keys are (entity_id, version_seq) where entity_id is the node/edge ID and version_seq is a monotonically increasing sequence number per entity.
Implementations§
Source§impl VersionStore
impl VersionStore
Sourcepub fn snapshot_node(&mut self, entity_id: u64, record: NodeRecord) -> u64
pub fn snapshot_node(&mut self, entity_id: u64, record: NodeRecord) -> u64
Snapshot a node record before an update. Returns the version sequence number assigned.
Sourcepub fn snapshot_relationship(
&mut self,
entity_id: u64,
record: RelationshipRecord,
) -> u64
pub fn snapshot_relationship( &mut self, entity_id: u64, record: RelationshipRecord, ) -> u64
Snapshot a relationship record before an update. Returns the version sequence number assigned.
Sourcepub fn get_version(
&self,
entity_id: u64,
version_seq: u64,
) -> Option<&VersionRecord>
pub fn get_version( &self, entity_id: u64, version_seq: u64, ) -> Option<&VersionRecord>
Get a specific version of an entity.
Sourcepub fn get_latest_version(&self, entity_id: u64) -> Option<&VersionRecord>
pub fn get_latest_version(&self, entity_id: u64) -> Option<&VersionRecord>
Get the latest version of an entity (the most recent snapshot).
Sourcepub fn get_version_chain(&self, entity_id: u64) -> Vec<(u64, &VersionRecord)>
pub fn get_version_chain(&self, entity_id: u64) -> Vec<(u64, &VersionRecord)>
Get the full version chain for an entity (oldest to newest).
Sourcepub fn version_count(&self, entity_id: u64) -> u64
pub fn version_count(&self, entity_id: u64) -> u64
Get the number of versions stored for an entity.
Sourcepub fn total_versions(&self) -> usize
pub fn total_versions(&self) -> usize
Get the total number of version records stored.
Sourcepub fn insert_loaded_record(
&mut self,
entity_id: u64,
version_seq: u64,
record: VersionRecord,
)
pub fn insert_loaded_record( &mut self, entity_id: u64, version_seq: u64, record: VersionRecord, )
Insert a version record loaded from persistent storage.
Updates next_seq to ensure new sequence numbers don’t collide.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VersionStore
impl RefUnwindSafe for VersionStore
impl Send for VersionStore
impl Sync for VersionStore
impl Unpin for VersionStore
impl UnsafeUnpin for VersionStore
impl UnwindSafe for VersionStore
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
Mutably borrows from an owned value. Read more