InMemoryNodeManager

Struct InMemoryNodeManager 

Source
pub struct InMemoryNodeManager<TImpl> { /* private fields */ }
Expand description

A node manager that stores its nodes in an in-memory AddressSpace. This only supports a static list of namespaces, and a attributes stored in memory.

Implementations of custom behavior are provided with a type implementing InMemoryNodeManagerImpl.

Implementations§

Source§

impl<TImpl: InMemoryNodeManagerImpl> InMemoryNodeManager<TImpl>

Source

pub fn inner(&self) -> &TImpl

Return the inner InMemoryNodeManagerImpl.

Source

pub fn address_space(&self) -> &Arc<RwLock<AddressSpace>>

Get the address space.

Source

pub fn namespaces(&self) -> &HashMap<u16, String>

Get a reference to the namespaces managed by this node manager, by namespace index.

Source

pub fn set_attributes<'a>( &self, subscriptions: &SubscriptionCache, values: impl Iterator<Item = (&'a NodeId, AttributeId, Variant)>, ) -> Result<(), StatusCode>

Set the attributes given in values and notify any subscriptions about the changes.

To set values, use InMemoryNodeManager::set_values.

Source

pub fn set_attribute( &self, subscriptions: &SubscriptionCache, id: &NodeId, attribute_id: AttributeId, value: Variant, ) -> Result<(), StatusCode>

Set the attribute given by attribute_id on the node with ID id to value.

Source

pub fn set_values<'a>( &self, subscriptions: &SubscriptionCache, values: impl Iterator<Item = (&'a NodeId, Option<&'a NumericRange>, DataValue)>, ) -> Result<(), StatusCode>

Set variable values with updates given by values, notifying any subscriptions of the changes.

Source

pub fn set_value( &self, subscriptions: &SubscriptionCache, id: &NodeId, index_range: Option<&NumericRange>, value: DataValue, ) -> Result<(), StatusCode>

Set the variable value to value, using index_range, on the node with ID id.

Trait Implementations§

Source§

impl<TImpl: InMemoryNodeManagerImpl> NodeManager for InMemoryNodeManager<TImpl>

Source§

fn add_nodes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes_to_add: &'life2 mut [&'life3 mut AddNodeItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a list of nodes.

This should create the nodes, or set a failed status as appropriate. If a node was created, the status should be set to Good.

Source§

fn owns_node(&self, id: &NodeId) -> bool

Return whether this node manager owns the given node, this is used for propagating service-level errors. Read more
Source§

fn name(&self) -> &str

Name of this node manager, for debug purposes.
Source§

fn init<'life0, 'life1, 'async_trait>( &'life0 self, type_tree: &'life1 mut DefaultTypeTree, context: ServerContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform any necessary loading of nodes, should populate the type tree if needed.
Source§

fn namespaces_for_user( &self, _context: &RequestContext, ) -> Vec<NamespaceMetadata>

Namespaces for a given user, used to populate the namespace array. This being a method allows different users to see different namespaces.
Source§

fn handle_new_node(&self, parent_id: &ExpandedNodeId) -> bool

Return whether this node should handle requests to create a node for the given parent ID. This is only called if no new node ID is requested, otherwise owns_node is called on the requested node ID. Read more
Source§

fn resolve_external_references<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, items: &'life2 mut [&'life3 mut ExternalReferenceRequest], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Resolve a list of references given by a different node manager.
Source§

fn browse<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes_to_browse: &'life2 mut [BrowseNode], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Perform the Browse or BrowseNext service.
Source§

fn read<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, max_age: f64, timestamps_to_return: TimestampsToReturn, nodes_to_read: &'life2 mut [&'life3 mut ReadNode], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute the Read service. This should set results on the given nodes_to_read as needed.
Source§

fn translate_browse_paths_to_node_ids<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes: &'life2 mut [&'life3 mut BrowsePathItem<'_>], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform the translate browse paths to node IDs service.
Source§

fn register_nodes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes: &'life2 mut [&'life3 mut RegisterNodeItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform the register nodes service. The default behavior for this service is to do nothing and pretend the nodes were registered.
Source§

fn unregister_nodes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes: &'life2 [&'life3 NodeId], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform the unregister nodes service. The default behavior for this service is to do nothing.
Source§

fn create_monitored_items<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, items: &'life2 mut [&'life3 mut CreateMonitoredItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Prepare for monitored item creation, the node manager must take action to sample data for each produced monitored item, according to the parameters. Monitored item parameters have already been revised according to server limits, but the node manager is allowed to further revise sampling interval. Read more
Source§

