Struct HoprDb

Source
pub struct HoprDb { /* private fields */ }

Implementations§

Source§

impl HoprDb

Source

pub async fn new( directory: &Path, chain_key: ChainKeypair, cfg: HoprDbConfig, ) -> Result<Self>

Source

pub async fn new_in_memory(chain_key: ChainKeypair) -> Result<Self>

Source

pub fn start_ticket_processing( &self, ticket_notifier: Option<UnboundedSender<AcknowledgedTicket>>, ) -> Result<()>

Starts ticket processing by the [TicketManager] with an optional new ticket notifier. Without calling this method, tickets will not be persisted into the DB.

If the notifier is given, it will receive notifications once new ticket has been persisted into the Tickets DB.

Source§

impl HoprDb

Source

pub async fn upsert_ticket<'a>( &'a self, tx: OptTx<'a>, acknowledged_ticket: AcknowledgedTicket, ) -> Result<()>

Used only by non-SQLite code and tests.

Trait Implementations§

Source§

impl Clone for HoprDb

Source§

fn clone(&self) -> HoprDb

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HoprDb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HoprDbAccountOperations for HoprDb

Source§

fn get_account<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<Option<AccountEntry>>> + Send + 'async_trait>>
where T: 'async_trait + Into<ChainOrPacketKey> + Send + Sync, Self: 'async_trait, 'a: 'async_trait,

Retrieves the account entry using a Packet key or Chain key.
Source§

fn get_self_account<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves account entry about this node’s account. This a unique account in the database that must always be present.
Source§

fn get_accounts<'a, 'async_trait>( &'a self, tx: OptTx<'a>, public_only: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<AccountEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves entries of accounts with routable address announcements (if public_only is true) or about all accounts without routeable address announcements (if public_only is false).
Source§

fn insert_account<'a, 'async_trait>( &'a self, tx: OptTx<'a>, account: AccountEntry, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Inserts new account entry to the database. Fails if such entry already exists.
Source§

fn insert_announcement<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, multiaddr: Multiaddr, at_block: u32, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry>> + Send + 'async_trait>>
where T: Into<ChainOrPacketKey> + Send + Sync + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Inserts routable address announcement linked to a specific entry. Read more
Source§

fn delete_all_announcements<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: Into<ChainOrPacketKey> + Send + Sync + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Deletes all address announcements for the given account.
Source§

fn delete_account<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: Into<ChainOrPacketKey> + Send + Sync + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Deletes account with the given key (chain or off-chain).
Source§

fn translate_key<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<Option<ChainOrPacketKey>>> + Send + 'async_trait>>
where T: 'async_trait + Into<ChainOrPacketKey> + Send + Sync, Self: 'async_trait, 'a: 'async_trait,

Translates the given Chain or Packet key to its counterpart. Read more
Source§

impl HoprDbChannelOperations for HoprDb

Source§

fn get_channel_by_id<'a, 'life0, 'async_trait>( &'a self, tx: OptTx<'a>, id: &'life0 Hash, ) -> Pin<Box<dyn Future<Output = Result<Option<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Retrieves channel by its channel ID hash. Read more
Source§

fn begin_channel_update<'a, 'life0, 'async_trait>( &'a self, tx: OptTx<'a>, id: &'life0 Hash, ) -> Pin<Box<dyn Future<Output = Result<Option<ChannelEditor>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Start changes to channel entry. If the channel with the given ID exists, the ChannelEditor is returned. Use HoprDbChannelOperations::finish_channel_update to commit edits to the DB when done.
Source§

fn finish_channel_update<'a, 'async_trait>( &'a self, tx: OptTx<'a>, editor: ChannelEditor, ) -> Pin<Box<dyn Future<Output = Result<ChannelEntry>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Commits changes of the channel to the database. Returns the updated channel, or on deletion, the deleted channel entry.
Source§

