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<VersionVector, Self::Error>;
fn missing(
&self,
doc_id: &str,
remote: &VersionVector,
) -> Result<Vec<PatchRow>, Self::Error>;
fn sync_state(
&mut self,
doc_id: &str,
remote: &VersionVector,
) -> Result<(Vec<PatchRow>, VersionVector), 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§
Required Methods§
Sourcefn append(&mut self, rows: &[PatchRow]) -> Result<AppendResult, Self::Error>
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.
fn vector(&self, doc_id: &str) -> Result<VersionVector, Self::Error>
Sourcefn missing(
&self,
doc_id: &str,
remote: &VersionVector,
) -> Result<Vec<PatchRow>, Self::Error>
fn missing( &self, doc_id: &str, remote: &VersionVector, ) -> Result<Vec<PatchRow>, Self::Error>
Ready rows the peer lacks, ordered by actor and clock.
Sourcefn sync_state(
&mut self,
doc_id: &str,
remote: &VersionVector,
) -> Result<(Vec<PatchRow>, VersionVector), Self::Error>
fn sync_state( &mut self, doc_id: &str, remote: &VersionVector, ) -> Result<(Vec<PatchRow>, VersionVector), 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".