pub trait Store: Send {
// Required methods
fn origin(&self) -> &Origin;
fn get(&self, id: &RecordId) -> Result<Option<Record>>;
fn history(&self, id: &RecordId) -> Result<Vec<Event>>;
fn event_by_idempotency_key(&self, key: &str) -> Result<Option<Event>>;
fn commit(&mut self, event: Event, snapshot: Record) -> Result<()>;
fn list(&self, query: &RecordQuery) -> Result<Vec<Record>>;
fn incoming(&self, target: &RecordId) -> Result<Vec<IncomingEdge>>;
}Required Methods§
Sourcefn history(&self, id: &RecordId) -> Result<Vec<Event>>
fn history(&self, id: &RecordId) -> Result<Vec<Event>>
Full history of a record, ordered by sequence.
fn event_by_idempotency_key(&self, key: &str) -> Result<Option<Event>>
Sourcefn commit(&mut self, event: Event, snapshot: Record) -> Result<()>
fn commit(&mut self, event: Event, snapshot: Record) -> Result<()>
Atomically append event and replace the snapshot with snapshot.
Must fail with crate::Error::Conflict unless event.sequence is
exactly one more than the stored version, and with
crate::Error::IdempotencyConflict if the event’s idempotency key is
already used. When event is a redaction, earlier events of the record
must be scrubbed with crate::event::scrub_event in the same
transaction.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".