pub struct CovSubscriptionTable { /* private fields */ }Expand description
Table of active COV subscriptions.
Implementations§
Source§impl CovSubscriptionTable
impl CovSubscriptionTable
Sourcepub fn subscribe(
&mut self,
sub: CovSubscription,
) -> Result<CovSubscriptionSnapshot, Error>
pub fn subscribe( &mut self, sub: CovSubscription, ) -> Result<CovSubscriptionSnapshot, Error>
Accept an ordinary or Single insertion or renewal after quota and
generation preflight. Multiple references are rejected before any table
effect: they enter only through subscribe_multiple,
which owns their shared context lifetime and maximum notification delay.
Sourcepub fn subscribe_multiple(
&mut self,
context: &MultipleContextKey,
route: &SubscriberEndpoint,
expires_at: Instant,
max_notification_delay: u32,
subscriber_max_apdu: Option<u16>,
subscriptions: Vec<CovSubscription>,
) -> Result<Vec<CovSubscriptionSnapshot>, MultipleRefusal>
pub fn subscribe_multiple( &mut self, context: &MultipleContextKey, route: &SubscriberEndpoint, expires_at: Instant, max_notification_delay: u32, subscriber_max_apdu: Option<u16>, subscriptions: Vec<CovSubscription>, ) -> Result<Vec<CovSubscriptionSnapshot>, MultipleRefusal>
Accept Multiple references in request order and refresh their exact
context. All identities/options are validated before quota/generation
reservation or refresh. Each proposal that would add a subscription is
then checked against the recipient’s quota and the table’s capacity in
turn (a renewal, or a repeat of an earlier proposal, adds none), and
the first that does not fit ends the request (Clause 13.16.2, #1059).
The proposals before it are kept as if they had been the whole request
and come back in a MultipleRefusal naming its position; when it is
the first proposal, or the request fails as a whole (identity or route
mismatch, generation exhaustion), nothing changes (#1058). Final
duplicates among the kept proposals win, once each.
The request’s expiry, maximum notification delay and the maximum APDU
its subscriber advertised become the whole context’s (last write wins;
a None maximum APDU, unknown, keeps the one advertised before). The
delay bounds how long the context’s
timestamped changes may stay queued after a notification failed or was
held back; notifications fit the smaller of the subscriber’s maximum
APDU and the local one.
The admitted route also replaces the route of every retained reference,
including empty renewals. A changed route fences old snapshots while
preserving unreplaced observations; same-route refresh retains authority,
unless it lists references while the context’s confirmed report is
outstanding or holding off, which fences it the same way (#896). A fence
while that report is outstanding, holding off or owed also clears the
observations of the kept untimestamped references it carried, since the
fenced report may have reached the subscriber (#923).
Source§impl CovSubscriptionTable
impl CovSubscriptionTable
Sourcepub fn remaining_lifetime(
&self,
snapshot: &CovSubscriptionSnapshot,
now: Instant,
) -> Option<CovTimeRemaining>
pub fn remaining_lifetime( &self, snapshot: &CovSubscriptionSnapshot, now: Instant, ) -> Option<CovTimeRemaining>
Resolve captured owner/key/generation/route authority against live expiry. An expiry-only Multiple context refresh does not replace the generation.
Source§impl CovSubscriptionTable
impl CovSubscriptionTable
Sourcepub fn with_policy(policy: CovPolicy, counters: Arc<AtomicCovCounters>) -> Self
pub fn with_policy(policy: CovPolicy, counters: Arc<AtomicCovCounters>) -> Self
Create a new COV subscription table with a custom policy and counters.
Sourcepub fn with_max_apdu_length(self, max_apdu_length: usize) -> Self
pub fn with_max_apdu_length(self, max_apdu_length: usize) -> Self
Bound each Multiple context’s pending timestamped changes by what one notification of this maximum APDU length can carry.
Sourcepub fn counters(&self) -> &Arc<AtomicCovCounters> ⓘ
pub fn counters(&self) -> &Arc<AtomicCovCounters> ⓘ
Get a reference to the atomic counters.
Sourcepub fn in_flight_tracker(&self) -> &Arc<CovInFlightTracker> ⓘ
pub fn in_flight_tracker(&self) -> &Arc<CovInFlightTracker> ⓘ
Get a reference to the in-flight confirmed notification tracker.
Sourcepub fn peer_subscription_count(&self, peer: &CovRecipient) -> usize
pub fn peer_subscription_count(&self, peer: &CovRecipient) -> usize
Get the number of active subscriptions for a peer.
Sourcepub fn peer_indefinite_count(&self, peer: &CovRecipient) -> usize
pub fn peer_indefinite_count(&self, peer: &CovRecipient) -> usize
Get the number of active indefinite subscriptions for a peer.
Sourcepub fn get_subscription(
&self,
key: &CovSubscriptionKey,
) -> Option<&CovSubscriptionSnapshot>
pub fn get_subscription( &self, key: &CovSubscriptionKey, ) -> Option<&CovSubscriptionSnapshot>
Get an accepted entry by its complete typed identity.
Sourcepub fn contains(&self, key: &CovSubscriptionKey) -> bool
pub fn contains(&self, key: &CovSubscriptionKey) -> bool
Whether an exact subscription identity is present.
Sourcepub fn unsubscribe(&mut self, key: &CovSubscriptionKey) -> bool
pub fn unsubscribe(&mut self, key: &CovSubscriptionKey) -> bool
Cancel only the exact family/form/property/index identity.
Sourcepub fn unsubscribe_cov_multiple_context(&mut self, context: &MultipleContextKey)
pub fn unsubscribe_cov_multiple_context(&mut self, context: &MultipleContextKey)
Cancel every reference in the exact Multiple context.
Sourcepub fn remove_for_object(&mut self, oid: ObjectIdentifier)
pub fn remove_for_object(&mut self, oid: ObjectIdentifier)
Remove all subscriptions for a given object (used on DeleteObject).
Sourcepub fn remove_peer_subscriptions(
&mut self,
mac: &[u8],
network: Option<&NpduAddress>,
) -> usize
pub fn remove_peer_subscriptions( &mut self, mac: &[u8], network: Option<&NpduAddress>, ) -> usize
Remove subscriptions using this current route and release shared peer quotas. An obsolete router cannot remove a subscription migrated elsewhere.
Sourcepub fn purge_expired(&mut self) -> usize
pub fn purge_expired(&mut self) -> usize
Remove all expired subscriptions. Returns the number removed.
Sourcepub fn subscriptions_for(
&mut self,
oid: &ObjectIdentifier,
) -> Vec<&CovSubscriptionSnapshot>
pub fn subscriptions_for( &mut self, oid: &ObjectIdentifier, ) -> Vec<&CovSubscriptionSnapshot>
Get all active (non-expired) subscriptions for a given object.
Sourcepub fn is_current(&self, snapshot: &CovSubscriptionSnapshot) -> bool
pub fn is_current(&self, snapshot: &CovSubscriptionSnapshot) -> bool
Whether a snapshot still owns a live entry in this table.
Sourcepub fn should_notify(
sub: &CovSubscription,
current_value: Option<&CovSample>,
cov_increment: Option<f64>,
) -> bool
pub fn should_notify( sub: &CovSubscription, current_value: Option<&CovSample>, cov_increment: Option<f64>, ) -> bool
Ordinary whole-object trigger policy: a numeric Present_Value must move by the increment, any other value must change, and the first report always fires. Status_Flags and other Table 13-1 trigger values (such as Staging’s Present_Stage) are checked separately by the caller. An unchanged object therefore reports nothing, however often it is fanned out. Property subscriptions compare their prepared sample instead.