#[non_exhaustive]pub struct ManagedCOVSubscriptionOptions {
pub renewal_margin: Duration,
pub event_channel_capacity: usize,
pub renewal_gate: Option<Arc<Semaphore>>,
}Expand description
Options for a managed finite COV subscription.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.renewal_margin: DurationHow long before the known remaining lifetime the helper should renew.
The helper schedules renewal at time_remaining - renewal_margin, using
the requested lifetime until inbound notifications provide a fresher
time_remaining value.
event_channel_capacity: usizeCapacity of the renewal event broadcast channel.
Accepted range is 1..=MAX_COV_CHANNEL_CAPACITY.
renewal_gate: Option<Arc<Semaphore>>A semaphore each renewal takes one permit of before it is sent and
holds until its answer, its failure or ManagedCOVSubscription::stop
(#1791). An application that limits its own requests to a device
(one outstanding at a time, say) passes that limit here, so renewals
keep to it too. None (the default) sends renewals ungated.
The first request is not gated: it is sent from the caller’s context, which may already hold a permit for it. A closed semaphore stops gating.
A gated renewal goes only once the permit comes, so whatever holds
the gate delays it, by up to that request’s whole time with retries
on a device that stops answering. Size
renewal_margin to cover that wait as well as
the renewal’s own request, or the subscription can lapse first.
Implementations§
Source§impl ManagedCOVSubscriptionOptions
impl ManagedCOVSubscriptionOptions
Sourcepub fn with_renewal_margin(self, margin: Duration) -> Self
pub fn with_renewal_margin(self, margin: Duration) -> Self
Set the renewal margin.
Sourcepub fn with_event_channel_capacity(self, capacity: usize) -> Self
pub fn with_event_channel_capacity(self, capacity: usize) -> Self
Set the renewal event broadcast channel capacity.
Sourcepub fn with_renewal_gate(self, gate: Arc<Semaphore>) -> Self
pub fn with_renewal_gate(self, gate: Arc<Semaphore>) -> Self
Gate every renewal on a permit of gate (see
renewal_gate).