Constructor
# new SyncronousLock(counteropt, onBeginopt, onEndopt)
Simple Synchronous Lock implementation
for transaction management adapted from https://www.talkinghightech.com/en/creating-a-js-lock-for-a-resource/
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
counter |
number
|
<optional> |
the number of simultaneous transactions allowed. defaults to 1 |
onBegin |
function
|
<optional> |
to be called at the start of the transaction |
onEnd |
function
|
<optional> |
to be called at the conclusion of the transaction |
- Implements:
Members
Transaction
# currentTransaction Optional
Stores a reference to the currently executing transaction, allowing access to the active transaction context
Current active transaction reference
Methods
# async release(erropt) → {Promise.<void>}
Releases The lock after the conclusion of a transaction
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
Promise.<void>
# submit(transaction) → {void}
Submits a transaction to be processed
Parameters:
Name | Type | Description |
---|---|---|
transaction |
Transaction
|
- Implements:
void