Class ArrNode<Element>

Represents the arr JSON CRDT type, which is a Replicated Growable Array (RGA). Each element ot the array is a reference to another JSON CRDT node.

Type Parameters

Hierarchy

  • AbstractRga<E[]>
    • ArrNode

Implements

Constructors

Properties

count: number = 0
doc: Model<any>

Unique ID within a document.

ids: undefined | Chunk<ITimestampStruct[]> = undefined
root: undefined | Chunk<ITimestampStruct[]> = undefined

Methods

  • Returns a JSON node at a given position in the array.

    Parameters

    • position: number

      The position of the element to get.

    Returns undefined | JsonNode<unknown>

    A JSON node, if any.

  • Parameters

    • startChunk: undefined | Chunk<ITimestampStruct[]>

      Chunk from which to start the range. If undefined, the chunk containing from will be used. This is an optimization to avoid a lookup.

    • from: ITimestampStruct

      ID of the first element in the range.

    • to: ITimestampStruct

      ID of the last element in the range.

    • callback: ((chunk, off, len) => void)

      Function to call for each chunk slice in the range.

        • (chunk, off, len): void
        • Parameters

          Returns void

    Returns undefined | Chunk<ITimestampStruct[]>

    Reference to the last chunk in the range.

    Note

    All ".rangeX()" method are not performance optimized. For hot paths it is better to hand craft the loop.