pub struct BandwidthController<C, St> { /* private fields */ }Implementations§
Source§impl<C, St: Storage> BandwidthController<C, St>
impl<C, St: Storage> BandwidthController<C, St>
pub fn new(storage: St, client: C) -> Self
Sourcepub async fn get_next_usable_ticketbook(
&self,
ticketbook_type: TicketType,
tickets: u32,
) -> Result<RetrievedTicketbook, BandwidthControllerError>
pub async fn get_next_usable_ticketbook( &self, ticketbook_type: TicketType, tickets: u32, ) -> Result<RetrievedTicketbook, BandwidthControllerError>
Tries to retrieve one of the stored, unused credentials for the given type that hasn’t yet expired.
pub async fn attempt_revert_ticket_usage( &self, info: PreparedCredentialMetadata, ) -> Result<bool, BandwidthControllerError>
pub async fn prepare_ecash_ticket( &self, ticketbook_type: TicketType, provider_pk: [u8; 32], tickets_to_spend: u32, ) -> Result<PreparedCredential, BandwidthControllerError>
pub async fn get_emergency_credential( &self, typ: &str, ) -> Result<Option<EmergencyCredential>, BandwidthControllerError>
Trait Implementations§
Source§impl<C, St> BandwidthTicketProvider for BandwidthController<C, St>where
C: DkgQueryClient + Sync + Send,
St: Storage,
<St as Storage>::StorageError: Send + Sync + 'static,
impl<C, St> BandwidthTicketProvider for BandwidthController<C, St>where
C: DkgQueryClient + Sync + Send,
St: Storage,
<St as Storage>::StorageError: Send + Sync + 'static,
fn get_ecash_ticket<'life0, 'async_trait>(
&'life0 self,
ticket_type: TicketType,
gateway_id: PublicKey,
tickets_to_spend: u32,
) -> Pin<Box<dyn Future<Output = Result<PreparedCredential, BandwidthControllerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_upgrade_mode_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, BandwidthControllerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<C, St> Clone for BandwidthController<C, St>
impl<C, St> Clone for BandwidthController<C, St>
Auto Trait Implementations§
impl<C, St> Freeze for BandwidthController<C, St>
impl<C, St> RefUnwindSafe for BandwidthController<C, St>where
St: RefUnwindSafe,
C: RefUnwindSafe,
impl<C, St> Send for BandwidthController<C, St>
impl<C, St> Sync for BandwidthController<C, St>
impl<C, St> Unpin for BandwidthController<C, St>
impl<C, St> UnwindSafe for BandwidthController<C, St>where
St: UnwindSafe,
C: UnwindSafe,
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,
Source§impl<T> Deprecatable for T
impl<T> Deprecatable for T
fn deprecate(self) -> Deprecated<Self>where
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> OptionalSet for T
impl<T> OptionalSet for T
Source§fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_validated_optional<F, T, V, E>(
self,
f: F,
value: Option<T>,
validate: V,
) -> Result<Self, E>
fn with_validated_optional<F, T, V, E>( self, f: F, value: Option<T>, validate: V, ) -> Result<Self, E>
If the value is available (i.e.
Some) it is validated and then the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the FromStr implementation and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.Source§fn with_optional_custom_env<F, T, G>(
self,
f: F,
val: Option<T>,
env_var: &str,
parser: G,
) -> Self
fn with_optional_custom_env<F, T, G>( self, f: F, val: Option<T>, env_var: &str, parser: G, ) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the provided parser and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.