LSeqTree
Distributed array using LSeq allocation strategy with an underlying exponential tree.
Constructor Summary
Public Constructor | ||
public |
constructor(source: Object, options: Object) |
Member Summary
Public Members | ||
public get |
length: * |
|
public |
options: * |
|
public |
root: * |
Private Members | ||
private |
_base: * |
|
private |
_boundary: * |
|
private |
|
|
private |
_hash: * |
|
private |
_s: * |
|
private |
_strategy: * |
Method Summary
Public Methods | ||
public |
alloc(p: LSeqNode, q: LSeqNode): Identifier Generate the digit part of the identifiers between p and q. |
|
public |
applyInsert(pair: Object, noIndex: boolean): Number | Boolean Insert an element created from a remote site into the array. |
|
public |
applyRemove(i: Identifier | LSeqNode): Number Delete the element with the targeted identifier. |
|
public |
Cast the JSON object into a proper LSeqTree. |
|
public |
Get the element at targeted index in the linearized sequence. |
|
public |
Insert a value at the targeted index. |
|
public |
remove(index: Number): Identifier Delete the element at the index. |
Private Methods | ||
private |
|
Public Constructors
public constructor(source: Object, options: Object) source
Params:
Name | Type | Attribute | Description |
source | Object | The globally unique site identifier. |
|
options | Object |
|
The options of the LSeqTree. |
options.boundary | Number |
|
The maximal interval between two generated nodes. |
options.base | Number |
|
The base, i.e., the maximal arity of the root node. Default is 2**15. |
Public Members
public get length: * source
public options: * source
public root: * source
Private Members
private _base: * source
private _boundary: * source
private _hash: * source
private _s: * source
private _strategy: * source
Public Methods
public alloc(p: LSeqNode, q: LSeqNode): Identifier source
Generate the digit part of the identifiers between p and q.
public applyInsert(pair: Object, noIndex: boolean): Number | Boolean source
Insert an element created from a remote site into the array.
Params:
Name | Type | Attribute | Description |
pair | Object | Pair containing the identifier and the element to insert in the data structure. |
|
pair.id | Identifier | LSeqNode | The identifier of the element. |
|
pair.elem | Object | The element to insert. |
|
noIndex | boolean |
|
Whether or not it should return the index of the insert. |
public applyRemove(i: Identifier | LSeqNode): Number source
Delete the element with the targeted identifier.
Params:
Name | Type | Attribute | Description |
i | Identifier | LSeqNode | The identifier of the element. |
public fromJSON(object: Object): LSeqTree source
Cast the JSON object into a proper LSeqTree.
Params:
Name | Type | Attribute | Description |
object | Object | the JSON object to cast. |
public get(index: Number): Object source
Get the element at targeted index in the linearized sequence. It does not take into account the hidden boundaries of the sequence [MIN, e_1, e_2, ... e_length, MAX], hence index of e_1 is 0.
Params:
Name | Type | Attribute | Description |
index | Number | The index of the element in the flattened array. |
public remove(index: Number): Identifier source
Delete the element at the index.
Params:
Name | Type | Attribute | Description |
index | Number | The index of the element to delete in the array. |