CursorStore

Trait CursorStore 

Source
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§

Source

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.

Source

fn latest(&self, topic: &Topic) -> Result<GlobalCursor, CursorStoreError>

get the highest sequence id for a topic, regardless of originator

Source

fn latest_per_originator( &self, topic: &Topic, originators: &[&OriginatorId], ) -> Result<GlobalCursor, CursorStoreError>

Get the latest cursor for each originator

Source

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.

Source

fn lcc_maybe_missing( &self, topic: &[&Topic], ) -> Result<GlobalCursor, CursorStoreError>

Source

fn find_message_dependencies( &self, hashes: &[&[u8]], ) -> Result<HashMap<Vec<u8>, Cursor>, CursorStoreError>

find dependencies of each locally-stored intent payload hash

Source

fn ice(&self, orphans: Vec<OrphanedEnvelope>) -> Result<(), CursorStoreError>

ice envelopes that cannot yet be processed

Source

fn resolve_children( &self, cursors: &[Cursor], ) -> Result<Vec<OrphanedEnvelope>, CursorStoreError>

try to resolve any children that may depend on Cursor

Provided Methods§

Implementations on Foreign Types§

Source§

impl<T: CursorStore + ?Sized> CursorStore for &T

Source§

impl<T: CursorStore + ?Sized> CursorStore for Box<T>

Source§

impl<T: CursorStore + ?Sized> CursorStore for Arc<T>

Source§

impl<T: CursorStore> CursorStore for Option<T>

Implementors§