Home Manual Reference Source Test
import NodeBrowser from 'atscm/src/lib/server/NodeBrowser.js'
public class | source

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

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

If the browser should recurse.

private

_reject: *

private
private
private

Method Summary

Public Methods
public

Instructs the browser to handle a node that would otherwise be queued behind others (eg: its parent node).

public

async browse(nodeIds: NodeId[]): Promise<any>

Starts the browser of the given nodes.

Private Methods
private

_browse(options: Object): *

Browses the server address space at the given node id.

private

Browses a node.

private

Discovers and browses the source nodes.

private

Returns true if a node has dependencies it should be queued behind.

private

Returns true for node ids that should be treated as external references.

private

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

Reads the given node's value.

Public Constructors

public constructor(options: Object) source

Creates a new node browser.

Params:

NameTypeAttributeDescription
options Object

The options to use.

options.concurrency number
  • optional
  • default: 250

The maximum of nodes to process in parallel.

options.handleNode function(node: BrowsedNode): Promise<any>

A custom node handler.

options.recursive boolean
  • optional

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.

public queue: p-queue~PQueue source

The queue used to process nodes in parallel

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 _pushed: number source

The number of pushed (discovered and handled) nodes. @type {number}

private _recursive: * source

If the browser should recurse. @type {boolean}

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:

NameTypeAttributeDescription
node BrowsedNode

The node to add.

Return:

PromiseBrowsedNode>

The fully processed node.

public async browse(nodeIds: NodeId[]): Promise<any> source

Starts the browser of the given nodes.

Params:

NameTypeAttributeDescription
nodeIds NodeId[]

The nodes to browse.

Return:

Promise<any>

Resolved once all nodes are finished.

Private Methods

private _browse(options: Object): * source

Browses the server address space at the given node id.

Params:

NameTypeAttributeDescription
options Object

The options to use.

Return:

*

private _browseNode(node: BrowsedNode): * source

Browses a node.

Params:

NameTypeAttributeDescription
node BrowsedNode

The node to browse.

Return:

*

private _getSourceNodes(nodeIds: Array<string, NodeId>): Promise<Node[]> source

Discovers and browses the source nodes.

Params:

NameTypeAttributeDescription
nodeIds Array<string, NodeId>

The source ids.

Return:

Promise<Node[]>

Resolved once finished.

private _hasDependencies(node: BrowsedNode): * source

Returns true if a node has dependencies it should be queued behind.

Params:

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

Params:

NameTypeAttributeDescription
idValue string | number

Value of the id to check.

Return:

boolean

If the id should be treated as external.

private async _process(node: BrowsedNode): PromiseBrowsedNode> source

Processes a single node: Requires special error handling.

Params:

NameTypeAttributeDescription
node BrowsedNode

The node to process.

Return:

PromiseBrowsedNode>

The fully processed node.

private async _push(node: BrowsedNode) source

Finishes processing a given node: After calling NodeBrowser#_handleNode, it resolves is's dependencies.

Params:

NameTypeAttributeDescription
node BrowsedNode

The node handled.

private _readValue(node: BrowsedNode): * source

Reads the given node's value.

Params:

NameTypeAttributeDescription
node BrowsedNode

The node to read.

Return:

*