export interface AsyncStorage { run(store: T, fn: () => R | Promise): R | Promise; getStore(): T | undefined; /** * Every store bound by a live `run`, oldest first. * * On an isolating runtime that is the current task's store alone, * because `AsyncLocalStorage` cannot enumerate other tasks and the * isolated world never needs it to. On the fallback it is the honest * answer the single slot cannot give — all concurrently live * bindings — so a reader can merge conservatively instead of * trusting whichever binding happens to sit in the slot. The array * is a snapshot; it does not track later binds or settles. */ liveStores(): readonly T[]; } /** * The browser storage: no task isolation, one frame stack per storage. * * `getStore` answers the newest live frame, so a read that interleaves * with another task's bind can still see that task's store — only real * isolation fixes that, which is what `liveStores` exists to route * around. What the stack does fix is the slot's two worse failures: a * settle removes its own frame rather than blind-restoring a saved * value, so an out-of-order settle can neither wipe a binding that is * still live nor strand a stale one after every run has finished. * * Exported for the fallback-mode tests, which mock `createAsyncContext` * with this class so the browser branch runs under node's test runner. */ export declare class FallbackStorage implements AsyncStorage { private frames; run(s: T, fn: () => R | Promise): R | Promise; getStore(): T | undefined; liveStores(): readonly T[]; } /** * Whether the storage isolates concurrent tasks, verified behaviorally * at module load rather than assumed from where the constructor came * from. * * `AsyncLocalStorage` gives every task its own store. The fallback is * one frame stack whose top a concurrent task can shadow, so a caller * that binds a store for concurrent work has to know which it got. */ export declare const asyncContextIsolatesTasks: boolean; export declare function createAsyncContext(): AsyncStorage; //# sourceMappingURL=async_context.d.ts.map