Skip to main content

OutgoingIndexStore

Trait OutgoingIndexStore 

Source
pub trait OutgoingIndexStore {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn load_outgoing_index(
        &self,
        channel_id: &ChannelId,
        epoch: u32,
    ) -> Result<Option<u64>, Self::Error>;
    fn save_outgoing_index(
        &mut self,
        channel_id: &ChannelId,
        epoch: u32,
        index: u64,
    ) -> Result<(), Self::Error>;
    fn delete_outgoing_index(
        &mut self,
        channel_id: &ChannelId,
        epoch: u32,
    ) -> Result<(), Self::Error>;
    fn iter_outgoing_indices(
        &self,
    ) -> Result<impl Iterator<Item = (ChannelId, u32)>, Self::Error>;
}
Expand description

Allows loading and saving outgoing ticket indices.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn load_outgoing_index( &self, channel_id: &ChannelId, epoch: u32, ) -> Result<Option<u64>, Self::Error>

Loads the last used outgoing ticket index for the given channel and epoch.

If the index is not found, returns Ok(None).

Source

fn save_outgoing_index( &mut self, channel_id: &ChannelId, epoch: u32, index: u64, ) -> Result<(), Self::Error>

Saves the last used outgoing ticket index for the given channel and epoch.

Source

fn delete_outgoing_index( &mut self, channel_id: &ChannelId, epoch: u32, ) -> Result<(), Self::Error>

Deletes the outgoing ticket index for the given channel and epoch.

Source

fn iter_outgoing_indices( &self, ) -> Result<impl Iterator<Item = (ChannelId, u32)>, Self::Error>

Iterate over all channel IDs and epochs of outgoing ticket indices in the storage.

The iterator may yield the values in arbitrary order.

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.

Implementors§