@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
76 lines • 3.99 kB
TypeScript
import type { FileStat } from '../../types.ts';
import type { FileCacheMixin } from '../file/mixin.ts';
import { type Evicted, type IndexSnapshot, type ListResult, type LookupResult, type SetDirOptions } from './config.ts';
import { IndexCacheStore } from './store.ts';
/** A mount-owned index view; delayed backend writes retain their original owner. */
export declare class IndexView extends IndexCacheStore {
private readonly inner;
private readonly cache;
private readonly prefix;
private readonly owns;
private unverified;
private readonly locked;
private readonly readTtl;
private readonly onGone;
private readonly mayServeListing;
private readonly excludedPrefixes;
private readonly noteWritten;
private readonly commandListed;
constructor(inner: IndexCacheStore, cache: FileCacheMixin, prefix: string, owns: (path: string) => boolean, options?: {
readonly excludedPrefixes?: () => readonly string[];
/**
* Skip the non-reentrant mutation lock already held by the caller.
* The view must not outlive that hold.
*/
readonly locked?: boolean;
/** The mount's cleanup for a child a re-list found gone. */
readonly onGone?: (gone: readonly Evicted[]) => Promise<void>;
/** Seconds a listing may live under this mount; unset means no cap. */
readonly readTtl?: number;
/**
* The mount's listing gate, asked before a cached listing is served;
* unset serves every cached listing.
*/
readonly mayServeListing?: (folder: string, version: string | null) => Promise<boolean>;
/** Told each folder whose listing this view has just written. */
readonly noteWritten?: (folder: string) => void;
/** Whether the running command fetched a folder's listing; unset answers false. */
readonly listedThisCommand?: (folder: string) => boolean;
});
listedThisCommand(folder: string): boolean;
/** The store this view writes through. */
get store(): IndexCacheStore;
get ttl(): number;
private fence;
/** Cap the expiry, preserving the store default when it is shorter. */
private deadline;
/** Shorten an explicit expiry to this mount's bound. */
private cap;
scopeSnapshot(snapshot: IndexSnapshot): IndexSnapshot;
seed(entries: ReadonlyMap<string, FileStat>, children: ReadonlyMap<string, readonly string[]>, expiresAt: Date, version?: string | null): void;
entries(): Promise<Map<string, FileStat>>;
getMany(vfsPaths: readonly string[]): Promise<Map<string, FileStat>>;
get(path: string): Promise<LookupResult>;
listDir(path: string, child?: string): Promise<ListResult>;
private fencedListDir;
put(path: string, entry: FileStat): Promise<void>;
addEntry(path: string, entry: FileStat, expiredAt?: Date | null): Promise<void>;
replaceIfUnchanged(path: string, predecessor: string, entry: FileStat): Promise<boolean>;
setDir(path: string, entries: readonly [string, FileStat][], expiredAt?: Date | null, options?: SetDirOptions): Promise<Evicted[]>;
setPartialDir(path: string, entries: readonly [string, FileStat][], expiredAt?: Date | null): Promise<void>;
private storeDir;
private noted;
reportGone(gone: readonly Evicted[]): Promise<void>;
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(path: string): Promise<void>;
invalidatePrefix(path: string, excluded?: readonly string[], remember?: boolean): Promise<void>;
holdsSubtree(path: string): Promise<boolean>;
invalidate(): Promise<void>;
clear(): Promise<void>;
}
//# sourceMappingURL=view.d.ts.map