/** * io/block-cache.ts * * Byte-budget LRU block cache with in-flight request dedupe and sequential * read-ahead. Environment-free: the actual byte source is injected, so this * runs (and is tested) anywhere. Used by the broker as the cache shared by * every decode worker. */ /** Fetches [start, end) of a registered file. */ export type FetchRange = (fileKey: string, start: number, end: number) => Promise; export interface BlockStoreOptions { blockSize: number; maxBytes: number; readAhead: number; fetchRange: FetchRange; } export declare class BlockStore { private readonly opts; /** LRU via Map insertion order: oldest entry first. */ private blocks; private inflight; private sizes; private lastBlock; private totalBytes; constructor(opts: BlockStoreOptions); /** Register (or update) the byte length of a file. */ setFileSize(fileKey: string, size: number): void; /** Bytes currently held by cached blocks (excludes in-flight fetches). */ get cachedBytes(): number; /** * Get one block, from cache or by (deduped) fetch. Sequential access * triggers read-ahead of the following blocks. */ getBlock(fileKey: string, blockIndex: number): Promise; /** Drop all state for a file. In-flight fetches settle harmlessly. */ releaseFile(fileKey: string): void; private fetchBlock; private insert; private scheduleReadAhead; } //# sourceMappingURL=block-cache.d.ts.map