pub struct SubscriptionCache { /* private fields */ }
Expand description
Structure storing all subscriptions and monitored items on the server. Used to notify users of changes.
Subscriptions can outlive sessions, and sessions can outlive connections, so neither can be owned by the connection. This provides convenient methods for manipulating subscriptions.
Implementations§
Source§impl SubscriptionCache
impl SubscriptionCache
Sourcepub fn get_session_subscriptions(
&self,
session_id: u32,
) -> Option<Arc<Mutex<SessionSubscriptions>>>
pub fn get_session_subscriptions( &self, session_id: u32, ) -> Option<Arc<Mutex<SessionSubscriptions>>>
Get the SessionSubscriptions
object for a single session by its numeric ID.
Sourcepub fn notify_data_change<'a>(
&self,
items: impl Iterator<Item = (DataValue, &'a NodeId, AttributeId)>,
)
pub fn notify_data_change<'a>( &self, items: impl Iterator<Item = (DataValue, &'a NodeId, AttributeId)>, )
Notify any listening clients about a list of data changes. This can be called any time anything changes on the server, or only for values with an existing monitored item. Either way this method will deal with distributing the values to the appropriate monitored items.
Sourcepub fn maybe_notify<'a>(
&self,
items: impl Iterator<Item = (&'a NodeId, AttributeId)>,
sample: impl Fn(&NodeId, AttributeId, &NumericRange, &DataEncoding) -> Option<DataValue>,
)
pub fn maybe_notify<'a>( &self, items: impl Iterator<Item = (&'a NodeId, AttributeId)>, sample: impl Fn(&NodeId, AttributeId, &NumericRange, &DataEncoding) -> Option<DataValue>, )
Notify with a dynamic sampler, to avoid getting values for nodes that may not have monitored items. This is potentially much more efficient than simply notifying blindly, but is also somewhat harder to use.
Sourcepub fn notify_events<'a>(
&self,
items: impl Iterator<Item = (&'a dyn Event, &'a NodeId)>,
)
pub fn notify_events<'a>( &self, items: impl Iterator<Item = (&'a dyn Event, &'a NodeId)>, )
Notify listening clients to events. Without a custom node manager implementing event history, this is the only way to report events in the server.