/** * SemaphorePermit - Represents a held permit in a distributed semaphore. * Analogous to Lock for mutex operations. */ import { LockSignal } from "../core/types"; export interface SemaphorePermitManager { extend: (permit: SemaphorePermit, ttl: number) => Promise<{ success: boolean; expiration: number; }>; release: (permit: SemaphorePermit) => Promise<{ success: boolean; remainingCount: number; }>; } export interface RequiredSemaphoreInternalOptions { ttl: number; autoExtendThreshold: number; } export declare class SemaphorePermit { readonly resource: string; readonly identifier: string; private readonly permitManager; private readonly options; private _expiration; private _extensions; private _released; private readonly acquisitionTime; private autoExtensionManager?; private _onRelease?; constructor(resource: string, identifier: string, expiration: number, permitManager: SemaphorePermitManager, options: RequiredSemaphoreInternalOptions); get expiration(): number; get extensions(): number; get released(): boolean; get duration(): number; get timeToExpiration(): number; get isExpired(): boolean; get isValid(): boolean; /** Set a callback to invoke after release */ set onRelease(callback: (() => void) | undefined); /** Extend the permit with new TTL */ extend(ttl?: number): Promise; /** Release the permit */ release(): Promise<{ success: boolean; remainingCount: number; }>; /** Auto-extending execution context */ using(routine: (signal: LockSignal) => Promise, options?: { ttl?: number; autoExtendThreshold?: number; }): Promise; toJSON(): Record; } //# sourceMappingURL=semaphore.d.ts.map