import { firestore } from "firebase-admin"; /** * Worker is controlled by WorkerMetadata document stored at process.env.MODS_INTERNAL_COLLECTION * path. Controller creates as many metadata documents as workers are required. Each worker monitors * exclusive shard range (aka slice) and terminates successfully after 45 seconds, upon which it * writes stats to its metadata document. That write triggers another worker run in GCF. This means * workers are self scheduling. * * If worker run fails, controller will detect that after 90s and reschedule worker by updating * 'timestamp' field. * * Workers avoid double scheduling and overruns by including their metadata documents in every * aggregation transaction. If metadata changes underneath, transaction fails, worker detects that * and terminates immediately. */ export declare class ShardedCounterWorker { private metadoc; private shardCollection; private singleRun; private db; private metadata; private shards; private aggregation; private allPaths; private rounds; private roundsCapped; constructor(metadoc: firestore.DocumentSnapshot, shardCollection: string, singleRun?: boolean); run(): Promise; protected maybeAggregate(): void; protected static categorizeShards(shards: firestore.DocumentSnapshot[], singleRun: boolean): [firestore.DocumentSnapshot[], firestore.DocumentSnapshot[]]; /** * Deletes empty partials and compacts non-empty ones. */ protected static cleanupPartials(db: firestore.Firestore, toCleanup: firestore.DocumentSnapshot[]): Promise[]; } //# sourceMappingURL=worker.d.ts.map