pub trait CursorStore: MaybeSend + MaybeSync {
// Required methods
fn lowest_common_cursor(
&self,
topics: &[&Topic],
) -> Result<GlobalCursor, CursorStoreError>;
fn latest(&self, topic: &Topic) -> Result<GlobalCursor, CursorStoreError>;
fn latest_per_originator(
&self,
topic: &Topic,
originators: &[&OriginatorId],
) -> Result<GlobalCursor, CursorStoreError>;
fn latest_for_topics(
&self,
topics: &mut dyn Iterator<Item = &Topic>,
) -> Result<HashMap<Topic, GlobalCursor>, CursorStoreError>;
fn lcc_maybe_missing(
&self,
topic: &[&Topic],
) -> Result<GlobalCursor, CursorStoreError>;
fn find_message_dependencies(
&self,
hashes: &[&[u8]],
) -> Result<HashMap<Vec<u8>, Cursor>, CursorStoreError>;
fn ice(
&self,
orphans: Vec<OrphanedEnvelope>,
) -> Result<(), CursorStoreError>;
fn resolve_children(
&self,
cursors: &[Cursor],
) -> Result<Vec<OrphanedEnvelope>, CursorStoreError>;
// Provided method
fn latest_for_originator(
&self,
topic: &Topic,
originator: &OriginatorId,
) -> Result<Cursor, CursorStoreError> { ... }
}Expand description
Trait defining how cursors should be stored, updated, and fetched NOTE:, implementations decide retry strategy. the exact implementation of persistence (or lack) is up to implementors. functions are assumed to be idempotent & atomic.
Required Methods§
Sourcefn lowest_common_cursor(
&self,
topics: &[&Topic],
) -> Result<GlobalCursor, CursorStoreError>
fn lowest_common_cursor( &self, topics: &[&Topic], ) -> Result<GlobalCursor, CursorStoreError>
Compute the lowest common cursor across a set of topics. For each node_id, uses the minimum sequence ID seen across all topics.
Sourcefn latest(&self, topic: &Topic) -> Result<GlobalCursor, CursorStoreError>
fn latest(&self, topic: &Topic) -> Result<GlobalCursor, CursorStoreError>
get the highest sequence id for a topic, regardless of originator
Sourcefn latest_per_originator(
&self,
topic: &Topic,
originators: &[&OriginatorId],
) -> Result<GlobalCursor, CursorStoreError>
fn latest_per_originator( &self, topic: &Topic, originators: &[&OriginatorId], ) -> Result<GlobalCursor, CursorStoreError>
Get the latest cursor for each originator
Sourcefn latest_for_topics(
&self,
topics: &mut dyn Iterator<Item = &Topic>,
) -> Result<HashMap<Topic, GlobalCursor>, CursorStoreError>
fn latest_for_topics( &self, topics: &mut dyn Iterator<Item = &Topic>, ) -> Result<HashMap<Topic, GlobalCursor>, CursorStoreError>
Get the latest cursor for multiple topics at once. Returns a HashMap mapping each topic to its GlobalCursor.
fn lcc_maybe_missing( &self, topic: &[&Topic], ) -> Result<GlobalCursor, CursorStoreError>
Sourcefn find_message_dependencies(
&self,
hashes: &[&[u8]],
) -> Result<HashMap<Vec<u8>, Cursor>, CursorStoreError>
fn find_message_dependencies( &self, hashes: &[&[u8]], ) -> Result<HashMap<Vec<u8>, Cursor>, CursorStoreError>
find dependencies of each locally-stored intent payload hash
Sourcefn ice(&self, orphans: Vec<OrphanedEnvelope>) -> Result<(), CursorStoreError>
fn ice(&self, orphans: Vec<OrphanedEnvelope>) -> Result<(), CursorStoreError>
ice envelopes that cannot yet be processed
Sourcefn resolve_children(
&self,
cursors: &[Cursor],
) -> Result<Vec<OrphanedEnvelope>, CursorStoreError>
fn resolve_children( &self, cursors: &[Cursor], ) -> Result<Vec<OrphanedEnvelope>, CursorStoreError>
try to resolve any children that may depend on Cursor