/**
 * JobLeaseClaimStore — WS4.3 durable, epoch-fenced job-claim leases.
 *
 * (MULTI-MACHINE-SEAMLESSNESS-SPEC §WS4.3, "Cutover discipline".)
 *
 * The journal-backed upgrade of the best-effort `JobClaimManager` bus
 * broadcast. A claim is a LEASE with a fenced ownership epoch: a receiver
 * rejects a stale-epoch claim (invariant-4 epoch fencing), so a demoted
 * machine's late claim cannot steal a job from the current lease-holder, and a
 * partition double-run is structurally prevented when the journal is reachable.
 *
 * Claim records store METADATA ONLY — machine id, job slug, epoch, timestamps —
 * never job payloads (the spec's explicit privacy bound). The store is the
 * local materialized view of the replicated claim kind; the journal carries
 * each record to peers and feeds them back through `applyRemote`.
 *
 * This store does NOT decide WHEN to use the journal path — that is the
 * `JobLeaseCutoverGate`. The store only manages the leases once the gate has
 * selected the journal path.
 */
/** A durable, epoch-fenced job-claim lease. Metadata only. */
export interface JobLeaseClaim {
    /** Unique claim id (idempotency key). */
    claimId: string;
    /** Job slug being leased. */
    jobSlug: string;
    /** Machine id that holds the lease. */
    machineId: string;
    /** The ownership epoch under which the lease was taken (fencing token). A
     *  claim with an epoch older than the latest seen for the slug is stale. */
    epoch: number;
    /** When the lease was taken (ISO 8601). */
    claimedAt: string;
    /** When the lease expires if no completion arrives (ISO 8601). */
    expiresAt: string;
    /** Whether the job completed under this lease. */
    completed: boolean;
    /** Completion result (set on complete). */
    result?: 'success' | 'failure';
    /** When the job completed (ISO 8601). */
    completedAt?: string;
}
export interface JobLeaseClaimStoreConfig {
    /** This machine's id. */
    machineId: string;
    /** State directory (.instar) for persisting the lease ledger. */
    stateDir: string;
    /** Default lease timeout in ms (default: 30 min). */
    defaultLeaseTimeoutMs?: number;
    /** Injectable clock (tests). */
    now?: () => number;
}
/** The verdict of a local claim attempt. */
export type ClaimAttempt = {
    ok: true;
    claim: JobLeaseClaim;
}
/** Another machine holds a live, non-stale lease on this slug. */
 | {
    ok: false;
    reason: 'held-by-peer';
    heldBy: string;
}
/** We already hold a live lease (idempotent re-claim). */
 | {
    ok: false;
    reason: 'already-own';
    claim: JobLeaseClaim;
};
export declare class JobLeaseClaimStore {
    private machineId;
    private claimsDir;
    private defaultLeaseTimeoutMs;
    private now;
    private claims;
    constructor(config: JobLeaseClaimStoreConfig);
    /**
     * Attempt to take a lease on a job at the given ownership epoch.
     *
     * Returns the new lease on success, or a rejection when a peer holds a live,
     * non-stale lease. Idempotent: re-claiming a slug this machine already leases
     * (at the same-or-newer epoch) returns the existing lease.
     */
    tryClaim(jobSlug: string, epoch: number, timeoutMs?: number): ClaimAttempt;
    /** Mark our lease on a slug complete (releases it for the next tick). */
    completeClaim(jobSlug: string, result: 'success' | 'failure'): void;
    /**
     * Apply a claim record received from a peer over the journal. Epoch fencing:
     * a record whose epoch is OLDER than the one we already hold for the slug is
     * rejected (returns false) — a demoted machine's stale claim never overwrites
     * a fresher lease. Returns true if the record was applied.
     */
    applyRemote(record: JobLeaseClaim): boolean;
    /** True if a peer holds a live, non-stale lease on the slug. */
    hasRemoteClaim(jobSlug: string): boolean;
    getClaim(jobSlug: string): JobLeaseClaim | undefined;
    getActiveClaims(): JobLeaseClaim[];
    getAllClaims(): JobLeaseClaim[];
    /** Remove expired (uncompleted past expiry) + old completed records. */
    pruneExpired(): number;
    private isExpired;
    private load;
    private save;
}
//# sourceMappingURL=JobLeaseClaimStore.d.ts.map