pub trait HoprDbProtocolOperations {
type Error: Error + Send + Sync + 'static;
// Required methods
fn handle_acknowledgement<'life0, 'life1, 'async_trait, R>(
&'life0 self,
ack: VerifiedAcknowledgement,
chain_resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait;
fn find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Result<FoundSurb, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_surb_config(&self) -> SurbCacheConfig;
fn to_send_no_ack<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
destination: OffchainPublicKey,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
R: ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait;
fn to_send<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
routing: ResolvedTransportRouting,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
signals: FlagSet<PacketSignal>,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait;
fn from_recv<'life0, 'life1, 'life2, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
resolver: &'life2 R,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait;
}
Expand description
Trait defining all DB functionality needed by a packet/acknowledgement processing pipeline.
Required Associated Types§
Required Methods§
Sourcefn handle_acknowledgement<'life0, 'life1, 'async_trait, R>(
&'life0 self,
ack: VerifiedAcknowledgement,
chain_resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
fn handle_acknowledgement<'life0, 'life1, 'async_trait, R>(
&'life0 self,
ack: VerifiedAcknowledgement,
chain_resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainValues + Send + Sync + 'async_trait,
Self: '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 find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Result<FoundSurb, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Result<FoundSurb, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Attempts to find SURB and its ID given the SurbMatcher
.
Sourcefn get_surb_config(&self) -> SurbCacheConfig
fn get_surb_config(&self) -> SurbCacheConfig
Returns the SURB cache configuration.
Sourcefn to_send_no_ack<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
destination: OffchainPublicKey,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
fn to_send_no_ack<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
destination: OffchainPublicKey,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
Process the data into an outgoing packet that is not going to be acknowledged.
Sourcefn to_send<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
routing: ResolvedTransportRouting,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
signals: FlagSet<PacketSignal>,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
fn to_send<'life0, 'life1, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
routing: ResolvedTransportRouting,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
signals: FlagSet<PacketSignal>,
resolver: &'life1 R,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
Process the data into an outgoing packet
Sourcefn from_recv<'life0, 'life1, 'life2, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
resolver: &'life2 R,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
fn from_recv<'life0, 'life1, 'life2, 'async_trait, R>(
&'life0 self,
data: Box<[u8]>,
pkt_keypair: &'life1 OffchainKeypair,
sender: OffchainPublicKey,
outgoing_ticket_win_prob: Option<WinningProbability>,
outgoing_ticket_price: Option<Balance<WxHOPR>>,
resolver: &'life2 R,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
R: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync + 'async_trait,
Self: 'async_trait,
Process the incoming packet into data
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.