An asynchronous StepExternalByteStore that models a range-fetched source — an HTTP server honouring Range: requests, or an OPFS/blob store read block-by-block — so the index-first open path (M4) can be exercised and measured without a network. It wraps a fully-resident buffer (the "server") but never assumes the client holds it: every read is counted as a fetch, and with a blockBytes grid the fetch is rounded out to whole blocks, so stats reports the real transfer an aligned store would incur.

This is the source a sidecar-driven open pairs with: reconstruct the entity index from the sidecar (no scan), then pull only the byte ranges demand asks for through a source like this — and read back from stats how little of the file that touched.

Implements

Constructors

Accessors

Methods

Constructors

  • Parameters

    • bytes_: Uint8Array<ArrayBufferLike>

      The full backing bytes (the notional server-side file). Not copied; treated as read-only.

    • blockBytes: number = 0

      Optional fetch granularity: reads are rounded out to a multiple of this so bytesFetched reflects whole-block transfer. Omit (or pass 0) for exact, unaligned fetches.

    Returns RangeByteSource

Accessors

  • get byteLength(): number
  • Total size of the stored byte sequence.

    Returns number

    The byte length.

  • get stats(): RangeFetchStats
  • A snapshot of the fetch counters.

    Returns RangeFetchStats

    The current stats.

Methods

  • Read a range, accounting for the (block-aligned) fetch it would incur. Returns exactly the requested length bytes as a standalone array, even though the underlying fetch may have pulled a wider aligned span.

    Parameters

    • offset: number

      Absolute offset of the first byte to read.

    • length: number

      Number of bytes to read.

    Returns Promise<Uint8Array<ArrayBufferLike>>

    The requested bytes (byteOffset 0).