UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

76 lines • 3.47 kB
import { RedisAccessor } from '../../accessor/redis.ts'; import type { ByteSource } from '../../io/types.ts'; import type { CapacityResult, FileStat, PathSpec, SetAttrFields } from '../../types.ts'; import { BaseVFS } from '../base.ts'; import { type StorageUsage } from '../capacity.ts'; import { REDACTED_SECRET } from '../secrets.ts'; import type { Handed } from '../types.ts'; import { type VFSStateBase } from '../types.ts'; import type { RedisStoreLike } from './store.ts'; export interface RedisVFSState { type: string; config: { url: typeof REDACTED_SECRET; keyPrefix: string; capacity?: number; }; keyPrefix: string; files: Record<string, Uint8Array>; dirs: string[]; attrs?: Record<string, Record<string, string>>; modified?: Record<string, string>; } /** * A redis keyspace mounted as a filesystem, over whatever store it is given. * * The runtime packages subclass this as `RedisVFS`, only to build the store: node opens a * RESP client from a redis URL, the browser speaks Upstash's REST shape over * fetch. Everything a mount does, ops table and commands included, lives here * once, because none of it depends on the transport. */ export declare class RedisVFS extends BaseVFS { readonly name: string; readonly cachesReads: boolean; readonly sizesAlwaysKnown: boolean; readonly indexTtl: number; readonly store: RedisStoreLike; readonly accessor: RedisAccessor; readonly usage: StorageUsage | null; /** * `capacity` is the most bytes the mount's files may hold, a size like * `100MB` or a count of bytes; null for no limit. Counted at the first * write or `df`; a writer in another process is counted at the next `df`. * * @throws VFSConfigError when `capacity` is not a size. */ constructor(store: RedisStoreLike, capacity?: number | string | null); private charge; get url(): string; get keyPrefix(): string; storageLocation(): string; close(): Promise<void>; readonly readsRanges: boolean; readonly local: boolean; readTree(path: PathSpec): Promise<Map<string, FileStat> | null>; readdir(path: PathSpec): Promise<FileStat[]>; read(path: PathSpec, _handed?: Handed, offset?: number, size?: number | null): Promise<ByteSource> | AsyncIterable<Uint8Array>; stat(path: PathSpec): Promise<FileStat>; exists(path: PathSpec): Promise<boolean>; write(path: PathSpec, data: ByteSource, _signal?: AbortSignal, _handed?: Handed, atomic?: boolean): Promise<void>; append(path: PathSpec, data: ByteSource): Promise<void>; create(path: PathSpec): Promise<void>; mkdir(path: PathSpec, parents?: boolean): Promise<void>; unlink(path: PathSpec): Promise<void>; rmdir(path: PathSpec): Promise<void>; rmR(path: PathSpec): Promise<void>; rename(src: PathSpec, dst: PathSpec): Promise<void>; copy(src: PathSpec, dst: PathSpec): Promise<void>; truncate(path: PathSpec, length: number, noCreate?: boolean): Promise<void>; /** The mount's own quota when capped, counted afresh so a writer in * another process shows; else the server's memory. Mirrors Python's. */ capacity(): Promise<CapacityResult>; setattr(path: PathSpec, fields: SetAttrFields): Promise<Record<string, number | string>>; getState(): Promise<RedisVFSState>; loadState(state: VFSStateBase & Partial<RedisVFSState>): Promise<void>; } //# sourceMappingURL=redis.d.ts.map