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§
Sourcefn save_snapshot(&mut self, state: &GA3, clock: &VectorClock)
fn save_snapshot(&mut self, state: &GA3, clock: &VectorClock)
Save a state snapshot.
Sourcefn load_latest_snapshot(&self) -> Option<Snapshot>
fn load_latest_snapshot(&self) -> Option<Snapshot>
Load the latest snapshot.
Sourcefn load_snapshot(&self, id: u64) -> Option<Snapshot>
fn load_snapshot(&self, id: u64) -> Option<Snapshot>
Load a specific snapshot by ID.
Sourcefn append_operation(&mut self, delta: StateDelta)
fn append_operation(&mut self, delta: StateDelta)
Append an operation to the log.
Sourcefn operations_since(&self, clock: &VectorClock) -> Vec<StoredOperation>
fn operations_since(&self, clock: &VectorClock) -> Vec<StoredOperation>
Get all operations since a given clock.
Sourcefn operations_since_sequence(&self, sequence: u64) -> Vec<StoredOperation>
fn operations_since_sequence(&self, sequence: u64) -> Vec<StoredOperation>
Get all operations since a given sequence number.
Sourcefn compact(&mut self) -> Option<Snapshot>
fn compact(&mut self) -> Option<Snapshot>
Compact the operation log by creating a new snapshot.
Operations before the snapshot can be discarded.
Sourcefn stats(&self) -> StorageStats
fn stats(&self) -> StorageStats
Get storage statistics.