Backend

Trait Backend 

Source
pub trait Backend {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn insert_account(
        &self,
        entry: AccountEntry,
    ) -> Result<Option<AccountEntry>, Self::Error>;
    fn insert_channel(
        &self,
        channel: ChannelEntry,
    ) -> Result<Option<ChannelEntry>, Self::Error>;
    fn get_account_by_id(
        &self,
        id: &HoprKeyIdent,
    ) -> Result<Option<AccountEntry>, Self::Error>;
    fn get_account_by_key(
        &self,
        key: &OffchainPublicKey,
    ) -> Result<Option<AccountEntry>, Self::Error>;
    fn get_account_by_address(
        &self,
        chain_key: &Address,
    ) -> Result<Option<AccountEntry>, Self::Error>;
    fn get_channel_by_id(
        &self,
        id: &ChannelId,
    ) -> Result<Option<ChannelEntry>, Self::Error>;
}
Expand description

Represents a cache backend for the connector.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn insert_account( &self, entry: AccountEntry, ) -> Result<Option<AccountEntry>, Self::Error>

Inserts an AccountEntry into the backend.

Returns the old value if one was present in the backend before.

Source

fn insert_channel( &self, channel: ChannelEntry, ) -> Result<Option<ChannelEntry>, Self::Error>

Inserts a ChannelEntry into the backend.

Returns the old value if one was present in the backend before.

Source

fn get_account_by_id( &self, id: &HoprKeyIdent, ) -> Result<Option<AccountEntry>, Self::Error>

Retrieves an AccountEntry by HoprKeyIdent.

Source

fn get_account_by_key( &self, key: &OffchainPublicKey, ) -> Result<Option<AccountEntry>, Self::Error>

Source

fn get_account_by_address( &self, chain_key: &Address, ) -> Result<Option<AccountEntry>, Self::Error>

Retrieves an AccountEntry by an on-chain Address.

Source

fn get_channel_by_id( &self, id: &ChannelId, ) -> Result<Option<ChannelEntry>, Self::Error>

Retrieves a ChannelEntry by its ChannelId.

Implementors§