Class: GraphNotification

GraphNotification

A graph notification is a notification that complete data of a graphdef subscription. It contains data updates to write in the graph database and metadata to update the state of blocks.

It is essentially used in the method update of graphdefs.


new GraphNotification(id, data)

Creates an instance of a GraphNotification.

Parameters:
Name Type Description
id string

The id for this notification.

data olympe.dc.db.GraphPatch

The updates being reported.

Methods


addBlock(id, instancesToAdd, instancesToRemove)

Add a new block in this notification with the list of instances to add, to remove and the new children of this block.

Parameters:
Name Type Description
id string

The block id.

instancesToAdd Array.<string>

List of instances to add.

instancesToRemove Array.<string>

List of instances to remove.


applyTo(notification)

Apply all the operations and metadata of this notification on the specified one.

Parameters:
Name Type Description
notification olympe.dc.query.GraphNotification

forEachBlock(callback)

Run the specified function for each block of contained in this notification.

Parameters:
Name Type Description
callback olympe.dc.query.GraphNotification.BlockNotificationHandler

The function to perform.


getId()

Gets the id of the graphdef which this notification is associated to.

Returns:

The graphdef id.

Type
string

getPatch()

Gets the data as a Graph patch.

Returns:

The graph patch of this notification.

Type
olympe.dc.db.GraphPatch

Type Definitions


BlockNotificationHandler(id, add, remove)

Parameters:
Name Type Description
id string

the block id

add Array.<string>
remove Array.<string>