@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
38 lines • 1.73 kB
TypeScript
import type { S3Config } from '../../vfs/s3/config.ts';
/**
* One JSON-record-per-object client with ETag-anchored CAS.
*
* The generic building block both S3 stores share (mirroring how the
* Redis stores share one cas.lua): a record is one object at
* `{prefix}{name}.json`, and a conditional write anchors on the exact
* ETag the compare-read returned, so the generation check and the
* write hit the same stored version. Immutable-blob planes never need
* this; it exists only for the few mutable control-plane cells.
* Mirrors the Python S3RecordClient.
*/
export declare class S3RecordClient {
private readonly config;
private readonly prefix;
private clientPromise;
constructor(config: S3Config, prefix: string);
private client;
key(name: string): string;
/** Read one record; `[fields, etag]`, `[null, '']` when absent. */
get(name: string): Promise<[Record<string, unknown> | null, string]>;
put(name: string, fields: Record<string, unknown>): Promise<void>;
/**
* Write one record iff its stored generation matches.
*
* Compare-read the record, check the generation client-side, then
* make the write conditional on the exact version read: If-None-Match
* for create (expected 0, nothing stored), If-Match on the read ETag
* otherwise. A 412/409 means another writer moved the record between
* our read and write; the caller adopts and retries.
*/
casPut(name: string, fields: Record<string, unknown>, expectedGeneration: number): Promise<boolean>;
listNames(): Promise<string[]>;
delete(names: readonly string[]): Promise<void>;
clear(): Promise<void>;
close(): Promise<void>;
}
//# sourceMappingURL=s3.d.ts.map