Storage

Trait Storage 

Source
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§

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§