import type { Redis } from 'ioredis'; import type { IContainer } from 'node-cqrs'; import type { IEvent, IEventLocker } from '../interfaces/index.ts'; import { AbstractRedisAccessor } from './AbstractRedisAccessor.ts'; import type { RedisProjectionDataParams } from './RedisProjectionDataParams.ts'; export type RedisEventLockerParams = RedisProjectionDataParams & { /** * (Optional) Time-to-live (TTL) duration in milliseconds for which an event * remains in the "processing" state. After expiry Redis removes the key * automatically, allowing another instance to re-acquire the lock. * * @default 15_000 */ eventLockTtl?: number; }; /** * Redis-backed implementation of IEventLocker. * * Uses Lua scripts for atomic state transitions: * - `tryMarkAsProjecting`: SET key "processing" NX PX {ttl} * - `markAsProjected`: transitions "processing" → "processed" (permanent) * - `markAsLastEvent` / `getLastEvent`: a single JSON key per projection * * Key formats: * - Event lock: `{keyPrefix}:evtlock:{projectionName}:{schemaVersion}:{eventId}` * - Last event: `{keyPrefix}:lastevent:{projectionName}:{schemaVersion}` */ export declare class RedisEventLocker extends AbstractRedisAccessor implements IEventLocker { #private; constructor(o: Partial> & RedisEventLockerParams); protected initialize(_redis: Redis): void; tryMarkAsProjecting(event: IEvent): Promise; markAsProjected(event: IEvent): Promise; markAsLastEvent(event: IEvent): Promise; getLastEvent(): Promise; }