\r\n

51Degrees Pipeline Node.js  4.4

51Degrees Pipeline for Node.js

Engine Class Reference

Detailed Description

An Engine is an extension of a FlowElement which adds options such as restricting to a subset of properties and a cache and the ability to load property data from a datafile of the DataFile class.

Examples
onPremiseFlowElement.js.

Inheritance diagram for Engine:

[legend]

Collaboration diagram for Engine:

[legend]

Public Member Functions

 constructor ({ cache, restrictedProperties, dataFile }={})
Constructor for an Engine. More...
 inCache (flowData)
Checks cache and returns cached result if found. More...
 process (flowData)
An engine's process function checks cache for an item (calling inCache) If found it returns the cached object If not found it runs the standard processInternal function and adds it to the cache (if a cache is present) More...
 refresh ()
Callback which runs when an attached DataFile is updated Needs to be overriden by a specific engine to do anything. More...
 registerDataFile (dataFile)
Function to attach a DataFile to the engine and register it with a DataFileUpdateService if needed. More...

Public Member Functions inherited from FlowElement

 constructor ({ processInternal, dataKey, properties={}, evidenceKeyFilter }={})
Constructor for flowElement class. More...
 onRegistration (pipeline, flowElement)
Internal function to be called when a FlowElement is added to pipeline, runs through any registrationCallbacks on the FlowElement. More...
 ready ()
Function called to check if a FlowElement is ready Used when there are asynchronous initialisation steps. More...
 processInternal (flowData)
Internal process function for a particular flowElement called (via the flowElement.process() method) when flowData generated by a pipleline is processsed. More...
 process (flowData)
To allow actions to take place before and after a FlowElement's processInternal function runs, a process wrapper is run first. More...
 updateProperties ()
Call this function to update the properties meta database in all the pipelines this flowElement has been added to. More...
 getProperties ()
Get a flowElement's properties. More...
 _log (type, message)
Internal log. More...

Member Function Documentation

◆ constructor()

Engine::constructor (   { cache, restrictedProperties, dataFile } = {} )
inline

Constructor for an Engine.

Parameters
{object} - options options for the engine
{DataFile} - options.dataFile an optional datafile to add to the engine
{DataKeyedCache} - options.cache instance of a DataKeyedCache
{Array} - options.restrictedProperties specific list of properties to fetch elementData for

◆ inCache()

Engine::inCache (   flowData )
inline

Checks cache and returns cached result if found.

Parameters
{FlowData} - flowData checks if a FlowData's evidence is already in the cache and processing can be bypassed
Returns
{boolean} whether in cache

◆ process()

Engine::process (   flowData )
inline

An engine's process function checks cache for an item (calling inCache) If found it returns the cached object If not found it runs the standard processInternal function and adds it to the cache (if a cache is present)

Parameters
{FlowData} - flowData FlowData to process
Returns
{Promise<true|void>} result of processing

◆ refresh()

Engine::refresh ( )
inline

Callback which runs when an attached DataFile is updated Needs to be overriden by a specific engine to do anything.

Returns
{void}

◆ registerDataFile()

Engine::registerDataFile (   dataFile )
inline

Function to attach a DataFile to the engine and register it with a DataFileUpdateService if needed.

Parameters
{DataFile} - dataFile the datafile to register