Skip to main content

QueryRefreshState

Trait QueryRefreshState 

Source
pub trait QueryRefreshState {
    // Required methods
    fn get_refresh_state<Id: AsRef<[u8]>>(
        &self,
        entity_id: Id,
        entity_kind: EntityKind,
    ) -> Result<Option<RefreshState>, StorageError>;
    fn get_last_cursor<Id: AsRef<[u8]>>(
        &self,
        id: Id,
        entity_kind: EntityKind,
    ) -> Result<Cursor, StorageError>;
    fn get_last_cursor_for_ids<Id: AsRef<[u8]>>(
        &self,
        ids: &[Id],
        entities: &[EntityKind],
    ) -> Result<HashMap<Vec<u8>, Cursor>, StorageError>;
    fn update_cursor<Id: AsRef<[u8]>>(
        &self,
        entity_id: Id,
        entity_kind: EntityKind,
        cursor: Cursor,
    ) -> Result<bool, StorageError>;

    // Provided methods
    fn latest_cursor_for_id<Id: AsRef<[u8]>>(
        &self,
        entity_id: Id,
        entities: &[EntityKind],
    ) -> Result<Cursor, StorageError> { ... }
    fn get_remote_log_cursors(
        &self,
        conversation_ids: &[&[u8]],
    ) -> Result<HashMap<Vec<u8>, Cursor>, StorageError> { ... }
}

Required Methods§

Source

fn get_refresh_state<Id: AsRef<[u8]>>( &self, entity_id: Id, entity_kind: EntityKind, ) -> Result<Option<RefreshState>, StorageError>

Source

fn get_last_cursor<Id: AsRef<[u8]>>( &self, id: Id, entity_kind: EntityKind, ) -> Result<Cursor, StorageError>

Read one ledger position. Create a zero position when it is absent.

Source

fn get_last_cursor_for_ids<Id: AsRef<[u8]>>( &self, ids: &[Id], entities: &[EntityKind], ) -> Result<HashMap<Vec<u8>, Cursor>, StorageError>

Return the minimum position across the requested kinds for each stored id. An absent kind has position zero. Ids with no rows are absent from the map.

Source

fn update_cursor<Id: AsRef<[u8]>>( &self, entity_id: Id, entity_kind: EntityKind, cursor: Cursor, ) -> Result<bool, StorageError>

Advance a ledger position only when the new position is greater.

Provided Methods§

Source

fn latest_cursor_for_id<Id: AsRef<[u8]>>( &self, entity_id: Id, entities: &[EntityKind], ) -> Result<Cursor, StorageError>

Source

fn get_remote_log_cursors( &self, conversation_ids: &[&[u8]], ) -> Result<HashMap<Vec<u8>, Cursor>, StorageError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: QueryRefreshState> QueryRefreshState for &T

Source§

fn get_refresh_state<Id: AsRef<[u8]>>( &self, entity_id: Id, entity_kind: EntityKind, ) -> Result<Option<RefreshState>, StorageError>

Source§

fn get_last_cursor<Id: AsRef<[u8]>>( &self, id: Id, entity_kind: EntityKind, ) -> Result<Cursor, StorageError>

Source§

fn get_last_cursor_for_ids<Id: AsRef<[u8]>>( &self, ids: &[Id], entities: &[EntityKind], ) -> Result<HashMap<Vec<u8>, Cursor>, StorageError>

Source§

fn update_cursor<Id: AsRef<[u8]>>( &self, entity_id: Id, entity_kind: EntityKind, cursor: Cursor, ) -> Result<bool, StorageError>

Implementors§