pub trait Storage {
Show 16 methods
// Required methods
fn get_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<Option<Contract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 OfferedContract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 Contract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_contract_offers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedContract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_signed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_confirmed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_preclosed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PreClosedContract>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn upsert_channel<'life0, 'async_trait>(
&'life0 self,
channel: Channel,
contract: Option<Contract>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<Option<Channel>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_signed_channels<'life0, 'async_trait>(
&'life0 self,
channel_state: Option<SignedChannelStateType>,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedChannel>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_offered_channels<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedChannel>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn persist_chain_monitor<'life0, 'life1, 'async_trait>(
&'life0 self,
monitor: &'life1 ChainMonitor,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_chain_monitor<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainMonitor>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Storage trait provides functionalities to store and retrieve DLCs.
Required Methods§
Sourcefn get_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<Option<Contract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<Option<Contract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the contract with given id if found.
Sourcefn get_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return all contracts
Sourcefn create_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 OfferedContract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 OfferedContract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a record for the given contract.
Sourcefn delete_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ContractId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete the record for the contract with the given id.
Sourcefn update_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 Contract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
contract: &'life1 Contract,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update the given contract.
Sourcefn get_contract_offers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_contract_offers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of contracts in offered state.
Sourcefn get_signed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_signed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of contracts in signed state.
Sourcefn get_confirmed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_confirmed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of confirmed contracts.
Sourcefn get_preclosed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PreClosedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_preclosed_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PreClosedContract>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of contracts whos broadcasted cet has not been verified to be confirmed on blockchain
Sourcefn upsert_channel<'life0, 'async_trait>(
&'life0 self,
channel: Channel,
contract: Option<Contract>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert_channel<'life0, 'async_trait>(
&'life0 self,
channel: Channel,
contract: Option<Contract>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the state of the channel and optionally its associated contract atomically.
Sourcefn delete_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete the channel with given ChannelId
if any.
Sourcefn get_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<Option<Channel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
) -> Pin<Box<dyn Future<Output = Result<Option<Channel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the channel with given ChannelId
if any.
Sourcefn get_signed_channels<'life0, 'async_trait>(
&'life0 self,
channel_state: Option<SignedChannelStateType>,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedChannel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_signed_channels<'life0, 'async_trait>(
&'life0 self,
channel_state: Option<SignedChannelStateType>,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedChannel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of SignedChannel
in the store. Returns only the one
with matching channel_state
if set.
Sourcefn get_offered_channels<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedChannel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_offered_channels<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OfferedChannel>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of channels in offer state.
Sourcefn persist_chain_monitor<'life0, 'life1, 'async_trait>(
&'life0 self,
monitor: &'life1 ChainMonitor,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn persist_chain_monitor<'life0, 'life1, 'async_trait>(
&'life0 self,
monitor: &'life1 ChainMonitor,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the ChainMonitor
data to the store.
Sourcefn get_chain_monitor<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainMonitor>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_chain_monitor<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainMonitor>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the latest ChainMonitor
in the store if any.