Interface: RecordCollectionsMonitor

x2node-dbos. RecordCollectionsMonitor

Interface for components that monitor updates to record collections of each record type as a whole.

Methods


collectionsUpdated(ctx, recordTypeNames)

Called by the DBOs from within the transactions when records of the given record types are modified. The method is called just before the transaction is committed.
Parameters:
Name Type Description
ctx module:x2node-dbos~DBOExecutionContext DBO execution context.
recordTypeNames Set.<string> Names of updated record types.
Returns:
If a Promise is returned, the transaction is not committed until the promise is fulfilled. If the promise is rejected, the whole transaction gets rolled back. Any other type of returned value is ignored and the transaction is committed immediately.
Type
Promise

getCollectionsVersion(tx, recordTypeNames [, lockType])

Get record collection version information for the specified record types.
Parameters:
Name Type Argument Description
tx module:x2node-dbos~Transaction The transaction.
recordTypeNames Set.<string> Names of the record types to include.
lockType string <optional>
If provided, the collections are locked until the end of the transaction. The value can be either "shared" or "exclusive".
Returns:
Promise of the result object. The result object includes two properties: modifiedOn, which is a Date representing the last modification timestamp of the records collection among the requested ones that was modified most recently, and version, which is a number that is a sum of all requested record collection versions.
Type
Promise.<Object>