Skip to main content

TicketQueueStore

Trait TicketQueueStore 

Source
pub trait TicketQueueStore {
    type Queue: TicketQueue;

    // Required methods
    fn open_or_create_queue(
        &mut self,
        channel_id: &ChannelId,
    ) -> Result<Self::Queue, <Self::Queue as TicketQueue>::Error>;
    fn delete_queue(
        &mut self,
        channel_id: &ChannelId,
    ) -> Result<Vec<VerifiedTicket>, <Self::Queue as TicketQueue>::Error>;
    fn iter_queues(
        &self,
    ) -> Result<impl Iterator<Item = ChannelId>, <Self::Queue as TicketQueue>::Error>;
}
Expand description

Allows loading ticket queues from a storage.

This trait reflects the possibility of a node to relay packets for receiving tickets.

Required Associated Types§

Source

type Queue: TicketQueue

Type of per-channel incoming ticket queues.

Required Methods§

Source

fn open_or_create_queue( &mut self, channel_id: &ChannelId, ) -> Result<Self::Queue, <Self::Queue as TicketQueue>::Error>

Opens or creates a new queue in storage for the given channel.

Source

fn delete_queue( &mut self, channel_id: &ChannelId, ) -> Result<Vec<VerifiedTicket>, <Self::Queue as TicketQueue>::Error>

Deletes the queue for the given channel.

Returns any tickets left-over in this queue if it existed. Returned tickets are no longer redeemable.

Source

fn iter_queues( &self, ) -> Result<impl Iterator<Item = ChannelId>, <Self::Queue as TicketQueue>::Error>

Iterate over all channel IDs of ticket queues in the storage.

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§