pub trait ChainWriteTicketOperations {
type Error: Error + Send + Sync + 'static;
// Required method
fn redeem_ticket<'a, 'async_trait>(
&'a self,
ticket: RedeemableTicket,
) -> Pin<Box<dyn Future<Output = Result<BoxFuture<'a, Result<(VerifiedTicket, ChainReceipt), TicketRedeemError<Self::Error>>>, TicketRedeemError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
// Provided method
fn redeem_tickets_via_selectors<'life0, 'life1, 'async_trait, Db, S, I>(
&'life0 self,
db: &'life1 Db,
selectors: I,
) -> Pin<Box<dyn Future<Output = Result<BatchRedemptionResult<Self::Error>, Db::Error>> + Send + 'async_trait>>
where Db: HoprDbTicketOperations + Sync + 'async_trait,
I: IntoIterator<Item = S> + Send + 'async_trait,
S: Into<TicketSelector> + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
On-chain write operations with tickets.
Required Associated Types§
Required Methods§
Sourcefn redeem_ticket<'a, 'async_trait>(
&'a self,
ticket: RedeemableTicket,
) -> Pin<Box<dyn Future<Output = Result<BoxFuture<'a, Result<(VerifiedTicket, ChainReceipt), TicketRedeemError<Self::Error>>>, TicketRedeemError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn redeem_ticket<'a, 'async_trait>(
&'a self,
ticket: RedeemableTicket,
) -> Pin<Box<dyn Future<Output = Result<BoxFuture<'a, Result<(VerifiedTicket, ChainReceipt), TicketRedeemError<Self::Error>>>, TicketRedeemError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Redeems a single ticket on-chain.
The input ticket is always returned as VerifiedTicket, either on success or failure.
Provided Methods§
Sourcefn redeem_tickets_via_selectors<'life0, 'life1, 'async_trait, Db, S, I>(
&'life0 self,
db: &'life1 Db,
selectors: I,
) -> Pin<Box<dyn Future<Output = Result<BatchRedemptionResult<Self::Error>, Db::Error>> + Send + 'async_trait>>where
Db: HoprDbTicketOperations + Sync + 'async_trait,
I: IntoIterator<Item = S> + Send + 'async_trait,
S: Into<TicketSelector> + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn redeem_tickets_via_selectors<'life0, 'life1, 'async_trait, Db, S, I>(
&'life0 self,
db: &'life1 Db,
selectors: I,
) -> Pin<Box<dyn Future<Output = Result<BatchRedemptionResult<Self::Error>, Db::Error>> + Send + 'async_trait>>where
Db: HoprDbTicketOperations + Sync + 'async_trait,
I: IntoIterator<Item = S> + Send + 'async_trait,
S: Into<TicketSelector> + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches a batch of tickets via selector to HoprDbTicketOperations
and performs batched ticket redemption.
The function takes care of properly marking the tickets in the DB as being redeemed and also properly unmarking or removing them on redemption success or failure.
The method waits until all matched tickets are either redeemed or fail to redeem,
reporting the results in the BatchRedemptionResult object.
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.