Skip to main content

PatchStore

Trait PatchStore 

Source
pub trait PatchStore {
    type Error: From<Error> + Into<Error>;

    // Required methods
    fn append(&mut self, rows: &[PatchRow]) -> Result<AppendResult, Self::Error>;
    fn vector(&self, doc_id: &str) -> Result<Vec<(u64, u64)>, Self::Error>;
    fn missing(
        &self,
        doc_id: &str,
        remote: &Vec<(u64, u64)>,
    ) -> Result<Vec<PatchRow>, Self::Error>;
    fn sync_state(
        &mut self,
        doc_id: &str,
        remote: &Vec<(u64, u64)>,
    ) -> Result<(Vec<PatchRow>, Vec<(u64, u64)>), Self::Error>;
}
Expand description

Rows keyed by (doc_id, sid, clock), whose operations are immutable. Rows stay pending until their actor prefix is contiguous and their dependencies are stored.

A store keeps the last value only of a field without history (“Fields without history” in docs/PROTOCOL.md and docs/STORAGE.md): once a last-value row is ready (last_register_of), the older row of its register is removed. The row before the removed one grows its span, or a gap row (GAP_OPERATIONS) stays.

Required Associated Types§

Source

type Error: From<Error> + Into<Error>

Carries a Pulsify protocol error code, like Error.

Required Methods§

Source

fn append(&mut self, rows: &[PatchRow]) -> Result<AppendResult, Self::Error>

Validates and stores rows of one document atomically. Retransmissions are ignored, whatever their span; a conflict (other operations at a stored identity, or an actor fork) stores nothing.

Source

fn vector(&self, doc_id: &str) -> Result<Vec<(u64, u64)>, Self::Error>

Source

fn missing( &self, doc_id: &str, remote: &Vec<(u64, u64)>, ) -> Result<Vec<PatchRow>, Self::Error>

Ready rows the peer lacks, ordered by actor and clock.

Source

fn sync_state( &mut self, doc_id: &str, remote: &Vec<(u64, u64)>, ) -> Result<(Vec<PatchRow>, Vec<(u64, u64)>), Self::Error>

missing and vector from one consistent snapshot.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§