pub struct HoprTicketProcessor<Chain, Db> { /* private fields */ }Expand description
HOPR-specific implementation of UnacknowledgedTicketProcessor and TicketTracker.
Implementations§
Source§impl<Chain, Db> HoprTicketProcessor<Chain, Db>
impl<Chain, Db> HoprTicketProcessor<Chain, Db>
Sourcepub fn new(
chain_api: Chain,
db: Db,
chain_key: ChainKeypair,
channels_dst: Hash,
cfg: HoprTicketProcessorConfig,
) -> Self
pub fn new( chain_api: Chain, db: Db, chain_key: ChainKeypair, channels_dst: Hash, cfg: HoprTicketProcessorConfig, ) -> Self
Creates a new instance of the HOPR ticket processor.
Source§impl<Chain, Db> HoprTicketProcessor<Chain, Db>
impl<Chain, Db> HoprTicketProcessor<Chain, Db>
Sourcepub fn outgoing_index_sync_task(
&self,
reg: AbortRegistration,
) -> impl Future<Output = ()> + use<Db, Chain>
pub fn outgoing_index_sync_task( &self, reg: AbortRegistration, ) -> impl Future<Output = ()> + use<Db, Chain>
Task that performs periodic synchronization of the outgoing ticket index cache to the underlying database.
If this task is not started, the outgoing ticket indices will not survive a node restart and will result in invalid tickets received by the counterparty.
Trait Implementations§
Source§impl<Chain: Clone, Db: Clone> Clone for HoprTicketProcessor<Chain, Db>
impl<Chain: Clone, Db: Clone> Clone for HoprTicketProcessor<Chain, Db>
Source§fn clone(&self) -> HoprTicketProcessor<Chain, Db>
fn clone(&self) -> HoprTicketProcessor<Chain, Db>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Chain, Db> TicketTracker for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> TicketTracker for HoprTicketProcessor<Chain, Db>
type Error = Arc<<Db as HoprDbTicketOperations>::Error>
Source§fn next_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn next_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets the next ticket index for an outgoing ticket for the given channel.
Source§fn incoming_channel_unrealized_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn incoming_channel_unrealized_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the unrealized balance of the given channel. Read more
Source§fn create_multihop_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelEntry,
current_path_pos: u8,
winning_prob: WinningProbability,
ticket_price: HoprBalance,
) -> Pin<Box<dyn Future<Output = Result<TicketBuilder, TicketCreationError<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_multihop_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelEntry,
current_path_pos: u8,
winning_prob: WinningProbability,
ticket_price: HoprBalance,
) -> Pin<Box<dyn Future<Output = Result<TicketBuilder, TicketCreationError<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Convenience function that allows creating multi-hop tickets.
Source§impl<Chain, Db> UnacknowledgedTicketProcessor for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> UnacknowledgedTicketProcessor for HoprTicketProcessor<Chain, Db>
type Error = HoprProtocolError
Source§fn insert_unacknowledged_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
next_hop: &'life1 OffchainPublicKey,
challenge: HalfKeyChallenge,
ticket: UnacknowledgedTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn insert_unacknowledged_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
next_hop: &'life1 OffchainPublicKey,
challenge: HalfKeyChallenge,
ticket: UnacknowledgedTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts a verified unacknowledged ticket from a delivered packet into the internal storage. Read more
Source§fn acknowledge_ticket<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
ack: Acknowledgement,
) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedAcknowledgement>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acknowledge_ticket<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
ack: Acknowledgement,
) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedAcknowledgement>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finds and acknowledges previously inserted ticket, using an
Acknowledgement from the
upstream peer. Read moreAuto Trait Implementations§
impl<Chain, Db> Freeze for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> !RefUnwindSafe for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> Send for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> Sync for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> Unpin for HoprTicketProcessor<Chain, Db>
impl<Chain, Db> !UnwindSafe for HoprTicketProcessor<Chain, Db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more