WriteStream
Extends:
A stream that writes all read AtviseFiles to their corresponding nodes on atvise server. The underlying TreeStream ensures the nodes are processed in an order that respects the parent-child relations between nodes. Nodes are created (if needed) before their children are processed.
Constructor Summary
| Public Constructor | ||
| public |
constructor(createStream: CreateNodeStream, addReferencesStream: AddReferencesStream, options: Object) Creates a new write stream with the given CreateNodeStream and AddReferencesStream. |
|
Member Summary
| Private Members | ||
| private |
The stream responsible for adding additional references. |
|
| private |
_createCallbacks: function(err: Error) If a node has to be created first, it's callback is added to this map. |
|
Method Summary
| Public Methods | ||
| public |
dependenciesFor(file: AtviseFile): NodeId[] Returns a files parent node and type definition. |
|
| public |
processChunk(file: AtviseFile, handleErrors: function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function)) Writes an AtviseFile to it's corresponding node on atvise server. |
|
| public |
processErrorMessage(file: AtviseFile): string The error message to use when writing a file fails. |
|
| Private Methods | ||
| private |
_createNode(file: AtviseFile, handleErrors: function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function)) Pushes a node to the piped create stream and waits for the node to be created. |
|
Public Constructors
public constructor(createStream: CreateNodeStream, addReferencesStream: AddReferencesStream, options: Object) source
Creates a new write stream with the given CreateNodeStream and AddReferencesStream. Implementer have to ensure this create stream is actually piped.
Params:
| Name | Type | Attribute | Description |
| createStream | CreateNodeStream | The stream that handles node creations. |
|
| addReferencesStream | AddReferencesStream | The stream that adds missing node references. |
|
| options | Object | The options passed to the underlying TreeStream. |
Private Members
private _addReferencesStream: AddReferencesStream source
The stream responsible for adding additional references.
Public Methods
public dependenciesFor(file: AtviseFile): NodeId[] source
Returns a files parent node and type definition.
Params:
| Name | Type | Attribute | Description |
| file | AtviseFile | The file to check. |
public processChunk(file: AtviseFile, handleErrors: function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function)) source
Writes an AtviseFile to it's corresponding node on atvise server.
Params:
| Name | Type | Attribute | Description |
| file | AtviseFile | The file to write. |
|
| handleErrors | function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function) | The error handler to call. See QueueStream#processChunk for details. |
public processErrorMessage(file: AtviseFile): string source
The error message to use when writing a file fails.
Params:
| Name | Type | Attribute | Description |
| file | AtviseFile | The file being processed. |
Private Methods
private _createNode(file: AtviseFile, handleErrors: function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function)) source
Pushes a node to the piped create stream and waits for the node to be created.
Params:
| Name | Type | Attribute | Description |
| file | AtviseFile | The file create the node for. |
|
| handleErrors | function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function) | The error handler to call. See QueueStream#processChunk for details. |
