pub struct MemoryStore {
tickets: HashMap<ChannelId, MemoryTicketQueue>,
out_indices: HashMap<(ChannelId, u32), u64>,
}Expand description
Simple non-persistent ticket queue store backed by a HashMap and MemoryTicketQueue.
Useful for non-persistent and testing scenarios.
Fields§
§tickets: HashMap<ChannelId, MemoryTicketQueue>§out_indices: HashMap<(ChannelId, u32), u64>Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§fn clone(&self) -> MemoryStore
fn clone(&self) -> MemoryStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Source§impl OutgoingIndexStore for MemoryStore
impl OutgoingIndexStore for MemoryStore
type Error = Infallible
Source§fn load_outgoing_index(
&self,
channel_id: &ChannelId,
epoch: u32,
) -> Result<Option<u64>, Self::Error>
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. Read more
Source§fn save_outgoing_index(
&mut self,
channel_id: &ChannelId,
epoch: u32,
index: u64,
) -> Result<(), Self::Error>
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§impl TicketQueueStore for MemoryStore
impl TicketQueueStore for MemoryStore
Source§type Queue = MemoryTicketQueue
type Queue = MemoryTicketQueue
Type of per-channel incoming ticket queues.
Source§fn open_or_create_queue(
&mut self,
channel_id: &ChannelId,
) -> Result<Self::Queue, <Self::Queue as TicketQueue>::Error>
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>
fn delete_queue( &mut self, channel_id: &ChannelId, ) -> Result<Vec<VerifiedTicket>, <Self::Queue as TicketQueue>::Error>
Deletes the queue for the given channel. Read more
Source§fn iter_queues(
&self,
) -> Result<impl Iterator<Item = ChannelId>, <Self::Queue as TicketQueue>::Error>
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.
Auto Trait Implementations§
impl Freeze for MemoryStore
impl !RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl !UnwindSafe for MemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more