import BackgroundJobsAdapter from "./adapter.js"; import LocalBackgroundJobsDispatcher from "./local-dispatcher.js"; import LocalBackgroundJobRegistry from "./local-job-registry.js"; import LocalBackgroundJobsStore from "./local-store.js"; /** Durable local SQLite adapter with an owned in-process dispatcher. */ export default class LocalBackgroundJobsAdapter extends BackgroundJobsAdapter { clock: import("./types.js").LocalBackgroundJobsClock; configuration: import("../configuration.js").default; registry: LocalBackgroundJobRegistry; store: LocalBackgroundJobsStore; dispatcher: LocalBackgroundJobsDispatcher; /** * Creates a local adapter for one configuration and database. * @param {object} args - Adapter options. * @param {import("../configuration.js").default} args.configuration - Owning configuration. * @param {import("./types.js").LocalBackgroundJobsClock} [args.clock] - Injectable clock. * @param {string} [args.databaseIdentifier] - Local database identifier. */ constructor({ configuration, clock, databaseIdentifier }: { configuration: import("../configuration.js").default; clock?: import("./types.js").LocalBackgroundJobsClock; databaseIdentifier?: string; }); /** * Ensures that local persistence and dispatch are ready. * @returns {Promise} - Resolves when local dispatch is ready. */ ensureReady(): Promise; /** * Stops local dispatch gracefully. * @returns {Promise} - Resolves after graceful local shutdown. */ close(): Promise; /** * Reports local dispatcher health. * @returns {Promise} - Local adapter health. */ health(): Promise; /** * Reconciles configuration-derived queue concurrency caps. * @returns {Promise} - Resolves after queue cap reconciliation. */ reconcileQueueConcurrency(): Promise; /** * Enqueues one statically registered local job. * @param {{jobName: string, args: Array>, options?: import("./types.js").BackgroundJobOptions}} args - Enqueue request. * @returns {Promise} - Durable local job id. */ enqueue(args: { jobName: string; args: Array>; options?: import("./types.js").BackgroundJobOptions; }): Promise; /** * Cancels or detaches the current owner of a stable schedule key. * @param {string} scheduleKey - Stable schedule key. * @returns {Promise} - Cancellation result. */ cancelScheduled(scheduleKey: string): Promise; /** * Replaces the current owner of a stable schedule key. * @param {{scheduleKey: string, jobName: string, args: Array>, options?: import("./types.js").BackgroundJobOptions}} args - Replacement request. * @returns {Promise} - Replacement result. */ replaceScheduled(args: { scheduleKey: string; jobName: string; args: Array>; options?: import("./types.js").BackgroundJobOptions; }): Promise; /** * Reads stable ownership and optional terminal history. * @param {string} scheduleKey - Stable schedule key. * @param {{includeLatestTerminal?: boolean}} [options] - Lookup options. * @returns {Promise} - Normalized local jobs. */ getScheduledJob(scheduleKey: string, options?: { includeLatestTerminal?: boolean; }): Promise; /** * Makes a future queued stable owner due without replacing it. * @param {string} scheduleKey - Stable schedule key. * @returns {Promise} - Exact wake result. */ wakeScheduled(scheduleKey: string): Promise; /** * Finds the next eligible local job. * @returns {Promise} - Next eligible job. */ nextAvailableJob(): Promise; /** * Finds the next future local job. * @returns {Promise} - Next future job. */ nextScheduledJob(): Promise; /** * Finds a local job by id. * @param {string} jobId - Job id. * @returns {Promise} - Persisted job. */ getJob(jobId: string): Promise; /** * Lists local jobs in insertion order. * @returns {Promise} - Local jobs. */ listJobs(): Promise; /** * Claims one queued local job. * @param {import("./types.js").BackgroundJobHandoffRequest} args - Claim request. A supplied handoff id is persisted exactly. * @returns {Promise} - Handoff. */ markHandedOff(args: import("./types.js").BackgroundJobHandoffRequest): Promise; /** * Finds active local handoffs owned by one worker. * @param {{workerId: string}} args - Worker identity. * @returns {Promise>} - Active worker handoffs. */ handedOffJobsForWorker(args: { workerId: string; }): Promise>; /** * Returns an exact active local handoff to the queue. * @param {{jobId: string, handoffId: string}} args - Handoff release. * @returns {Promise} - Resolves after the fenced release. */ markReturnedToQueue(args: { jobId: string; handoffId: string; }): Promise; /** * Acknowledges successful local job completion. * @param {{jobId: string, handoffId?: string}} args - Completion report. * @returns {Promise} - Whether accepted. */ markCompleted(args: { jobId: string; handoffId?: string; }): Promise; /** * Records pooled-child acceptance evidence for a local handoff. * @param {{jobId: string, handoffId?: string, receivedAtMs?: number, startedAtMs?: number, childInstanceId?: string, childPid?: number}} args - Acceptance report. * @returns {Promise} - Whether accepted. */ markChildAccepted(args: { jobId: string; handoffId?: string; receivedAtMs?: number; startedAtMs?: number; childInstanceId?: string; childPid?: number; }): Promise; /** * Acknowledges an explicit local reschedule. * @param {{jobId: string, delayMs: number, handoffId?: string}} args - Reschedule report. * @returns {Promise} - Whether accepted. */ markRescheduled(args: { jobId: string; delayMs: number; handoffId?: string; }): Promise; /** * Acknowledges a failed local performance. * @param {{jobId: string, error: ReturnType, handoffId?: string}} args - Failure report. * @returns {Promise} - Transition. */ markFailed(args: { jobId: string; error: ReturnType; handoffId?: string; }): Promise; /** * Coalesces a dispatcher wake. * @returns {void} - No return value. */ wake(): void; /** * Waits until current local work has been acknowledged. * @returns {Promise} - Resolves after all current work is acknowledged. */ waitForIdle(): Promise; } //# sourceMappingURL=local-adapter.d.ts.map