Module browser

Source
Expand description

This module contains a utility for recursively browsing the node hierarchy in a flexible, efficient, and reliable manner.

§Notes on usage.

The browser does not spawn any internal tasks or threads, instead it is all driven by a Stream, that needs to be consumed for the browser to make progress.

The browser is generic over two parameters:

The first is a BrowserPolicy, which dictates the recursive behavior of the browser. It accepts a result, and returns a set of nodes to browse. For simple usage, it is implemented for BrowseFilter, which just creates a new BrowseDescription for each returned reference.

Note that the browser will only ever browse a node in a given direction (forward or inverse) once, so if you return the same BrowseDescription multiple times, even with different filters, it will be ignored.

The second parameter is a RequestRetryPolicy, this dictates how requests should be retried. It defaults to an instance of crate::DefaultRetryPolicy with reasonable defaults.

§Cancellation

You can just stop listening to the stream. The pending requests will still complete, but the browser will not send any more without anyone polling the stream. The problem with this is that browsing in OPC-UA produces ContinuationPoints on the server that need to be freed.

If you instead set a CancellationToken when creating the browser, cancel it, then wait for the stream to terminate, the browser will attempt to clean up any pending continuation points after all requests finish.

It will also attempt to do this on an error, but without retries.

If you are closing the session anyway, continuation points are probable freed by the server then, so you can ignore this and just drop the stream.

Structs§

BrowseFilter
Simple filter for the Browser. All discovered nodes will be recursively browsed using the stored configuration.
BrowseResultItem
Result of a browse iteration.
Browser
A utility for recursively discovering nodes on an OPC-UA server.
BrowserConfig
Configuration for the browser
BrowserResult
Collected result of a browse operation.
NodeDescription
Simple description of a node discovered when browsing.
NoneBrowserPolicy
Browse policy that browses nothing except the root nodes.

Traits§

BrowserPolicy
Trait for deciding which nodes to browse next in a recursive browse.