import { PathSpec } from '../types.ts'; /** * What this module needs from a cache manager. `CacheManager` in * `cache/manager.ts` satisfies this structurally; this module never * imports it, keeping the dependency one-way: core mutators -> * cache/context <- mount (which installs a manager). */ export interface CacheInvalidator { invalidateAfterWrite(path: string | PathSpec): Promise; invalidateAfterUnlink(path: string | PathSpec): Promise; invalidateSubtree(path: string | PathSpec): Promise; cachedBytes(path: PathSpec): Promise; } /** * Run `fn` with `manager` active for the current async context. * Mirrors `runWithRevisions`: the mount entry point wraps command * dispatch, core backend mutators report through * {@link invalidateAfterWrite} / {@link invalidateAfterUnlink}. */ export declare function runWithCacheManager(manager: CacheInvalidator | null, fn: () => Promise): Promise; /** * Return the active cache manager for the current async context. * * Serves the read-through paths, so a wrong manager is worse than * none: a warm hit from another mount's cache is another mount's * bytes, where a miss just reads the backend. On an isolating runtime * one binding is live and answers as bound; on the fallback storage * the manager answers only while every live frame agrees on it, and a * disagreement (overlapping commands on different mounts) reads as no * manager, failing toward the cold read. */ export declare function activeCacheManager(): CacheInvalidator | null; /** * Report a backend write so caches are invalidated at the mutation * site. No-op if no cache manager is active. */ export declare function invalidateAfterWrite(path: string | PathSpec): Promise; /** * Report a backend deletion so caches are invalidated at the mutation * site. No-op if no cache manager is active. */ export declare function invalidateAfterUnlink(path: string | PathSpec): Promise; /** * Report a backend deletion that took a whole subtree with it. * * `invalidateAfterUnlink` evicts the path's own listing and its * parent's, which is the whole story for a file. A recursive delete or a * directory rename also strands every listing and every cached body * *below* the path, and those were cached under their own keys, so * nothing above them evicts one: `ls` kept printing a deleted * directory's contents and `cat` kept serving a deleted file's bytes * until the index TTL expired. * * Unlike {@link invalidateAncestors}, this cannot be assembled from * `invalidateAfterWrite` calls, because the set of keys beneath the path * is only known to the caches themselves. */ export declare function invalidateSubtree(path: string | PathSpec): Promise; /** * Evict every ancestor directory listing of `path`. * * A single invalidateAfterWrite only refreshes the immediate parent * listing. When an op materializes several missing levels at once * (`mkdir -p a/b/c`, a bucket write that creates parents), the higher * ancestors' cached listings stay stale and hide the new entries until * the index TTL expires. Walking the chain refreshes each one. */ export declare function invalidateAncestors(path: PathSpec): Promise; //# sourceMappingURL=context.d.ts.map