import { type WorldLockOptions } from './world-store.js'; export declare const canonicalStatePath: (path: string) => string; /** A World folder moved or copied elsewhere is that World, opened where it now is (architecture, "A World is an install", * marks and branches included): a path its records hold under the folder they were written in is read under the folder * `readFrom` lies in. `recorded` is one of the record's paths known to be the reader's own (a history view's owner * directory); null where the folder has not moved. A path under another folder is another World's, read as recorded. */ export declare function movedStatePaths(recorded: string, readFrom: string): ((path: string) => string) | null; /** Synchronous only; use exclusive acquisition without age-stealing a live owner. * The coordinator lives outside service, instance and hosted World deletion trees. It is held only for ancestry * bookkeeping (generations, pins, branch pointers, removal receipts) and the not-being-removed check: every World * sharing the VOLTER_HOME waits on it, so no append, fold or caller's critical section runs inside it, and no state lock * is taken inside it (`withStateLock` takes its lock first). */ export declare function withAncestryLock(fn: () => T, options?: WorldLockOptions): T; /** Run `fn` holding the cross-process lock at `lockPath`, a lock of the directory it sits in: taken first, then the * coordinator only to check that the directory is not being removed. Re-entrant within a process. */ export declare function withStateLock(lockPath: string, fn: () => T, options?: WorldLockOptions): T; /** A state directory's history lock: its appends, captures, observation batches and folds. A branch's is taken before * its ancestors'. */ export declare function withHistoryLock(directory: string, fn: () => T, options?: WorldLockOptions): T; /** Several sibling directories' history locks at once (a World's services, a changeset's targets), in one order. */ export declare function withHistoryLocks(directories: string[], fn: () => T, options?: WorldLockOptions): T; /** Create an identity only for an existing parent. A recreated path gets a new identity. */ export declare function stateGeneration(dir: string): string; /** Must be called in the same critical section as child pointer publication. A crash before * publication leaves a pending pin; it can be ignored only once its writer is provably dead. */ export declare function pinParent(parentDir: string, child: string, expected?: string): string; /** Mark publication complete only after branch.json exists. */ export declare function commitParentPin(parentDir: string, child: string): void; /** Read-only identity validation. */ export declare function checkParent(parentDir: string, expected?: string): void; /** Caller holds the coordinator through the actual deletion. A committed pin with missing * child metadata is uncertainty, not permission: only explicit child removal releases it. */ export declare function assertStateRemovable(path: string): void; export declare function assertNotBeingRemoved(path: string): void; /** The coordinator is held to decide and record removal (`check`, the caller's own precondition, runs there too) * and to release it, not through the * deletion: every World on the machine shares the coordinator, and a large tree's deletion outlasts their writes' * patience. The receipt, written first, keeps the path from being pinned or locked while it is deleted; the deletion * then waits on each lock inside the tree in turn, so a holder that checked before the receipt finishes first. */ export declare function withStateRemoval(path: string, remove: () => T, check?: () => void): T;