Represents the bin type in JSON CRDT. The bin is a blob of binary data, powered by a Replicated Growable Array (RGA) algorithm.

Hierarchy

  • AbstractRga<Uint8Array>
    • BinNode

Implements

Constructors

Properties

count: number = 0

Unique ID within a document.

ids: undefined | Chunk<Uint8Array> = undefined
root: undefined | Chunk<Uint8Array> = undefined

Methods

  • Parameters

    • position: number

    Returns undefined | [chunk: Chunk<Uint8Array>, offset: number]

  • Parameters

    • size: number
    • next: (() => Chunk<Uint8Array>)
        • (): Chunk<Uint8Array>
        • Returns Chunk<Uint8Array>

    Returns void

  • Parameters

    • chunk: Chunk<Uint8Array>
    • at: Chunk<Uint8Array>
    • offset: number

    Returns void

  • Returns (() => undefined | Chunk<Uint8Array>)

      • (): undefined | Chunk<Uint8Array>
      • Returns undefined | Chunk<Uint8Array>

  • Parameters

    • curr: Chunk<Uint8Array>

    Returns undefined | Chunk<Uint8Array>

    Todo

    Or better remove this method completely, as it does not require "this".

  • Parameters

    • curr: Chunk<Uint8Array>

    Returns undefined | Chunk<Uint8Array>

    Todo

    Or better remove this method completely, as it does not require "this".

  • Parameters

    • startChunk: undefined | Chunk<Uint8Array>

      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

          • chunk: Chunk<Uint8Array>
          • off: number
          • len: number

          Returns void

    Returns undefined | Chunk<Uint8Array>

    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.