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§
Required Methods§
Sourcefn insert_account(
&self,
entry: AccountEntry,
) -> Result<Option<AccountEntry>, Self::Error>
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.
Sourcefn insert_channel(
&self,
channel: ChannelEntry,
) -> Result<Option<ChannelEntry>, Self::Error>
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.
Sourcefn get_account_by_id(
&self,
id: &HoprKeyIdent,
) -> Result<Option<AccountEntry>, Self::Error>
fn get_account_by_id( &self, id: &HoprKeyIdent, ) -> Result<Option<AccountEntry>, Self::Error>
Retrieves an AccountEntry by HoprKeyIdent.
Sourcefn get_account_by_key(
&self,
key: &OffchainPublicKey,
) -> Result<Option<AccountEntry>, Self::Error>
fn get_account_by_key( &self, key: &OffchainPublicKey, ) -> Result<Option<AccountEntry>, Self::Error>
Retrieves an AccountEntry by OffchainPublicKey.
Sourcefn get_account_by_address(
&self,
chain_key: &Address,
) -> Result<Option<AccountEntry>, Self::Error>
fn get_account_by_address( &self, chain_key: &Address, ) -> Result<Option<AccountEntry>, Self::Error>
Retrieves an AccountEntry by an on-chain Address.
Sourcefn get_channel_by_id(
&self,
id: &ChannelId,
) -> Result<Option<ChannelEntry>, Self::Error>
fn get_channel_by_id( &self, id: &ChannelId, ) -> Result<Option<ChannelEntry>, Self::Error>
Retrieves a ChannelEntry by its ChannelId.