@sovereignbase/sequencer
    Preparing search index...

    Class Projection<T>

    Visible Projection of a replicated Sequence.

    Type Parameters

    • T
    Index
    • Prepares to sequence a projection, optionally hydrating from a trusted sequence stored by the application.

      Type Parameters

      • T

      Parameters

      • actorID: number

        Actor identifier used in acknowledgements.

      • OptionaltrustedSequence: unknown

        Optional trusted Sequence in Structural Order; string Footage is split into UTF-16 code units.

      Returns Projection<T>

      SequencerError if native initialization fails.

    actorID: number

    Actor identifier used in acknowledgements.

    • Applies gossiped Insertions and Acknowledgements.

      Parameters

      • gossip: unknown

        Batch of Insertion and Acknowledgement tuples.

      Returns readonly [Change<T>, Gossip<T> | undefined] | undefined

      Visible changes and optional acknowledgement Gossip, or undefined for invalid input. Earlier entries may already have been applied.

      SequencerError with code PROJECTION_DESTROYED after destruction.

    • Inserts values at a Projection position.

      Parameters

      • values: T[]

        Nonempty array of values to insert.

      • at: number

        Insertion position in 0..length(), inclusive.

      Returns Gossip<T>

      Gossip describing the insertion.

      SequencerError with code PROJECTION_DESTROYED after destruction.

    • Returns the length, A.K.A. amount of entries of this projection.

      Returns number

      Current Projection length.

      SequencerError with code PROJECTION_DESTROYED after destruction.

    • Applies relevant acknowledgements and nonduplicate insertions from a replica of the sequence.

      Parameters

      • sequence: unknown

        Sequence to merge.

      Returns readonly [Change<T>, Gossip<T> | undefined] | undefined

      Visible changes and optional acknowledgement Gossip, or undefined if the Sequence has an invalid runtime shape.

      SequencerError with code PROJECTION_DESTROYED after destruction.

    • Removes an inclusive range of Projection positions.

      Parameters

      • OptionalstartAt: number

        First position to remove; defaults to 0.

      • OptionalendWith: number

        Last position to remove; defaults to length() - 1.

      Returns Gossip<T>

      Reducing Insertions and their acknowledgement as Gossip.

      SequencerError if destroyed or the native runtime reports an operation failure.

    • Replaces an inclusive range of Projection positions.

      Parameters

      • withValues: T[]

        Replacement values; an empty array only removes the range.

      • OptionalstartAt: number

        First position to replace; defaults to 0.

      • OptionalendWith: number

        Last position to replace; defaults to length() - 1.

      Returns Gossip<T>

      Removal and insertion Gossip, in that order.

      SequencerError if destroyed or the native runtime reports an operation failure.

    • Retires an Actor from future compaction requirements.

      Parameters

      • actorID: number

        Actor whose Acknowledgements are no longer required for compaction.

      Returns void

      The application is responsible for deciding which Actors are retired and for propagating that decision to the relevant replicas.

      SequencerError if destroyed or the native runtime reports an operation failure.

    • Sequences state into a compact serializable format.

      Type Parameters

      • StringEncoded extends boolean = false

      Parameters

      • OptionalstringEncode: StringEncoded

        Whether to concatenate Footage into a string; each text Frame must be one UTF-16 code unit. Defaults to false.

      Returns readonly [
          U32List,
          StringEncoded extends true ? string : readonly (T | undefined)[],
      ]

      A Sequence with acknowledged removals compacted in the exported state.

      Register active Actors before removal. Equal complete Session frontiers permit masks and deleted Footage to be omitted from the retained checkpoint. Compaction may translate retained anchors without rewriting this instance.

      SequencerError if destroyed or the native runtime reports an operation failure.

      SequencerError with code STRING_ENCODING_FAILED if Footage concatenation fails.

    • Returns the value at a Projection position.

      Parameters

      • at: number

        Valid visible position in 0..length() - 1.

      Returns T | undefined

      The corresponding Footage value.

      SequencerError with code PROJECTION_DESTROYED after destruction.

    • Returns values from an inclusive range of Projection positions.

      Parameters

      • OptionalstartAt: number

        First included position; defaults to 0.

      • OptionalendWith: number

        Last included position; defaults to length() - 1.

      Returns T[]

      A new array of values, or an empty array for an empty range.

      SequencerError if destroyed or the native runtime reports an operation failure.