pub struct HoprNodeDb { /* private fields */ }Implementations§
Source§impl HoprNodeDb
impl HoprNodeDb
pub async fn new( directory: &Path, cfg: HoprNodeDbConfig, ) -> Result<Self, NodeDbError>
pub async fn new_in_memory() -> Result<Self, NodeDbError>
pub fn config(&self) -> &HoprNodeDbConfig
Trait Implementations§
Source§impl Clone for HoprNodeDb
impl Clone for HoprNodeDb
Source§fn clone(&self) -> HoprNodeDb
fn clone(&self) -> HoprNodeDb
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 HoprDbPeersOperations for HoprNodeDb
impl HoprDbPeersOperations for HoprNodeDb
type Error = NodeDbError
Source§fn add_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
origin: PeerOrigin,
mas: Vec<Multiaddr>,
backoff: f64,
quality_window: u32,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
origin: PeerOrigin,
mas: Vec<Multiaddr>,
backoff: f64,
quality_window: u32,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Adds a peer to the backend. Read more
Source§fn remove_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes the peer from the backend. Read more
Source§fn update_network_peer<'life0, 'async_trait>(
&'life0 self,
new_status: PeerStatus,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_network_peer<'life0, 'async_trait>(
&'life0 self,
new_status: PeerStatus,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Updates stored information about the peer.
Should fail if the peer does not exist in the store.
Source§fn get_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerStatus>, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_network_peer<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerStatus>, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets stored information about the peer. Read more
Source§fn get_network_peers<'a, 'async_trait>(
&'a self,
selector: PeerSelector,
sort_last_seen_asc: bool,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, PeerStatus>, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_network_peers<'a, 'async_trait>(
&'a self,
selector: PeerSelector,
sort_last_seen_asc: bool,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, PeerStatus>, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Returns a stream of all stored peers, optionally matching the given
PeerSelector filter. Read moreSource§fn network_peer_stats<'life0, 'async_trait>(
&'life0 self,
quality_threshold: f64,
) -> Pin<Box<dyn Future<Output = Result<Stats, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn network_peer_stats<'life0, 'async_trait>(
&'life0 self,
quality_threshold: f64,
) -> Pin<Box<dyn Future<Output = Result<Stats, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the statistics on the stored peers.
Source§impl HoprDbTicketOperations for HoprNodeDb
impl HoprDbTicketOperations for HoprNodeDb
type Error = NodeDbError
Source§fn stream_tickets<'c, 'async_trait, S, I>(
&'c self,
selectors: I,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'c, RedeemableTicket>, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'c: 'async_trait,
fn stream_tickets<'c, 'async_trait, S, I>(
&'c self,
selectors: I,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'c, RedeemableTicket>, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'c: 'async_trait,
Retrieve acknowledged winning tickets, according to the given
selectors. Read moreSource§fn insert_ticket<'life0, 'async_trait>(
&'life0 self,
ticket: RedeemableTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert_ticket<'life0, 'async_trait>(
&'life0 self,
ticket: RedeemableTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Inserts a new winning ticket into the DB. Read more
Source§fn mark_tickets_as<'life0, 'async_trait, S, I>(
&'life0 self,
selectors: I,
mark_as: TicketMarker,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector> + Send,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn mark_tickets_as<'life0, 'async_trait, S, I>(
&'life0 self,
selectors: I,
mark_as: TicketMarker,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector> + Send,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Marks tickets as the given
TicketMarker, removing them from the DB and updating the
ticket statistics for each ticket’s channel. Read moreSource§fn mark_unsaved_ticket_rejected<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
issuer: &'life1 Address,
ticket: &'life2 Ticket,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn mark_unsaved_ticket_rejected<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
issuer: &'life1 Address,
ticket: &'life2 Ticket,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Updates the ticket statistics according to the fact that the given ticket has
been rejected by the packet processing pipeline. Read more
Source§fn update_ticket_states_and_fetch<'a, 'async_trait, S, I>(
&'a self,
selectors: I,
new_state: AcknowledgedTicketStatus,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, RedeemableTicket>, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'a: 'async_trait,
fn update_ticket_states_and_fetch<'a, 'async_trait, S, I>(
&'a self,
selectors: I,
new_state: AcknowledgedTicketStatus,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, RedeemableTicket>, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'a: 'async_trait,
Source§fn update_ticket_states<'life0, 'async_trait, S, I>(
&'life0 self,
selectors: I,
new_state: AcknowledgedTicketStatus,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn update_ticket_states<'life0, 'async_trait, S, I>(
&'life0 self,
selectors: I,
new_state: AcknowledgedTicketStatus,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Into<TicketSelector>,
I: 'async_trait + IntoIterator<Item = S> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Updates state of the tickets matching the given
selector.Source§fn get_ticket_statistics<'life0, 'async_trait>(
&'life0 self,
channel_id: Option<ChannelId>,
) -> Pin<Box<dyn Future<Output = Result<ChannelTicketStatistics, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_ticket_statistics<'life0, 'async_trait>(
&'life0 self,
channel_id: Option<ChannelId>,
) -> Pin<Box<dyn Future<Output = Result<ChannelTicketStatistics, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the ticket statistics for the given channel. Read more
Source§fn reset_ticket_statistics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset_ticket_statistics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resets the ticket statistics about neglected, rejected, and redeemed tickets.
Source§fn get_tickets_value<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tickets_value<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, NodeDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Counts the total value of tickets matching the channel. Read more
Source§fn get_or_create_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_or_create_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets the index of the next outgoing ticket for the given channel. Read more
Source§fn update_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
index: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
index: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores the ticket index of the next outgoing ticket for the given channel. Read more
Source§fn remove_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes the outgoing ticket index for the given channel and epoch. Read more
Auto Trait Implementations§
impl Freeze for HoprNodeDb
impl !RefUnwindSafe for HoprNodeDb
impl Send for HoprNodeDb
impl Sync for HoprNodeDb
impl Unpin for HoprNodeDb
impl !UnwindSafe for HoprNodeDb
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,
Source§impl<T, E> HoprNodeDbApi for Twhere
T: HoprDbTicketOperations<Error = E> + HoprDbPeersOperations<Error = E>,
E: Error + Send + Sync + 'static,
impl<T, E> HoprNodeDbApi for Twhere
T: HoprDbTicketOperations<Error = E> + HoprDbPeersOperations<Error = E>,
E: Error + Send + Sync + 'static,
type NodeDbError = E
§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