Skip to main content

GeometricStore

Trait GeometricStore 

Source
pub trait GeometricStore {
    // Required methods
    fn save_snapshot(&mut self, state: &GA3, clock: &VectorClock);
    fn load_latest_snapshot(&self) -> Option<Snapshot>;
    fn load_snapshot(&self, id: u64) -> Option<Snapshot>;
    fn append_operation(&mut self, delta: StateDelta);
    fn operations_since(&self, clock: &VectorClock) -> Vec<StoredOperation>;
    fn operations_since_sequence(&self, sequence: u64) -> Vec<StoredOperation>;
    fn compact(&mut self) -> Option<Snapshot>;
    fn stats(&self) -> StorageStats;
    fn clear(&mut self);
}
Expand description

Trait for geometric state persistence.

Implementations may target different backends:

  • MemoryStore: In-memory (for testing)
  • IndexedDbStore: Browser IndexedDB (for WASM)
  • FileStore: File system (for native)

Required Methods§

Source

fn save_snapshot(&mut self, state: &GA3, clock: &VectorClock)

Save a state snapshot.

Source

fn load_latest_snapshot(&self) -> Option<Snapshot>

Load the latest snapshot.

Source

fn load_snapshot(&self, id: u64) -> Option<Snapshot>

Load a specific snapshot by ID.

Source

fn append_operation(&mut self, delta: StateDelta)

Append an operation to the log.

Source

fn operations_since(&self, clock: &VectorClock) -> Vec<StoredOperation>

Get all operations since a given clock.

Source

fn operations_since_sequence(&self, sequence: u64) -> Vec<StoredOperation>

Get all operations since a given sequence number.

Source

fn compact(&mut self) -> Option<Snapshot>

Compact the operation log by creating a new snapshot.

Operations before the snapshot can be discarded.

Source

fn stats(&self) -> StorageStats

Get storage statistics.

Source

fn clear(&mut self)

Clear all stored data.

Implementors§