pub trait HoprDbAccountOperations {
// Required methods
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: Into<ChainOrPacketKey> + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait;
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;
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;
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;
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;
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;
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;
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: Into<ChainOrPacketKey> + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait;
}
Expand description
Defines DB API for accessing HOPR accounts and corresponding on-chain announcements.
Accounts store the Chain and Packet key information, so as the routable network information, if the account has been announced as well.
Required Methods§
Sourcefn get_account<'a, 'async_trait, T>(
&'a self,
tx: OptTx<'a>,
key: T,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountEntry>>> + Send + 'async_trait>>
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>>
Retrieves the account entry using a Packet key or Chain key.
Sourcefn 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,
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.
Sourcefn 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,
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
).
Sourcefn 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,
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.
Sourcefn 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>>
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>>
Inserts routable address announcement linked to a specific entry.
If an account matching the given key
(chain or off-chain key) does not exist, an
error is returned.
If such multiaddr
has been already announced for the given account key
, only
the at_block
will be updated on that announcement.
Sourcefn delete_all_announcements<'a, 'async_trait, T>(
&'a self,
tx: OptTx<'a>,
key: T,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn delete_all_announcements<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Deletes all address announcements for the given account.
Sourcefn delete_account<'a, 'async_trait, T>(
&'a self,
tx: OptTx<'a>,
key: T,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn delete_account<'a, 'async_trait, T>( &'a self, tx: OptTx<'a>, key: T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Deletes account with the given key
(chain or off-chain).
Sourcefn translate_key<'a, 'async_trait, T>(
&'a self,
tx: OptTx<'a>,
key: T,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainOrPacketKey>>> + Send + 'async_trait>>
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>>
Translates the given Chain or Packet key to its counterpart.
If Address
is given as key
, the result will contain OffchainPublicKey
if present.
If OffchainPublicKey
is given as key
, the result will contain Address
if present.
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.