Provider that pages fixed-size chunks from an external store with an LRU residency cap.

Concurrency note: ensureResident de-duplicates in-flight chunk loads, so overlapping property reads for neighbouring records fetch each chunk once. Eviction only drops the provider's own reference — any descriptor that acquired a view over the chunk keeps that chunk alive independently, so previously-materialised entities keep working after eviction (they just pin their chunk until the descriptor cache is invalidated).

Implements

Constructors

  • Construct this over an external byte store.

    Parameters

    • store_: StepExternalByteStore

      The store holding the source bytes.

    • chunkBytes: number = DEFAULT_CHUNK_BYTES

      Chunk size in bytes (default 4MiB).

    • maxResidentChunks: number = DEFAULT_MAX_RESIDENT_CHUNKS

      LRU residency cap in chunks (default 16).

    Returns WindowedStepBufferProvider

Accessors

  • get byteLength(): number
  • Total logical size of the source bytes.

    Returns number

    The byte length.

  • get residentBytes(): number
  • Bytes currently held resident by the provider.

    Returns number

    The resident byte count.

  • get residentChunkCount(): number
  • Number of resident chunks (telemetry/tests).

    Returns number

    The chunk count.

Methods

  • Synchronously acquire a view containing a byte range.

    Single-chunk ranges are served as the chunk itself (zero copy); straddling ranges get a standalone merged copy spanning exactly the requested range.

    Parameters

    • address: number

      Absolute start of the range.

    • length: number

      Length of the range.

    Returns StepBufferAcquisition

    The view and its base address.

    When any covering chunk isn't resident.

  • Make a byte range resident, paging missing chunks from the store and evicting least-recently-used chunks beyond the cap (never the chunks needed by this call).

    Parameters

    • address: number

      Absolute start of the range.

    • length: number

      Length of the range.

    Returns Promise<void>

    Resolves when resident.