import { RedisOptions } from 'ioredis'; import { BaseDriver } from './base-driver'; export interface RedisLockSettings { /** * TTL of the lock in milliseconds. The lock is automatically extended * while the callback is still running. Defaults to 5000. */ duration?: number; /** Redis key prefix for lock keys. Defaults to '_lock'. */ prefix?: string; /** Also serialize lock calls in-process with better-lock. */ stacked?: boolean; /** * Maximum time in milliseconds to wait for the lock to become available. * 0 (default) waits indefinitely. */ acquireTimeout?: number; /** * Fallback polling interval in milliseconds while waiting for the lock. * Waiters are also woken up immediately via pub/sub when a lock is * released, so this only matters when the holder dies without releasing. * Defaults to 200. */ retryDelay?: number; /** Random jitter in milliseconds applied to retryDelay. Defaults to 100. */ retryJitter?: number; /** * Extend the lock when this many milliseconds remain before expiration. * Defaults to 500. */ extensionThreshold?: number; /** * @deprecated Use `acquireTimeout` instead. Number of retries before * giving up; -1 (default) retries indefinitely. */ retryCount?: number; /** @deprecated Use `extensionThreshold` instead. */ automaticExtensionThreshold?: number; } export type RedisDriverOptions = RedisOptions & { uri?: string; lock?: RedisLockSettings; queueKey?: string; queueBackupKey?: string; }; export interface AragamiOptions { useDriver?: BaseDriver; redis?: RedisDriverOptions; defaultTTL?: number; } export type TypedMethodDecorator = (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; export type AnyClass = new (...args: any[]) => any; export type ClassType = new (...args: any[]) => T; export type Awaitable = T | Promise;