pub trait SurbStore {
// Required methods
fn find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Option<FoundSurb>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert_surbs<'life0, 'async_trait>(
&'life0 self,
pseudonym: HoprPseudonym,
surbs: Vec<(HoprSurbId, HoprSurb)>,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert_reply_opener(&self, sender_id: HoprSenderId, opener: ReplyOpener);
fn find_reply_opener(&self, sender_id: &HoprSenderId) -> Option<ReplyOpener>;
}Expand description
A trait defining the operations required to store and retrieve SURBs (Single Use Reply Blocks) and their reply openers.
The sending side stores the reply openers, whereas the SURBs are stored by the replying side of the communication.
Required Methods§
Sourcefn find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Option<FoundSurb>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_surb<'life0, 'async_trait>(
&'life0 self,
matcher: SurbMatcher,
) -> Pin<Box<dyn Future<Output = Option<FoundSurb>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Tries to find SURB using the given matcher.
This is used by the replying side when it is about to send a reply packet back to the sender.
Sourcefn insert_surbs<'life0, 'async_trait>(
&'life0 self,
pseudonym: HoprPseudonym,
surbs: Vec<(HoprSurbId, HoprSurb)>,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert_surbs<'life0, 'async_trait>(
&'life0 self,
pseudonym: HoprPseudonym,
surbs: Vec<(HoprSurbId, HoprSurb)>,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores the surbs and associates them with the given pseudonym.
This is used by the replying side when it receives packets containing SURBs from the sender
with the given pseudonym.
Returns the total number of SURBs available for that pseudonym, including the newly inserted
ones.
Sourcefn insert_reply_opener(&self, sender_id: HoprSenderId, opener: ReplyOpener)
fn insert_reply_opener(&self, sender_id: HoprSenderId, opener: ReplyOpener)
Sourcefn find_reply_opener(&self, sender_id: &HoprSenderId) -> Option<ReplyOpener>
fn find_reply_opener(&self, sender_id: &HoprSenderId) -> Option<ReplyOpener>
Tries to find a ReplyOpener given the sender_id.
This is done by the sending side of the original packet when the reply to that packet is received and needs to be decrypted.
The operation should happen reasonably fast, as it is called from the packet processing code.