fn get_channel_by_parties<'a, 'life0, 'life1, 'async_trait>( &'a self, tx: OptTx<'a>, src: &'life0 Address, dst: &'life1 Address, use_cache: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves the channel by source and destination. This operation should be able to use cache since it can be also called from performance-sensitive locations.
Source§

fn get_channels_via<'a, 'life0, 'async_trait>( &'a self, tx: OptTx<'a>, direction: ChannelDirection, target: &'life0 Address, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Fetches all channels that are Incoming to the given target, or Outgoing from the given target
Source§

fn get_incoming_channels<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Fetches all channels that are Incoming to this node. Shorthand for get_channels_via(tx, ChannelDirection::Incoming, my_node)
Source§

fn get_outgoing_channels<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Fetches all channels that are Outgoing from this node. Shorthand for get_channels_via(tx, ChannelDirection::Outgoing, my_node)
Source§

fn get_all_channels<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves all channel information from the DB.
Source§

fn stream_active_channels<'a, 'async_trait>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, Result<ChannelEntry>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Returns a stream of all channels that are Open or PendingToClose with an active grace period.s
Source§

fn upsert_channel<'a, 'async_trait>( &'a self, tx: OptTx<'a>, channel_entry: ChannelEntry, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Inserts or updates the given channel entry.
Source§

impl HoprDbGeneralModelOperations for HoprDb

Source§

fn conn(&self, target_db: TargetDb) -> &DatabaseConnection

Retrieves raw database connection to the given DB.

Source§

fn begin_transaction_in_db<'life0, 'async_trait>( &'life0 self, target_db: TargetDb, ) -> Pin<Box<dyn Future<Output = Result<OpenTransaction>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Starts a new transaction in the given DB.

Source§

fn begin_transaction<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<OpenTransaction>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source§

fn nest_transaction_in_db<'life0, 'life1, 'async_trait>( &'life0 self, tx: OptTx<'life1>, target_db: TargetDb, ) -> Pin<Box<dyn Future<Output = Result<OpenTransaction>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a nested transaction inside the given transaction. Read more
Source§

fn nest_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: OptTx<'life1>, ) -> Pin<Box<dyn Future<Output = Result<OpenTransaction>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl HoprDbInfoOperations for HoprDb

Source§

fn index_is_empty<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks if the index is empty. Read more
Source§

fn clear_index_db<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Removes all data from all tables in the index database. Read more
Source§

fn get_safe_hopr_balance<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Gets node’s Safe balance of HOPR tokens.
Source§

fn set_safe_hopr_balance<'a, 'async_trait>( &'a self, tx: OptTx<'a>, new_balance: Balance, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets node’s Safe balance of HOPR tokens.
Source§

fn get_safe_hopr_allowance<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Gets node’s Safe allowance of HOPR tokens.
Source§

fn set_safe_hopr_allowance<'a, 'async_trait>( &'a self, tx: OptTx<'a>, new_allowance: Balance, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets node’s Safe allowance of HOPR tokens.
Source§

fn get_safe_info<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<Option<SafeInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Gets node’s Safe addresses info.
Source§

fn set_safe_info<'a, 'async_trait>( &'a self, tx: OptTx<'a>, safe_info: SafeInfo, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets node’s Safe addresses info.
Source§

fn get_indexer_data<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<IndexerData>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Gets stored Indexer data (either from the cache or from the DB). Read more
Source§

fn set_domain_separator<'a, 'async_trait>( &'a self, tx: OptTx<'a>, dst_type: DomainSeparator, value: Hash, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets a domain separator. Read more
Source§

fn set_minimum_incoming_ticket_win_prob<'a, 'async_trait>( &'a self, tx: OptTx<'a>, win_prob: f64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets the minimum required winning probability for incoming tickets. The value must be between zero and 1.
Source§

fn update_ticket_price<'a, 'async_trait>( &'a self, tx: OptTx<'a>, price: Balance, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Updates the ticket price. To retrieve the stored ticket price, use HoprDbInfoOperations::get_indexer_data, note that this setter should invalidate the cache.
Source§

fn get_indexer_state_info<'a, 'async_trait>( &'a self, tx: OptTx<'a>, ) -> Pin<Box<dyn Future<Output = Result<IndexerStateInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Gets the indexer state info.
Source§

fn set_indexer_state_info<'a, 'async_trait>( &'a self, tx: OptTx<'a>, block_num: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Updates the indexer state info.
Source§

fn set_network_registry_enabled<'a, 'async_trait>( &'a self, tx: OptTx<'a>, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Updates the network registry state. To retrieve the stored network registry state, use HoprDbInfoOperations::get_indexer_data, note that this setter should invalidate the cache.
Source§

fn get_global_setting<'a, 'life0, 'async_trait>( &'a self, tx: OptTx<'a>, key: &'life0 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Gets global setting value with the given key.
Source§

fn set_global_setting<'a, 'life0, 'life1, 'async_trait>( &'a self, tx: OptTx<'a>, key: &'life0 str, value: Option<&'life1 [u8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sets the global setting value with the given key. Read more
Source§

impl HoprDbLogOperations for HoprDb

Source§

fn store_log<'a, 'async_trait>( &'a self, log: SerializableLog, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Stores a single log entry in the database. Read more
Source§

fn store_logs<'life0, 'async_trait>( &'life0 self, logs: Vec<SerializableLog>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<()>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stores multiple log entries in the database. Read more
Source§

fn get_log<'life0, 'async_trait>( &'life0 self, block_number: u64, tx_index: u64, log_index: u64, ) -> Pin<Box<dyn Future<Output = Result<SerializableLog>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves a specific log entry from the database. Read more
Source§

fn get_logs<'a, 'async_trait>( &'a self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableLog>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves multiple log entries from the database. Read more
Source§

fn get_logs_count<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the count of log entries from the database. Read more
Source§

fn get_logs_block_numbers<'a, 'async_trait>( &'a self, block_number: Option<u64>, block_offset: Option<u64>, processed: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves block numbers of log entries from the database. Read more
Source§

fn set_logs_processed<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks multiple log entries as processed. Read more
Source§

fn set_log_processed<'a, 'async_trait>( &'a self, log: SerializableLog, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Marks a specific log entry as processed. Read more
Source§

fn set_logs_unprocessed<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks multiple log entries as unprocessed. Read more
Source§

fn get_last_checksummed_log<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<SerializableLog>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the last checksummed log entry from the database. Read more
Source§

fn update_logs_checksums<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates checksums for log entries in the database. Read more
Source§

fn ensure_logs_origin<'life0, 'async_trait>( &'life0 self, contract_address_topics: Vec<(Address, Hash)>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ensures that logs in this database have been created by scanning the given contract address and their corresponding topics. If the log DB is empty, the given addresses and topics are used to prime the table. Read more
Source§

impl HoprDbPeersOperations for HoprDb

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<()>> + 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<()>> + 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<()>> + 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>>> + 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>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Returns a stream of all stored peers, optionally matching the given PeerSelector filter. Read more
Source§

fn network_peer_stats<'life0, 'async_trait>( &'life0 self, quality_threshold: f64, ) -> Pin<Box<dyn Future<Output = Result<Stats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the statistics on the stored peers.
Source§

impl HoprDbProtocolOperations for HoprDb

Source§

fn handle_acknowledgement<'life0, 'life1, 'async_trait>( &'life0 self, ack: Acknowledgement, me: &'life1 ChainKeypair, ) -> Pin<Box<dyn Future<Output = Result<AckResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Processes the acknowledgements for the pending tickets Read more
Source§

fn get_network_winning_probability<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads (presumably cached) value of the network’s minimum winning probability from the DB.
Source§

fn get_network_ticket_price<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads (presumably cached) value of the network’s minimum ticket price from the DB.
Source§

fn to_send<'life0, 'async_trait>( &'life0 self, data: Box<[u8]>, me: ChainKeypair, path: Vec<OffchainPublicKey>, outgoing_ticket_win_prob: f64, outgoing_ticket_price: Balance, ) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process the data into an outgoing packet
Source§

fn from_recv<'life0, 'life1, 'async_trait>( &'life0 self, data: Box<[u8]>, me: ChainKeypair, pkt_keypair: &'life1 OffchainKeypair, sender: OffchainPublicKey, outgoing_ticket_win_prob: f64, outgoing_ticket_price: Balance, ) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process the incoming packet into data
Source§

impl HoprDbRegistryOperations for HoprDb

Source§

fn set_access_in_network_registry<'a, 'async_trait>( &'a self, tx: OptTx<'a>, address: Address, allowed: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets the given node as allowed or denied in network registry.
Source§

fn is_allowed_in_network_registry<'a, 'life0, 'async_trait, T>( &'a self, tx: OptTx<'a>, address_like: &'life0 T, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Address: TryFrom<T>, T: Clone + Sync + 'async_trait, Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Returns true if the given node is allowed in network registry.
Source§

fn set_safe_eligibility<'a, 'async_trait>( &'a self, tx: OptTx<'a>, address: Address, eligible: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Sets or unsets Safe NR eligibility.
Source§

fn is_safe_eligible<'a, 'async_trait>( &'a self, tx: OptTx<'a>, address: Address, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Returns true if the given Safe is NR eligible.
Source§

impl HoprDbResolverOperations for HoprDb

Source§

fn resolve_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, onchain_key: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tries to resolve off-chain public key given the on-chain address
Source§

fn resolve_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, offchain_key: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tries to resolve on-chain public key given the off-chain public key
Source§

impl HoprDbTicketOperations for HoprDb

Source§

fn get_all_tickets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AcknowledgedTicket>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve acknowledged winning tickets, according to the given selector. Read more
Source§

fn get_tickets<'life0, 'async_trait>( &'life0 self, selector: TicketSelector, ) -> Pin<Box<dyn Future<Output = Result<Vec<AcknowledgedTicket>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve acknowledged winning tickets, according to the given selector. Read more
Source§

fn mark_tickets_as<'life0, 'async_trait>( &'life0 self, selector: TicketSelector, mark_as: TicketMarker, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where 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 more
Source§

fn mark_unsaved_ticket_rejected<'life0, 'life1, 'async_trait>( &'life0 self, ticket: &'life1 Ticket, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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>( &'a self, selector: TicketSelector, new_state: AcknowledgedTicketStatus, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AcknowledgedTicket>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Updates state of the tickets matching the given selector. Read more
Source§

fn update_ticket_states<'life0, 'async_trait>( &'life0 self, selector: TicketSelector, new_state: AcknowledgedTicketStatus, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where 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<Hash>, ) -> Pin<Box<dyn Future<Output = Result<ChannelTicketStatistics>> + 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<()>> + 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, 'async_trait>( &'life0 self, selector: TicketSelector, ) -> Pin<Box<dyn Future<Output = Result<(usize, Balance)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Counts the tickets matching the given selector and their total value. Read more
Source§

fn compare_and_set_outgoing_ticket_index<'life0, 'async_trait>( &'life0 self, channel_id: Hash, index: u64, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets the stored outgoing ticket index to index, only if the currently stored value is less than index. This ensures the stored value can only be growing. Read more
Source§

fn reset_outgoing_ticket_index<'life0, 'async_trait>( &'life0 self, channel_id: Hash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resets the outgoing ticket index to 0 for the given channel id. Read more
Source§

fn increment_outgoing_ticket_index<'life0, 'async_trait>( &'life0 self, channel_id: Hash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Increments the outgoing ticket index in the given channel ID and returns the value before incrementing. Read more
Source§

fn get_outgoing_ticket_index<'life0, 'async_trait>( &'life0 self, channel_id: Hash, ) -> Pin<Box<dyn Future<Output = Result<Arc<AtomicU64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the current outgoing ticket index for the given channel id. Read more
Source§

fn persist_outgoing_ticket_indices<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Compares outgoing ticket indices in the cache with the stored values and updates the stored value where changed. Read more
Source§

fn prepare_aggregation_in_channel<'life0, 'life1, 'async_trait>( &'life0 self, channel: &'life1 Hash, prerequisites: AggregationPrerequisites, ) -> Pin<Box<dyn Future<Output = Result<Option<(OffchainPublicKey, Vec<TransferableWinningTicket>, Hash)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Prepare a viable collection of tickets to be aggregated. Read more
Source§

fn rollback_aggregation_in_channel<'life0, 'async_trait>( &'life0 self, channel: Hash, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform a ticket aggregation rollback in the channel. Read more
Source§

fn process_received_aggregated_ticket<'life0, 'life1, 'async_trait>( &'life0 self, aggregated_ticket: Ticket, chain_keypair: &'life1 ChainKeypair, ) -> Pin<Box<dyn Future<Output = Result<AcknowledgedTicket>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replace the aggregated tickets locally with an aggregated ticket from the counterparty.
Source§

fn aggregate_tickets<'life0, 'life1, 'async_trait>( &'life0 self, destination: OffchainPublicKey, acked_tickets: Vec<TransferableWinningTicket>, me: &'life1 ChainKeypair, ) -> Pin<Box<dyn Future<Output = Result<VerifiedTicket>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Performs ticket aggregation as an issuing party of the given tickets.
Source§

fn fix_channels_next_ticket_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fix next ticket state if its out-of-sync in all this node’s channels.
Source§

impl HoprDbAllOperations for HoprDb

Auto Trait Implementations§

§

impl !Freeze for HoprDb

§

impl !RefUnwindSafe for HoprDb

§

impl Send for HoprDb

§

impl Sync for HoprDb

§

impl Unpin for HoprDb

§

impl !UnwindSafe for HoprDb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeSendSync for T