@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
70 lines • 3.26 kB
TypeScript
import type { FileStat } from '../../types.ts';
import type { Clock } from '../../utils/clock.ts';
import { type Evicted, type ListResult, type LookupResult, type SetDirOptions } from './config.ts';
import { IndexCacheStore } from './store.ts';
export declare class RAMIndexCacheStore extends IndexCacheStore {
readonly ttl: number;
private readonly entryMap;
private readonly children;
private readonly folderFlags;
private readonly expiry;
private readonly partial;
private readonly windowed;
private readonly tombstones;
private readonly versions;
private observation;
private readonly lock;
constructor(options?: {
ttl?: number;
clock?: Clock;
});
seed(entries: ReadonlyMap<string, FileStat>, children: ReadonlyMap<string, readonly string[]>, expiresAt: Date, version?: string | null): void;
private stamp;
entries(): Promise<Map<string, FileStat>>;
get(vfsPath: string): Promise<LookupResult>;
put(vfsPath: string, entry: FileStat): Promise<void>;
addEntry(vfsPath: string, entry: FileStat, expiredAt?: Date | null): Promise<void>;
replaceIfUnchanged(path: string, predecessor: string, entry: FileStat): Promise<boolean>;
listDir(vfsPath: string, child?: string): Promise<ListResult>;
setDir(vfsPath: string, entries: readonly [string, FileStat][], expiredAt?: Date | null, options?: SetDirOptions): Promise<Evicted[]>;
setPartialDir(vfsPath: string, entries: readonly [string, FileStat][], expiredAt?: Date | null): Promise<void>;
private storeDir;
/** Drop a child a complete listing no longer names. */
private evict;
private bury;
private rememberDirectory;
refillToken(): Promise<string>;
invalidateMissing(paths: readonly string[]): Promise<boolean>;
refillDir(path: string, entries: readonly [string, FileStat][], token: string, expiredAt?: Date | null, options?: SetDirOptions & {
partial?: boolean;
}): Promise<Evicted[] | null>;
invalidateEntry(vfsPath: string): Promise<void>;
invalidateDir(vfsPath: string): Promise<void>;
invalidatePrefix(vfsPath: string, excluded?: readonly string[], remember?: boolean): Promise<void>;
holdsSubtree(vfsPath: string): Promise<boolean>;
private dropPrefix;
invalidate(): Promise<void>;
clear(): Promise<void>;
}
/**
* The empty, throwaway store a `read: fresh` check stats through.
*
* The listing gate and the read probe pass it to say a request is what they
* want. A root stat asks the backend for its head only through this store.
* Through any other index it names no version and reads nothing, so a getattr
* of the root never sends a request or reads the index. A backend that lists
* a parent to answer a miss may ask for the one path instead, since the store
* is dropped right after.
*
* Mirrors Python's `ListingCheckStore`.
*/
export declare class ListingCheckStore extends RAMIndexCacheStore {
readonly hintedRows: Map<string, string>;
private readonly hints;
constructor(options?: {
hints?: IndexCacheStore;
});
/** Offer the mount row as a lead that the backend must confirm live. */
hint(vfsPath: string): Promise<FileStat | null>;
}
//# sourceMappingURL=ram.d.ts.map