import type { Accessor } from '../../accessor/base.ts'; import type { IndexCacheStore } from '../../cache/index/store.ts'; import type { PathSpec } from '../../types.ts'; import { type DetectFn, type ScopeMatch } from './scope.ts'; export type Reader = (accessor: A, match: ScopeMatch, path: PathSpec, index?: IndexCacheStore) => Promise; export interface ReadWindow { limit?: number | null; offset?: number | null; } export type WindowedReader = (accessor: A, match: ScopeMatch, path: PathSpec, index: IndexCacheStore | undefined, window: ReadWindow) => Promise; /** * Build a hierarchy read: classify, dispatch, refuse the rest. * * Readers own their fetches, guards and rendering; the kit owns the * classification and the ENOENT funnel for every non-file shape. `readers` * holds one reader per leaf kind. `windowed` holds readers for kinds whose * content is windowed at the source (postgres rows take a row limit/offset * the backend pushes into the query); they receive the caller's window, * which every plain reader ignores, matching a filesystem read that has no * row notion. */ export declare function makeRead(detect: DetectFn, readers: Readonly>>, windowed?: Readonly>>): (accessor: A, path: PathSpec, index?: IndexCacheStore, window?: ReadWindow) => Promise; export type RangedReader = (accessor: A, match: ScopeMatch, path: PathSpec, index: IndexCacheStore | undefined, offset: number, size: number | null) => Promise; /** * Build a byte-ranged read over a hierarchy read. * * A rendered file has no remote range to ask for — its bytes do not exist * until the read renders them — so the window is sliced after the fact. A * stored blob does (discord and slack attachments serve HTTP range * requests), and downloading the whole file to keep a slice would defeat the * ranged read; those kinds name a ranged reader in `ranged` and push the * byte window to the source. */ export declare function makeReadRange(detect: DetectFn, read: (accessor: A, path: PathSpec, index?: IndexCacheStore) => Promise, ranged: Readonly>>): (accessor: A, path: PathSpec, index?: IndexCacheStore, options?: { offset?: number; size?: number; }) => Promise; //# sourceMappingURL=read.d.ts.map