Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...

    Chunk prefetcher that proactively fetches adjacent zarr chunks.

    Triggered on L2 hits and L3 fetches to hide network latency by prefetching adjacent chunks (±1 in each dimension) before they are explicitly requested.

    Key features:

    • Symmetric ±1 adjacency in all dimensions
    • Concurrency limiting (default: 4 concurrent)
    • Full deduplication (queue + in-flight)
    • A bounded, NEWEST-first queue: the neighbours of the latest access are the likeliest next reads, and once the view has moved on the oldest entries are the least useful, so they are served last and dropped first
    • Fire-and-forget pattern (non-blocking); dispose() aborts reads in flight
    • Race-condition safe queue processing

    See: docs/guides/specs/CACHE_PREFETCHING_SPEC.md

    Index
    maxConcurrent: number
    enabled: boolean
    debug: boolean
    MAX_QUEUED: 64

    Most neighbours held waiting. A 3D access adds up to six, so this keeps the last ten or so accesses' worth; anything older is dropped.

    inFlight: Set<string> = ...
    queue: Set<string> = ...
    processing: boolean = false
    abort: AbortController = ...

    Aborted by dispose(): cancels every prefetch read still in flight.

    isDisposed: boolean = false
    MAX_SEEN_SIZE: 10000
    seen: Set<string> = ...
    parsedCache: Map<string, number[] | null> = ...

    Cache for parsed chunk indices (avoids repeated regex parsing per access)

    maxChunkIndices: Map<string, number[]> = ...

    Upper bounds per array path for suppressing out-of-range prefetch requests

    • Called by store after L2 hit or L3 fetch. Enqueues adjacent chunks for prefetching.

      Parameters

      • key: string

      Returns void

    • Add a key at the newest end of the queue (moving it there if already queued), unless it is in flight; past MAX_QUEUED the oldest goes.

      Parameters

      • key: string

      Returns void

    • Process the prefetch queue with concurrency limiting. Race-condition safe via processing flag and queueMicrotask re-trigger.

      Returns void

    • Parse chunk indices from a zarr chunk key.

      Parameters

      • key: string

      Returns number[] | null

      parseChunkIndices('points/positions/0.1.2') → [0, 1, 2]
      parseChunkIndices('points/positions/c/0/1/2') → [0, 1, 2]
      parseChunkIndices('.zattrs') → null (not a chunk)
    • Register array shape and chunk sizes to enable adjacency prefetch. Neighbors outside the array's chunk grid are skipped.

      Parameters

      • arrayPath: string

        Base path of the array (e.g., 'gsplats_t0023/centers')

      • shape: number[]

        Array shape (e.g., [2096, 4])

      • chunks: number[]

        Chunk sizes (e.g., [1024, 4])

      Returns void

    • Generate adjacent chunk keys (±1 in each dimension). Returns [] unless bounds are registered for the key's array path.

      Parameters

      • key: string

      Returns string[]

      getAdjacentChunks('points/positions/1.2.3')
      → ['points/positions/0.2.3', 'points/positions/2.2.3',
      'points/positions/1.1.3', 'points/positions/1.3.3',
      'points/positions/1.2.2', 'points/positions/1.2.4']
    • Get prefetch statistics.

      Returns { queued: number; inFlight: number; enabled: boolean }