Skip to main content
Version: v2

RunTransaction Interface

A function which runs a transaction in a SharedTree.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature​

/** @sealed */
export interface RunTransaction

Properties​

PropertyModifiersTypeDescription
rollbackreadonlytypeof rollbackThe rollback object used to roll back a transaction.

Call Signatures​

Call SignatureReturn TypeDescription
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResultTResultApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollbackTResult | typeof rollbackApply one or more edits to the tree as a single atomic unit.
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): voidvoidApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): voidvoidApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResultTResultApply one or more edits to the tree as a single atomic unit.
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollbackTResult | typeof rollbackApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollbackTResult | typeof rollbackApply one or more edits to the tree as a single atomic unit.
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): voidvoidApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): voidvoidApply one or more edits to the tree as a single atomic unit.
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResultTResultApply one or more edits to the tree as a single atomic unit.
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResultTResultApply one or more edits to the tree as a single atomic unit.
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollbackTResult | typeof rollbackApply one or more edits to the tree as a single atomic unit.

Property Details​

rollback​

The rollback object used to roll back a transaction.

Signature​

readonly rollback: typeof rollback;

Type: typeof rollback

Call Signature Details​

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back (whether by an error or by returning the rollback | rollback value), a corresponding change event will also be emitted for the rollback.

<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back (whether by an error or by returning the rollback | rollback value), a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back (whether by an error or by returning the rollback | rollback value), a corresponding change event will also be emitted for the rollback.

<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): void​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): void;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
Type Parameters​
ParameterConstraintDescription
TViewTreeView<any>
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback​

Apply one or more edits to the tree as a single atomic unit.

Signature​

<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
Type Parameters​
ParameterConstraintDescription
TNodeTreeNode
TResult

Remarks​

All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes. Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not. However, using a transaction has the following additional consequences:

  • If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
  • The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.

Local change events will be emitted for each change as the transaction is being applied. If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function. If the transaction is rolled back (whether by an error or by returning the rollback | rollback value), a corresponding change event will also be emitted for the rollback.