pub trait HoprDbChannelOperations {
// Required methods
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;
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;
fn finish_channel_update<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
editor: ChannelEditor,
) -> Pin<Box<dyn Future<Output = Result<Option<ChannelEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
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;
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;
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;
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;
fn stream_channels<'a, 'life0, 'async_trait, T>(
&'a self,
source: Option<Address>,
destination: Option<Address>,
states: &'life0 [ChannelStatusDiscriminants],
closure_range: T,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, ChannelEntry>>> + Send + 'async_trait>>
where T: 'async_trait + RangeBounds<DateTime<Utc>> + Send,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait;
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;
}
Expand description
Defines DB API for accessing information about HOPR payment channels.
Required Methods§
Sourcefn 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,
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.
See generate_channel_id on how to generate a channel ID hash from source and destination Addresses.
Sourcefn 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,
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.
Sourcefn finish_channel_update<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
editor: ChannelEditor,
) -> Pin<Box<dyn Future<Output = Result<Option<ChannelEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn finish_channel_update<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
editor: ChannelEditor,
) -> Pin<Box<dyn Future<Output = Result<Option<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.
Sourcefn 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,
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.
Sourcefn 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,
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)
Sourcefn 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,
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)
Sourcefn 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,
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 channels information from the DB.
fn stream_channels<'a, 'life0, 'async_trait, T>(
&'a self,
source: Option<Address>,
destination: Option<Address>,
states: &'life0 [ChannelStatusDiscriminants],
closure_range: T,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, ChannelEntry>>> + Send + 'async_trait>>where
T: 'async_trait + RangeBounds<DateTime<Utc>> + Send,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Sourcefn 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,
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.
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.