import type { Accessor } from '../accessor/base.ts';
import { PathSpec, type ReadBytesFn, type ReadStreamFn } from '../types.ts';
import type { IndexCacheStore } from './index/store.ts';
type OpStream = ReadStreamFn<[
accessor: A,
path: PathSpec,
index?: IndexCacheStore
]>;
type OpBytes = ReadBytesFn<[
accessor: A,
path: PathSpec,
index?: IndexCacheStore
]>;
type PathStream = ReadStreamFn;
/**
* Wrap a backend `readStream` op (factory shape) so warm reads serve
* cached bytes. Keeps the `(accessor, path, index?)` signature, a drop-in
* for the raw op the factory injects. On a warm hit it yields the whole
* cached blob as one chunk; otherwise it streams from the backend. The
* manager is read when the op is called (inside the command's cache scope),
* not lazily at drain time. No-op for local or non-caching mounts.
*/
export declare function cacheAwareReadStream(raw: OpStream): OpStream;
/** Wrap a backend `readBytes` op (factory shape) for warm read-through. */
export declare function cacheAwareReadBytes(raw: OpBytes): OpBytes;
/**
* Wrap a path-keyed stream reader (the shape generics receive) for warm
* read-through, reading the manager when the reader is called. Used by
* grep/rg, whose consumers invoke the reader inside the command scope.
*/
export declare function cacheAwareStream(raw: PathStream): PathStream;
/**
* Wrap a path-keyed stream reader for warm read-through, capturing the
* active manager **eagerly** when this wrapper is applied. Used by
* head/tail/wc, whose multi-file consumers drain lazily after the mount's
* cache scope is gone, so reading the manager at drain time would always
* miss. Apply inside the command's scope (the consumers do) so the
* captured manager travels with the stream.
*/
export declare function cacheAwareStreamEager(raw: PathStream): PathStream;
export {};
/**
* Return the first `n` cached bytes of `path` when warm, else null. Lets a
* range-read fast path (e.g. `head -c N`) serve from a fully cached file
* without a partial backend fetch. `n = null` returns the whole cached blob.
*/
//# sourceMappingURL=read_through.d.ts.map