Class: TransactionManager

olympe.dc.transaction. TransactionManager

The transaction manager is a singleton that handles the execution of transaction.


new TransactionManager(logger, db, router, fileManager, timeout)

Parameters:
Name Type Description
logger olympe.logging.Channel
db olympe.dc.DBView
router olympe.dc.Router
fileManager olympe.dc.FileServiceManager
timeout number

Members


<static> FINALIZE :number

Enumeration of the different ways to finalise a transaction.

Type:
  • number
Properties:
Name Type Default Description
NOTIFICATION_DONE number 0
NO_NOTIFICATION number 1
NO_PERSISTENCE number 2

Methods


clearStack( [callback])

Clears the transaction stack.

Parameters:
Name Type Argument Description
callback olympe.dc.Manager.TransactionCallback <optional>

executeLargeTransaction(transaction [, callback])

Executes the specified transaction over HTTP and do not send notification. Bind the callback with the current execution context.

Parameters:
Name Type Argument Description
transaction olympe.dc.Transaction
callback olympe.dc.Manager.TransactionCallback <optional>

executeTransaction(transaction [, callback] [, waitForNotification])

Executes the specified transaction over WS, sends notifications. Bind the callback with the current execution context.

Parameters:
Name Type Argument Description
transaction olympe.dc.Transaction
callback olympe.dc.Manager.TransactionCallback <optional>
waitForNotification boolean <optional>

If true, wait for the transaction to have been notified to all clients before calling back. If false, call back as soon as the transaction has been accepted.


getLogger()

Return the transaction logger

Returns:

the transaction logger

Type
olympe.logging.Channel

getStack(callback)

Gets the transaction stack.

Parameters:
Name Type Description
callback function

the callback receiving the list of transaction ids, the undo stack size and the redo stack size


<package> initBurstTransaction(transaction)

Initialise a burst transaction.

Parameters:
Name Type Description
transaction olympe.dc.BurstTransaction
Returns:

onUpdate function

Type
olympe.dc.BurstTransaction.Update

invalidateBurstTransaction(id, rollback, errorMessage)

When a burst transaction is refused by a source, rollback the updates.

Parameters:
Name Type Description
id string

the burst transaction id

rollback olympe.dc.db.GraphPatch

the rollback patch

errorMessage string

onAllTransactionDone(callback)

If some transactions are pending, register a callback that will be be executed when all the pending transactions will be done (fully notified). Otherwise, execute the callback.

Parameters:
Name Type Description
callback function

persistTransaction(id, finalize, errorMsg)

When a transaction has been fully processed by the remote, it ensures the persistence of the instances created by the transaction is applied on the local database. And at that moment it allows the garbage collector to do its job.

Parameters:
Name Type Argument Description
id string

the subscription id

finalize olympe.dc.transaction.TransactionManager.FINALIZE
errorMsg string <nullable>

describe the error that occurred, null if no error.


redo( [callback])

Redoes the last undone transaction.

Parameters:
Name Type Argument Description
callback olympe.dc.Manager.TransactionCallback <optional>

sendBurstUpdate(transaction, updates, isCommit [, commitCallback])

Send the accumulated burst transaction updates to the datacloud.

Parameters:
Name Type Argument Description
transaction olympe.dc.BurstTransaction
updates Map.<string, !Map.<string, *>>
isCommit boolean
commitCallback olympe.dc.Manager.TransactionCallback <optional>

undo( [callback])

Undoes the last transaction (if reversible).

Parameters:
Name Type Argument Description
callback olympe.dc.Manager.TransactionCallback <optional>