@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.65 kB
TypeScript
import type { FileStat } from '../../types.ts';
import type { IndexCacheStore } from './store.ts';
/**
* Resolve an index entry, listing the parent directory once when its listing
* is missing or expired.
*
* Id-addressed backends (Drive, Box, Dropbox, Gmail) can only turn a path into
* an id through the index, so a cold lookup has to warm it from the parent's
* listing and retry. Every such backend had grown its own copy of that block;
* this is the one place that decides what a failed listing means.
*
* A missing parent listing does not prove a retained entry is current: a
* partial warm may have stored the child without publishing freshness. Such
* a child is dropped before the refresh. A fresh partial listing proves only
* the children it names; an omitted child still refreshes.
* A parent that is simply absent is not an error here — the caller reports
* ENOENT against the operand, which is the
* path GNU names (`rm nodir/f` says "cannot remove 'nodir/f'", not "nodir").
* Every other failure propagates: an expired token or a dropped connection
* reported as "no such file" both misdiagnoses the fault and hides that it is
* worth retrying.
*
* Mirrors Python's entry_or_warm.
*
* @param index - the index to read, and to warm through `warm`.
* @param virtualKey - the index key being resolved.
* @param warm - lists the parent directory, populating the index; null when
* the key has no distinct parent to list.
*/
export declare function entryOrWarm(index: IndexCacheStore, virtualKey: string, warm: (() => Promise<unknown>) | null): Promise<FileStat | null>;
//# sourceMappingURL=warm.d.ts.map