/**
 * RollbackUnmerge — deterministic origin-drop un-merge with no dangling references
 * (WS2 replicated-store foundation, Component 6 / §7.4).
 *
 * Spec: docs/specs/multi-machine-replicated-store-foundation.md §7.4 (disabling
 * stateSync.<store> for a peer atomically DROPS that origin's foreign namespace —
 * a real un-merge, not a flag; the union recomputes live; the dropped streams +
 * per-peer meta + snapshot cache are QUARANTINED-ASIDE, reversible + auditable,
 * NEVER a destructive delete; no dangling references; a conflictId whose
 * version-pair referenced the dropped origin auto-RESOLVES + its attention item
 * closes), §11 (machine-local-by-design — a machine un-merges ITS OWN copy of a
 * peer's namespace, never reaches into the peer).
 *
 * THE LIVE-RECOMPUTE INVARIANT (why this is a real un-merge, §7.4 step 1+3).
 * Because records are keyed by (recordKey, origin) and the union reader computes
 * the union LIVE from the per-origin namespaces, REMOVING an origin from the set
 * of participating namespaces instantly removes its contribution — no rewrite of
 * any surviving record is needed. A key whose winning value came from the dropped
 * origin reverts to the HLC-latest among the REMAINING origins (or to "no record"
 * if none remains). The DroppedOriginRegistry is the live exclusion set the
 * union reader consults; the quarantine-aside is the durability/reversibility leg.
 *
 * QUARANTINE-ASIDE (§7.4 step 2 — NEVER a destructive delete). The dropped
 * origin's replica streams + per-peer meta + snapshot-cache entries are RENAMED
 * aside (rename is non-destructive: node:fs renameSync, mirroring
 * JournalSyncApplier.quarantineReplica) into a bounded-retain ring; the ONLY
 * actual deletion — pruning the oldest retained un-merge past the ring bound —
 * goes through SafeFsExecutor.safeRmSync (the destructive-fs funnel + audit
 * trail). A re-merge restores from the ring (reversibility).
 */
/** How many un-merge quarantine sets to retain per (store, origin) before the
 *  oldest is pruned (mirrors JournalSyncApplier.MAX_QUARANTINE_PER_STREAM). */
export declare const MAX_UNMERGE_RETAIN = 2;
/** Persistent record of which (store, origin) pairs are currently un-merged. The
 *  union reader consults this so a dropped origin is excluded LIVE — the
 *  un-merge survives restarts. */
export interface DroppedOriginEntry {
    store: string;
    origin: string;
    droppedAt: string;
}
/** The durable set of un-merged (store, origin) pairs. Consulted by the union
 *  reader's participating-namespace filter (§7.4). */
export declare class DroppedOriginRegistry {
    private readonly stateDir;
    private readonly readFileSync;
    private readonly existsSync;
    private doc;
    constructor(seams: {
        stateDir: string;
        readFileSync?: (p: string) => string;
        existsSync?: (p: string) => boolean;
    });
    private docPath;
    private load;
    private persist;
    /** Is (store, origin) currently un-merged (excluded from the union)? */
    isDropped(store: string, origin: string): boolean;
    /** The set of dropped origins for a store (for the reader's namespace filter). */
    droppedOrigins(store: string): Set<string>;
    add(store: string, origin: string, at: string): void;
    remove(store: string, origin: string): void;
    list(): DroppedOriginEntry[];
}
/** The seams RollbackUnmerge needs from the journal/applier (DI'd for testability). */
export interface RollbackUnmergeSeams {
    /** Absolute path to the peers/ replica directory
     *  (`<stateDir>/state/coherence-journal/peers`). */
    peersDir: () => string;
    /** The journal kinds a store rides (so we move every replica stream for it). */
    kindsForStore: (store: string) => string[];
    /** Injected wall clock. */
    now: () => Date;
    /** Drop every snapshot-cache entry for the origin (§7.4 step 2 — the cache leg).
     *  Wired to SnapshotCache.dropOrigin. */
    dropSnapshotCacheForOrigin: (origin: string) => void;
    /** Auto-resolve conflicts referencing the dropped origin (§7.4) — returns the
     *  closed conflictIds. Wired to ConflictStore.autoResolveForDroppedOrigin. */
    autoResolveConflicts: (origin: string) => string[];
    /** Close an attention item for a conflictId (signal-only; idempotent). */
    closeAttention?: (conflictId: string) => void;
    /** Optional fs seams (tests); default node:fs. */
    existsSync?: (p: string) => boolean;
    readdirSync?: (p: string) => string[];
    renameSync?: (from: string, to: string) => void;
    /** Optional structured logger (default no-op). */
    log?: (event: string, detail: Record<string, unknown>) => void;
}
/** Result of an un-merge (§7.4) — auditable. */
export interface UnmergeResult {
    store: string;
    origin: string;
    /** Replica stream files quarantined-aside. */
    movedStreams: number;
    /** Per-peer meta files quarantined-aside. */
    movedMeta: number;
    /** Conflict ids auto-resolved because they referenced the dropped origin. */
    closedConflicts: string[];
    at: string;
}
/**
 * RollbackUnmerge — drops a (store, origin) from the union deterministically
 * (§7.4). The order matters:
 *  1. Register the drop in DroppedOriginRegistry FIRST — the union recomputes
 *     live, so from this instant every read excludes the origin (no dangling refs).
 *  2. Quarantine-aside the replica streams + per-peer meta + snapshot cache
 *     (rename + bounded-retain; reversible, auditable; the prune leg through
 *     SafeFsExecutor).
 *  3. Auto-resolve every conflict that referenced the dropped origin + close its
 *     attention item.
 * Reversible: reMerge() restores the registry entry + the most-recent quarantined
 * streams.
 */
export declare class RollbackUnmerge {
    private readonly registry;
    private readonly seams;
    private readonly existsSync;
    private readonly readdirSync;
    private readonly renameSync;
    private readonly log;
    constructor(registry: DroppedOriginRegistry, seams: RollbackUnmergeSeams);
    /** Un-merge (store, origin) — §7.4. Idempotent: a re-call after the drop is a
     *  no-op for the registry but still re-attempts any leftover quarantine. */
    unmergeOrigin(store: string, origin: string): UnmergeResult;
    /** Re-merge (reversibility, §7.4): remove the drop + restore the MOST RECENT
     *  quarantined streams/meta for (store, origin). Returns the count restored. */
    reMerge(store: string, origin: string): {
        restored: number;
    };
    /** Prune retained un-merge sets past MAX_UNMERGE_RETAIN per base (the ONLY
     *  destructive leg — through SafeFsExecutor, audited). */
    private pruneRetained;
}
//# sourceMappingURL=RollbackUnmerge.d.ts.map