import type { LogEntry } from './mm-connector-logger.js'; /** * Implement a custom LogDeduper or use the provided FileLogDeduper */ export interface LogDeduper { decide(entry: LogEntry, now: number): Promise; onSuccess(entry: LogEntry, now: number): Promise; retryFailedTransmissions?(send: (entry: LogEntry, message: string) => Promise): Promise; } /** * FileLogDeduper implements the LogDeduper interface to deduplicate * logs by storing them in a file; this allows deduping across jobs. */ export declare class FileLogDeduper implements LogDeduper { private readonly storeFilePath; private readonly windowMs; private readonly ttlMs; private readonly sweepIntervalMs; private lastSweepTsMs; private readonly DEFAULT_WINDOW_TEN_MINS; private readonly DEFAULT_TTL_ONE_HOUR; private readonly DEFAULT_SWEEP_INTERVAL_FIVE_MINS; private readonly DEFAULT_STORE_FILE_PATH; /** * Ctor. * @param storeFilePath: The path to the file where the deduplication store is stored; recommended is to use the default * @param windowSeconds: Suppression window. Duplicates within this period are suppressed. * @param ttlSeconds: Eviction TTL. Store entries for keys inactive beyond this are removed. Enforced to be ≥ windowSeconds. * Stored per entry, so instances with different TTLs can safely share one store file. * @param sweepIntervalSeconds: Efficiency parameter. How often (min interval) to run opportunistic eviction; retry always sweeps * The sweep is lazy, used only when the store is accessed */ constructor({ storeFilePath, windowSeconds, ttlSeconds, sweepIntervalSeconds }?: { storeFilePath?: string; windowSeconds?: number; ttlSeconds?: number; sweepIntervalSeconds?: number; }); /** * Deduplication gating function * Returns the formatted message to send, or null to suppress * Decision is based on the dedupeKey and the time of the entry */ decide(entry: LogEntry, now: number): Promise; onSuccess(entry: LogEntry, now: number): Promise; retryFailedTransmissions(send: (entry: LogEntry, message: string) => Promise): Promise; private ensureStoreFileExists; private readStore; private writeStore; private formatMessage; private withLock; /** * Evict expired entries from the store based on each entry's own TTL and the key's last transmitted time. * Entries written by pre-upgrade versions carry no ttlMs; fall back to the sweeper's TTL for those. */ private evictExpiredInStore; } //# sourceMappingURL=log-deduper.d.ts.map