Skip to main content

VersionStore

Struct VersionStore 

Source
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

Source

pub fn new() -> Self

Create a new empty version store.

Source

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.

Source

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.

Source

pub fn get_version( &self, entity_id: u64, version_seq: u64, ) -> Option<&VersionRecord>

Get a specific version of an entity.

Source

pub fn get_latest_version(&self, entity_id: u64) -> Option<&VersionRecord>

Get the latest version of an entity (the most recent snapshot).

Source

pub fn get_version_chain(&self, entity_id: u64) -> Vec<(u64, &VersionRecord)>

Get the full version chain for an entity (oldest to newest).

Source

pub fn version_count(&self, entity_id: u64) -> u64

Get the number of versions stored for an entity.

Source

pub fn total_versions(&self) -> usize

Get the total number of version records stored.

Source

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.

Source

pub fn all(&self) -> impl Iterator<Item = (&(u64, u64), &VersionRecord)>

Returns an iterator over all (entity_id, version_seq, record) tuples.

Trait Implementations§

Source§

impl Default for VersionStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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, 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.