fn modify_monitored_items<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, items: &'life2 [&'life3 MonitoredItemUpdateRef], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Modify monitored items. This method is purely informative for the node manager, to let it modify sampling intervals, apply a new filter, or similar. Read more
Source§

fn set_monitoring_mode<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, mode: MonitoringMode, items: &'life2 [&'life3 MonitoredItemRef], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Modify monitored items. This method is purely informative for the node manager, to let it pause or resume sampling. Note that this should not delete context stored from create_monitored_items, since it may be called again to resume sampling. Read more
Source§

fn delete_monitored_items<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, items: &'life2 [&'life3 MonitoredItemRef], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Delete monitored items. This method is purely informative for the node manager, to let it stop sampling, or similar. Read more
Source§

fn history_read_raw_modified<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, context: &'life1 RequestContext, details: &'life2 ReadRawModifiedDetails, nodes: &'life3 mut [&'life4 mut HistoryNode], timestamps_to_return: TimestampsToReturn, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Perform the history read raw modified service. This should write results to the nodes list of type either HistoryData or HistoryModifiedData
Source§

fn history_read_processed<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, context: &'life1 RequestContext, details: &'life2 ReadProcessedDetails, nodes: &'life3 mut [&'life4 mut HistoryNode], timestamps_to_return: TimestampsToReturn, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Perform the history read processed service. This should write results to the nodes list of type HistoryData.
Source§

fn history_read_at_time<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, context: &'life1 RequestContext, details: &'life2 ReadAtTimeDetails, nodes: &'life3 mut [&'life4 mut HistoryNode], timestamps_to_return: TimestampsToReturn, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Perform the history read processed service. This should write results to the nodes list of type HistoryData.
Source§

fn history_read_events<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, context: &'life1 RequestContext, details: &'life2 ReadEventDetails, nodes: &'life3 mut [&'life4 mut HistoryNode], timestamps_to_return: TimestampsToReturn, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Perform the history read events service. This should write results to the nodes list of type HistoryEvent.
Source§

fn history_read_annotations<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, context: &'life1 RequestContext, details: &'life2 ReadAnnotationDataDetails, nodes: &'life3 mut [&'life4 mut HistoryNode], timestamps_to_return: TimestampsToReturn, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Perform the history read annotations data service. This should write results to the nodes list of type Annotation.
Source§

fn write<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes_to_write: &'life2 mut [&'life3 mut WriteNode], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform the write service. This should write results to the nodes_to_write list. The default result is BadNodeIdUnknown
Source§

fn history_update<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes: &'life2 mut [&'life3 mut HistoryUpdateNode], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform the HistoryUpdate service. This should write result status codes to the nodes list as appropriate.
Source§

fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, methods_to_call: &'life2 mut [&'life3 mut MethodCall], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Call a list of methods. Read more
Source§

fn add_references<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, references_to_add: &'life2 mut [&'life3 mut AddReferenceItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a list of references. Read more
Source§

fn delete_nodes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, nodes_to_delete: &'life2 mut [&'life3 mut DeleteNodeItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Delete a list of nodes. Read more
Source§

fn delete_node_references<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, to_delete: &'life2 [&'life3 DeleteNodeItem], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Delete references for the given list of nodes. The node manager should respect delete_target_references. Read more
Source§

fn delete_references<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, references_to_delete: &'life2 mut [&'life3 mut DeleteReferenceItem], ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Delete a list of references. Read more
Source§

fn owns_server_events(&self) -> bool

Return whether this node manager owns events on the server. The first node manager that returns true here will be called when reading or updating historical server events.
Source§

fn query<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, request: &'life2 mut QueryRequest, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Perform a query on the address space. Read more

Auto Trait Implementations§

§

impl<TImpl> Freeze for InMemoryNodeManager<TImpl>
where TImpl: Freeze,

§

impl<TImpl> !RefUnwindSafe for InMemoryNodeManager<TImpl>

§

impl<TImpl> Send for InMemoryNodeManager<TImpl>
where TImpl: Send,

§

impl<TImpl> Sync for InMemoryNodeManager<TImpl>
where TImpl: Sync,

§

impl<TImpl> Unpin for InMemoryNodeManager<TImpl>
where TImpl: Unpin,

§

impl<TImpl> !UnwindSafe for InMemoryNodeManager<TImpl>

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<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<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> 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> IntoAnyArc for T
where T: Send + Sync + 'static,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Upcast to Arc<dyn Any>.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
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