Skip to content

Class: PendingCommit ​

Defined in: netconf/src/operations/transaction.ts:540

A confirmed commit waiting for confirmation (RFC 6241 §8.4). The server reverts it unless confirm() reaches it before expires.

The candidate lock is held until it is confirmed, cancelled, expires or the session closes, so no other session can edit the candidate and commit it (which would confirm ours early). The running lock is released as soon as the confirmed commit succeeds: the server's revert writes running, and holding running's lock can stop it (netopeer2 then keeps the commit for good).

await using pending = … cancels it on scope exit if it is still pending.

Implements ​

  • AsyncDisposable

Properties ​

expires ​

ts
readonly expires: Date;

Defined in: netconf/src/operations/transaction.ts:544

When the server reverts the commit, measured on this machine from when the commit succeeded.


persistId ​

ts
readonly persistId: string | undefined;

Defined in: netconf/src/operations/transaction.ts:542

The persist id, when the commit was made with persist (it then outlives the session).

Accessors ​

state ​

Get Signature ​

ts
get state(): PendingCommitState;

Defined in: netconf/src/operations/transaction.ts:572

  • pending: waiting for confirm() or cancel()
  • confirmed, cancelled: settled by this handle
  • expired: the timeout passed and the server reverted the commit
  • closed: the session ended. The server reverted the commit unless it was made with persist; a persistent one can still be confirmed or cancelled from another session with client.ops.commit({ persistId }) or client.ops.cancelCommit({ persistId }).
Returns ​

PendingCommitState

Methods ​

[asyncDispose]() ​

ts
[asyncDispose](): Promise<void>;

Defined in: netconf/src/operations/transaction.ts:608

Cancel if still pending.

Returns ​

Promise<void>

Implementation of ​

AsyncDisposable.[asyncDispose]


cancel() ​

ts
cancel(options?): Promise<void>;

Defined in: netconf/src/operations/transaction.ts:596

Revert the commit now with <cancel-commit> (needs :confirmed-commit:1.1), discard the candidate and release the locks.

Parameters ​

options? ​

RpcOptions = {}

Returns ​

Promise<void>


confirm() ​

ts
confirm(options?): Promise<void>;

Defined in: netconf/src/operations/transaction.ts:581

Confirm the commit with <commit> (carrying <persist-id> if it was made with persist), then release the locks. Refused locally once settled, or when less than CONFIRM_MARGIN_MS remain before it expires.

Parameters ​

options? ​

RpcOptions = {}

Returns ​

Promise<void>

Released under the MIT Licence.