/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Timestamp } from "#time/Timestamp.js";
import { Lifetime } from "./Lifetime.js";
import { MaybePromise } from "./Promises.js";
import { Semaphore } from "./Semaphore.js";
/**
 * Task scheduler.
 *
 * Runs workers at a designated time.
 */
export declare class Scheduler<T> {
    #private;
    constructor({ name, lifetime, timeOf, run, semaphore, }: Scheduler.Configuration<T>);
    /**
     * Schedule a worker.
     */
    add(worker: T): void;
    /**
     * Unschedule a worker.
     */
    delete(worker: T): void;
    /**
     * Update a worker's scheduled run time.
     */
    reschedule(worker: T): void;
    /**
     * Close.
     *
     * Stops accepting workers.  Returns when all workers are complete.
     */
    close(): Promise<void>;
}
export declare namespace Scheduler {
    interface Configuration<T> {
        /**
         * Name used for diagnostics.
         *
         * Defaults to "scheduler".
         */
        name?: string;
        /**
         * Owner lifetime.
         *
         * Defaults to process.
         */
        lifetime?: Lifetime.Owner;
        /**
         * Identify the scheduled time for a specific worker.
         */
        timeOf(worker: T): Timestamp;
        /**
         * Execute a worker.
         */
        run(worker: T, abort: AbortSignal): MaybePromise<void>;
        /**
         * If present, controls worker concurrency.
         *
         * Providing the semaphore here rather than using it within the worker prevents the worker from starting when no
         * queue slot is available.
         */
        semaphore?: Semaphore;
    }
}
//# sourceMappingURL=Scheduler.d.ts.map