import { OpRecord } from './record.ts'; export declare function runWithRecording(fn: () => Promise): Promise<[T, OpRecord[]]>; /** * Run `fn` with `prefix` as the mount prefix records are named against. * * Derives a state for this async branch and shares only the records array, * so two mounts consumed concurrently (`cat /s3/a & cat /db/b`) cannot see * or clobber each other's prefix. Mirrors python's `push_mount_prefix`, * whose `Recorder` is frozen and re-set per task for the same reason. * * Inert (runs `fn` unchanged) when no recording context is active. */ export declare function runWithMountPrefix(prefix: string, fn: () => Promise): Promise; /** * Wrap a stream so `prefix` is the active mount prefix during each pull from * the underlying source. A command may return a stream that defers its * backend read to the first chunk request, by which point the mount's own * scope has already exited, so without this the record lands with no prefix. * Mirrors python's `with_mount_prefix`. */ export declare function withMountPrefix(prefix: string, it: AsyncIterable): AsyncGenerator; export declare function recordingActive(): boolean; export interface RecordOptions { fingerprint?: string | null; revision?: string | null; } /** * A running stopwatch for one op, owned by the record path. * * Opened where the backend work begins and read once when the op * finishes, so an op module hands this around instead of reading a * clock of its own. The wall-clock stamp the record carries is taken at * finish time, not here. Mirrors python's `OpTimer`. */ export declare class OpTimer { private readonly startMs; constructor(); /** Milliseconds elapsed since the timer was opened. */ get elapsedMs(): number; } /** * Open the record path's stopwatch for one op. Hand the timer to * {@link record} or {@link finishRecord} when the op completes. */ export declare function startOp(): OpTimer; /** * Close `timer` and build the finished record. * * The one place an op's duration and wall-clock stamp are read, shared * by the recorder sink ({@link record}) and by the `Ops` facade's own * ledger, so the two cannot disagree about what a duration measures. * `path` is stored as given: a caller that needs mount prefixing * applies it first. */ export declare function finishRecord(op: string, path: string, source: string, nbytes: number, timer: OpTimer, options?: RecordOptions): OpRecord; export declare function record(op: string, path: string, source: string, nbytes: number, timer: OpTimer, options?: RecordOptions): void; export declare function recordStream(op: string, path: string, source: string, options?: RecordOptions): OpRecord | null; /** * Run `fn` inside a revisions context. Backend read functions inside * `fn` (or any async chain it starts) can consult {@link revisionFor} * to look up a pin. Independent of {@link runWithRecording} so that * direct {@link Workspace.dispatch} calls (which don't open a recording * scope) still honour installed pins. * * Task-isolated via AsyncLocalStorage: concurrent runs on different * mounts each see their own pin map. */ export declare function runWithRevisions(revisions: Map | null, fn: () => Promise): Promise; /** * Look up the active revision pin for `path`, or null if no pin is * installed (or no revisions context is active). * * Every live frame's map is searched, because pins are mount state * threaded through the context only for reach: each bind hands over * the mount's own map, keyed by full virtual path, so a hit is never * another task's different pin — the same mount binds the same map, * and another mount's map cannot hold this path. On the fallback * storage this is what keeps a pinned read pinned while an unpinned * op's frame shadows the newest slot. */ export declare function revisionFor(path: string): string | null; //# sourceMappingURL=context.d.ts.map