Skip to main content

CovSubscriptionTable

Struct CovSubscriptionTable 

Source
pub struct CovSubscriptionTable { /* private fields */ }
Expand description

Table of active COV subscriptions.

Implementations§

Source§

impl CovSubscriptionTable

Source

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.

Source

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

Source

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

Source

pub fn new() -> Self

Create a new COV subscription table with default policy and counters.

Source

pub fn with_policy(policy: CovPolicy, counters: Arc<AtomicCovCounters>) -> Self

Create a new COV subscription table with a custom policy and counters.

Source

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.

Source

pub fn policy(&self) -> &CovPolicy

Get a reference to the active COV policy.

Source

pub fn counters(&self) -> &Arc<AtomicCovCounters> ⓘ

Get a reference to the atomic counters.

Source

pub fn in_flight_tracker(&self) -> &Arc<CovInFlightTracker> ⓘ

Get a reference to the in-flight confirmed notification tracker.

Source

pub fn peer_subscription_count(&self, peer: &CovRecipient) -> usize

Get the number of active subscriptions for a peer.

Source

pub fn peer_indefinite_count(&self, peer: &CovRecipient) -> usize

Get the number of active indefinite subscriptions for a peer.

Source

pub fn get_subscription( &self, key: &CovSubscriptionKey, ) -> Option<&CovSubscriptionSnapshot>

Get an accepted entry by its complete typed identity.

Source

pub fn contains(&self, key: &CovSubscriptionKey) -> bool

Whether an exact subscription identity is present.

Source

pub fn unsubscribe(&mut self, key: &CovSubscriptionKey) -> bool

Cancel only the exact family/form/property/index identity.

Source

pub fn unsubscribe_cov_multiple_context(&mut self, context: &MultipleContextKey)

Cancel every reference in the exact Multiple context.

Source

pub fn remove_for_object(&mut self, oid: ObjectIdentifier)

Remove all subscriptions for a given object (used on DeleteObject).

Source

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.

Source

pub fn purge_expired(&mut self) -> usize

Remove all expired subscriptions. Returns the number removed.

Source

pub fn subscriptions_for( &mut self, oid: &ObjectIdentifier, ) -> Vec<&CovSubscriptionSnapshot>

Get all active (non-expired) subscriptions for a given object.

Source

pub fn is_current(&self, snapshot: &CovSubscriptionSnapshot) -> bool

Whether a snapshot still owns a live entry in this table.

Source

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.

Source

pub fn len(&self) -> usize

Number of active subscriptions.

Source

pub fn is_empty(&self) -> bool

Whether the table is empty.

Trait Implementations§

Source§

impl Debug for CovSubscriptionTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CovSubscriptionTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more