TransactionView Class
An view of a distributed tree that is part of an ongoing transaction between RevisionView
s.
Signature
export declare class TransactionView extends TreeView
Extends: TreeView
Methods
Method | Return Type | Description |
---|---|---|
addNodes(sequence) | TransactionView | Inserts all nodes in a NodeSequence into the view |
attachRange(nodesToAttach, place) | TransactionView | Parents a set of detached nodes at a specified place. |
close() | RevisionView | Conclude a transaction by generating an immutable RevisionView from this view |
deleteNodes(nodes) | TransactionView | Remove all nodes with the given ids from the view |
detachRange(rangeToDetach) | { view: TransactionView; detached: readonly NodeId[]; } | Detaches a range of nodes from their parent. The detached nodes remain in the view. |
equals(view) | boolean | |
setNodeValue(nodeId, value) | TransactionView | Sets or overwrites a node's value. The node must exist in this view. |
Method Details
addNodes
Inserts all nodes in a NodeSequence into the view
Signature
addNodes(sequence: Iterable<TreeViewNode>): TransactionView;
Parameters
Parameter | Type | Description |
---|---|---|
sequence | Iterable<TreeViewNode> |
Returns
Return type: TransactionView
attachRange
Parents a set of detached nodes at a specified place.
Signature
attachRange(nodesToAttach: readonly NodeId[], place: TreeViewPlace): TransactionView;
Parameters
Parameter | Type | Description |
---|---|---|
nodesToAttach | readonly NodeId[] | the nodes to parent in the specified place. The nodes must already be present in the view. |
place | TreeViewPlace | the location to insert the nodes. |
Returns
Return type: TransactionView
close
Conclude a transaction by generating an immutable RevisionView
from this view
Signature
close(): RevisionView;
Returns
Return type: RevisionView
deleteNodes
Remove all nodes with the given ids from the view
Signature
deleteNodes(nodes: Iterable<NodeId>): TransactionView;
Parameters
Parameter | Type | Description |
---|---|---|
nodes | Iterable<NodeId> |
Returns
Return type: TransactionView
detachRange
Detaches a range of nodes from their parent. The detached nodes remain in the view.
Signature
detachRange(rangeToDetach: TreeViewRange): {
view: TransactionView;
detached: readonly NodeId[];
};
Parameters
Parameter | Type | Description |
---|---|---|
rangeToDetach | TreeViewRange | the range of nodes to detach |
Returns
Return type: { view: TransactionView; detached: readonly NodeId[]; }
equals
Signature
equals(view: TreeView): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
view | TreeView |
Returns
Return type: boolean
setNodeValue
Sets or overwrites a node's value. The node must exist in this view.
Signature
setNodeValue(nodeId: NodeId, value: Payload): TransactionView;
Parameters
Parameter | Type | Description |
---|---|---|
nodeId | NodeId | the id of the node |
value | Payload | the new value |
Returns
Return type: TransactionView