import { EventEmitter } from 'events'; // app import { ISegment } from '../playlist-builder'; export type CacheSegmentFilter = (segment: ISegment) => boolean; export interface ICacheManagerCheckSegmentInput { orgId: string; fileId: string; segmentId: string; } export interface ICacheManager extends EventEmitter { getStorage(orgId: string): Promise; getMaxStorage(orgId: string): Promise; setMaxStorage(orgId: string, maxStorage: number): Promise; wasBilled(orgId: string, fileId: string, segmentId: string): Promise; saveCache(orgId: string, segmentId: string, segment: ISegment): Promise; checkCache(orgId: string, fileId: string, segmentId: string): Promise; checkCacheBatch(segments: ICacheManagerCheckSegmentInput[]): Promise; removeCache(orgId: string, fileId: string, segmentId: string): Promise; clearCache(orgId?: string, files?: string[], chunkSize?: number, deletionParallelism?: number, filter?: CacheSegmentFilter, dryRun?: boolean): Promise; cleanupCache(): Promise; startCacheGC(): void; stopCacheGC(): void; }