Trait WriteGroupStore
pub trait WriteGroupStore {
type Error: Error + Classify + 'static;
// Required method
async fn read_groups(
&self,
after: Option<SequencePosition>,
max_events: NonZeroUsize,
) -> Result<GroupPage, Self::Error>;
}Expand description
A store that can read its log back in the write groups it wrote.
Every row belongs to exactly one group: one append is one group, and one
IngestGroup that lands at least one foreign event is
one group, its compensation included. A group is named by the lowest local
position among the rows it wrote, which is its first.
Only a runner and a store peer should hold one of these, for the reason
IngestStore gives: it is replication’s view of the
log, not an application’s.
§Flavours
This is the !Send flavour, and generic code should bind it (RS-20-2).
Adapters that can cross threads implement SendWriteGroupStore and get
this for free; the Durable Object implements this one.
Required Associated Types§
Required Methods§
async fn read_groups(
&self,
after: Option<SequencePosition>,
max_events: NonZeroUsize,
) -> Result<GroupPage, Self::Error>
async fn read_groups( &self, after: Option<SequencePosition>, max_events: NonZeroUsize, ) -> Result<GroupPage, Self::Error>
The write groups whose first position is above
after (every group when None), in ascending first order, each
whole.
Fills to max_events events and stops before the group that would
take the page past it. The first group is returned whole however many
events it carries, so a caller always learns what blocks it; whether it
can travel is the caller’s to decide. Chaining pages with
after = Some(last.first()) returns every group exactly once.
GroupPage::waiting is Waiting::Nothing only when the store saw
no group past the page, and Waiting::Unknown otherwise. A store
never counts: a count is a scan of the rest of the log.
§Errors
The adapter’s error; its Classify impl states the
class. A stored guard the store cannot decode is one of them.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".