NodeBrowser
Browses the server database.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Creates a new node browser. |
Member Summary
Public Members | ||
public |
|
|
public |
A map that maps node ids against their discovered hierarchical parent nodes. |
|
public |
The queue used to process nodes in parallel |
Private Members | ||
private |
_handleNode: * The custom node handler. |
|
private |
A map of nodes already handled. |
|
private |
A regular expression matching all ignored nodes. |
|
private |
If a warning should be printed for attempting to pull sort order nodes |
|
private |
The number of pushed (discovered and handled) nodes. |
|
private |
_recursive: * If the browser should recurse. |
|
private |
_reject: * |
|
private |
_session: * |
|
private |
|
|
private |
_waitingFor: {} |
Method Summary
Public Methods | ||
public |
addNode(node: BrowsedNode): PromiseBrowsedNode> Instructs the browser to handle a node that would otherwise be queued behind others (eg: its parent node). |
|
public |
Starts the browser of the given nodes. |
Private Methods | ||
private |
Browses the server address space at the given node id. |
|
private |
_browseNode(node: BrowsedNode): * Browses a node. |
|
private |
Discovers and browses the source nodes. |
|
private |
_hasDependencies(node: BrowsedNode): * Returns |
|
private |
_isExternalReference(idValue: string | number): boolean Returns |
|
private |
async _process(node: BrowsedNode): PromiseBrowsedNode> Processes a single node: Requires special error handling. |
|
private |
async _push(node: BrowsedNode) Finishes processing a given node: After calling NodeBrowser#_handleNode, it resolves is's dependencies. |
|
private |
_readValue(node: BrowsedNode): * Reads the given node's value. |
Public Constructors
public constructor(options: Object) source
Creates a new node browser.
Params:
Name | Type | Attribute | Description |
options | Object | The options to use. |
|
options.concurrency | number |
|
The maximum of nodes to process in parallel. |
options.handleNode | function(node: BrowsedNode): Promise<any> | A custom node handler. |
|
options.recursive | boolean |
|
If the whole node tree should be processed. |
Public Members
public ensureHandled: * source
public parentNode: Map<string, string> source
A map that maps node ids against their discovered hierarchical parent nodes. Used to detect reference conflicts.
Private Members
private _handleNode: * source
The custom node handler. @type {function(node: BrowsedNode): Promise<any>}
private _handled: Map<string, boolean> source
A map of nodes already handled. Keys are ids, values are true
if the node was already
pushed and false
otherwise.
private _ignoreNodesRegExp: * source
A regular expression matching all ignored nodes. @type {RegExp}
private _printSortOrderWarning: boolean source
If a warning should be printed for attempting to pull sort order nodes
private _reject: * source
private _session: * source
private _sourceNodesRegExp: * source
private _waitingFor: {} source
Public Methods
public addNode(node: BrowsedNode): PromiseBrowsedNode> source
Instructs the browser to handle a node that would otherwise be queued behind others (eg: its parent node).
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to add. |
public async browse(nodeIds: NodeId[]): Promise<any> source
Starts the browser of the given nodes.
Params:
Name | Type | Attribute | Description |
nodeIds | NodeId[] | The nodes to browse. |
Private Methods
private _browse(options: Object): * source
Browses the server address space at the given node id.
Params:
Name | Type | Attribute | Description |
options | Object | The options to use. |
Return:
* |
private _browseNode(node: BrowsedNode): * source
Browses a node.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to browse. |
Return:
* |
private _getSourceNodes(nodeIds: Array<string, NodeId>): Promise<Node[]> source
Discovers and browses the source nodes.
private _hasDependencies(node: BrowsedNode): * source
Returns true
if a node has dependencies it should be queued behind.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to check. |
Return:
* |
private _isExternalReference(idValue: string | number): boolean source
Returns true
for node ids that should be treated as external references.
private async _process(node: BrowsedNode): PromiseBrowsedNode> source
Processes a single node: Requires special error handling.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to process. |
private async _push(node: BrowsedNode) source
Finishes processing a given node: After calling NodeBrowser#_handleNode, it resolves is's dependencies.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node handled. |
private _readValue(node: BrowsedNode): * source
Reads the given node's value.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to read. |
Return:
* |