Skip to content
Sarj Workspace Sync

workspace-directory/workspace-deployment-fence-repository

@sarj-ai/workspace-sync/workspace-directory/workspace-deployment-fence-repository ยท Source

import type { D1Database } from "@cloudflare/workers-types";
import { z } from "zod";
import { type ActiveResourceLease, type ResourceLeaseAcquisition } from "../identity-sync/resource-lease.ts";
export declare const WORKSPACE_DEPLOYMENT_FENCE_KEY: string & z.$brand<"ResourceLeaseKey">;
export interface WorkspaceDeploymentFenceRepository {
acquire(durationMs: number): Promise<ResourceLeaseAcquisition>;
read(): Promise<ActiveResourceLease | null>;
release(fence: ActiveResourceLease): Promise<void>;
}
/** Coordinates deployment with scheduler admission only; it grants no provider-write authority. */
export declare class D1WorkspaceDeploymentFenceRepository implements WorkspaceDeploymentFenceRepository {
#private;
constructor(database: D1Database, options?: {
readonly clock?: () => number;
readonly ownerIdFactory?: () => string;
});
acquire(durationMs: number): Promise<ResourceLeaseAcquisition>;
read(): Promise<ActiveResourceLease | null>;
release(rawFence: ActiveResourceLease): Promise<void>;
}