Options
All
  • Public
  • Public/Protected
  • All
Menu

Utility to rewrite cached numeric indexes and positions of an LSEQ, based on inserts and deletions requested at given indexes or position IDs.

Type parameters

  • T

Hierarchy

  • LseqIndexRewriter

Index

Constructors

constructor

Properties

deletes

deletes: Set<string> = new Set<string>()

Deleted positions

Readonly lseq

lseq: LseqDef

Readonly site

site: string

Accessors

domain

  • get domain(): { index: object; posId: object }
  • Indicates the domain of indexes and position IDs that this rewriter will affect in a call to rewriteIndexes, so long as no further calls to addDelete or addInsert are made.

    Returns { index: object; posId: object }

    • index: object
      • max: number
      • min: number
    • posId: object
      • max: string
      • min: string

inserts

  • get inserts(): Generator<{ index: number; value: NonNullable<T> } | { posId: string; value: T }, void, unknown>
  • Returns Generator<{ index: number; value: NonNullable<T> } | { posId: string; value: T }, void, unknown>

Methods

addDelete

  • addDelete(posId: string): void
  • Parameters

    • posId: string

      the position ID of the deleted value

    Returns void

addInsert

  • addInsert(items: T[], index: number): void
  • addInsert(value: T, posId: string): void
  • Parameters

    • items: T[]

      opaque data to insert in the list

    • index: number

      index to insert at

    Returns void

  • Parameters

    • value: T

      opaque data to insert in the list

    • posId: string

      position ID to insert at

    Returns void

removeInsert

  • removeInsert(posId: string): void
  • Parameters

    • posId: string

    Returns void

rewriteIndexes

  • Starting from the minimum affected index, generates LSEQ position identifiers for the inserted indexes and rewrites existing indexes

    Parameters

    • existing: PosItem<T>[]

      preconditions:

      • sorted by posId
      • contiguous (no gaps after first non-empty array position)
      • index >= domain.index.min
      • value >= domain.posId.min
    • notify: LseqIndexNotify<T>

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static property
  • Static method
  • Inherited property
  • Protected method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.9.2-edge.3 Source code licensed MIT. Privacy policy