hoprd_db_api::aliases

Trait HoprdDbAliasesOperations

Source
pub trait HoprdDbAliasesOperations {
    // Required methods
    fn resolve_alias<'life0, 'async_trait>(
        &'life0 self,
        alias: String,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_aliases<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Alias>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_alias<'life0, 'async_trait>(
        &'life0 self,
        peer: String,
        alias: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_aliases<'life0, 'async_trait>(
        &'life0 self,
        aliases: Vec<Alias>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_alias<'life0, 'async_trait>(
        &'life0 self,
        alias: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_aliases<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Defines DB API for accessing HOPR settings (mainly aliases for now)

Required Methods§

Source

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

Retrieve the peer id for a given alias

Source

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

Retrieve all aliases

Source

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

Create new key pair value in the db. If peer is already aliased, db entry will be updated with the new alias. If peer is node’s PeerID, throws an error

Source

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

Update aliases. If some peers or aliases are already in the db, db entries will be updated with the new aliases. If node’s PeerID is among passed aliases, throws an error

Source

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

Delete alias. If not found, throws an error.

Source

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

Delete all aliases

Implementors§