pub trait HoprDbProtocolOperations {
// Required methods
fn handle_acknowledgement<'life0, 'life1, 'async_trait>(
&'life0 self,
ack: Acknowledgement,
me: &'life1 ChainKeypair,
) -> Pin<Box<dyn Future<Output = Result<AckResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn to_send<'life0, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
path: Vec<OffchainPublicKey>,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn from_recv<'life0, 'life1, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Trait defining all DB functionality needed by packet/acknowledgement processing pipeline.
Required Methods§
Sourcefn handle_acknowledgement<'life0, 'life1, 'async_trait>(
&'life0 self,
ack: Acknowledgement,
me: &'life1 ChainKeypair,
) -> Pin<Box<dyn Future<Output = Result<AckResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_acknowledgement<'life0, 'life1, 'async_trait>(
&'life0 self,
ack: Acknowledgement,
me: &'life1 ChainKeypair,
) -> Pin<Box<dyn Future<Output = Result<AckResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Processes the acknowledgements for the pending tickets
There are three cases:
- There is an unacknowledged ticket and we are awaiting a half key.
- We were the creator of the packet, hence we do not wait for any half key
- The acknowledgement is unexpected and stems from a protocol bug or an attacker
Sourcefn to_send<'life0, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
path: Vec<OffchainPublicKey>,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn to_send<'life0, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
path: Vec<OffchainPublicKey>,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process the data into an outgoing packet
Sourcefn from_recv<'life0, 'life1, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn from_recv<'life0, 'life1, 'async_trait>(
&'life0 self,
data: Box<[u8]>,
me: ChainKeypair,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<TransportPacketWithChainData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Process the incoming packet into data