RunTransaction Interface
Packages > fluid-framework > RunTransaction
A function which runs a transaction in a SharedTree.
Signature
/** @sealed */
export interface RunTransaction
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
rollback |
readonly
|
typeof rollback | The rollback object used to roll back a transaction. |
Call Signatures
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode | |
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<ImplicitFieldSchema>, 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<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> | |
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode |
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<ImplicitFieldSchema>>(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<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> |
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<ImplicitFieldSchema>, 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<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> | |
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode | |
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<ImplicitFieldSchema>, 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<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> | |
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode |
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<ImplicitFieldSchema>>(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<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void): void;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> |
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode | |
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<ImplicitFieldSchema>, 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<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TView | TreeView<ImplicitFieldSchema> | |
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
Parameter | Constraint | Description |
---|---|---|
TNode | TreeNode | |
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.