Interface: RecordCollectionsMonitor

x2node-dbos. RecordCollectionsMonitor

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


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.
Name Type Description
ctx module:x2node-dbos~DBOExecutionContext DBO execution context.
recordTypeNames Set.<string> Names of updated record types.
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.

getCollectionsVersion(tx, recordTypeNames [, lockType])

Get record collection version information for the specified record types.
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".
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.