Expand all

ve.dm.TransactionProcessor

Classes

modifiers
Modifier methods.
processors
Processing methods.

Constructor

new ve.dm.TransactionProcessor(doc, transaction, isStaging) #

DataModel transaction processor.

This class reads operations from a transaction and applies them one by one. It's not intended to be used directly; use {ve.dm.Document#commit} instead.

NOTE: Instances of this class are not recyclable: you can only call .process() on them once.

Parameters:

Name Type Description
doc ve.dm.Document
transaction ve.dm.Transaction
isStaging boolean

Transaction is being applied in staging mode

Source:
DataModel transaction processor.

Methods

advanceCursor(increment)private #

Advance the main data cursor.

Parameters:

Name Type Description
increment number

Number of positions to increment the cursor by

Source:
Advance the main data cursor.

applyModifications()private #

Apply all modifications queued through #queueModification, and add their rollback functions to this.rollbackQueue.

Source:

Apply all modifications queued through #queueModification, and add their rollback functions to this.rollbackQueue.

emitQueuedEvents()private #

Emit all events queued through #queueEvent.

Source:
Emit all events queued through #queueEvent.

executeOperation(op)private #

Execute an operation.

Parameters:

Name Type Description
op Object

Operation object to execute

Source:

Throws:

Operation type is not supported

Type
Error
Execute an operation.

process()private #

Process all operations.

When all operations are done being processed, the document will be synchronized.

Source:
Process all operations.

queueEvent(node, name, […args])private #

Queue an event to be emitted on a node.

Duplicate events will be ignored only if all arguments match exactly (i.e. are reference-equal).

Parameters:

Name Type Attributes Description
node ve.dm.Node
name string

Event name

args any optional
repeatable

Additional arguments to be passed to the event when fired

Source:
Queue an event to be emitted on a node.

queueModification(modification)private #

Queue a modification.

Parameters:

Name Type Description
modification Object

Object describing the modification

Properties:
Name Type Attributes Description
type string

Name of a method in ve.dm.TransactionProcessor.modifiers

args Array optional

Arguments to pass to this method

Source:

Throws:

Unrecognized modification type

Type
Error
Queue a modification.

queueUndoFunction(func) #

Queue an undo function. If an exception is thrown while modifying, #rollbackModifications will invoke these functions in reverse order.

Parameters:

Name Type Description
func function

Undo function to add to the queue

Source:
Queue an undo function.

rollbackModifications()private #

Roll back all modifications that have been applied so far. This invokes the callbacks returned by the modifier functions.

Source:
Roll back all modifications that have been applied so far.