import { firestore } from "firebase-admin"; /** * There are two types of shards: "shard" and "partial". * * "shard" is incremented by client application and, since each app instance has its own unique * shard, these are not contended. * "partial" contains partial aggregation from up to 499 "shards" and is updated by worker. These * update frequently and workers modify them using array transforms rather than transaction to * avoid contention. * "counter" is not a shard but the main document that aggregates all increments from all shards * * Planner takes a list of shards (these can be partials or shards) and decides how to aggregate * them to avoid contention. */ interface AggregationPlan { aggregate: string; isPartial: boolean; shards: firestore.DocumentSnapshot[]; partials: firestore.DocumentSnapshot[]; } export declare class Planner { /** * Takes all the shard snapshots and creates aggregation plans. * @param start Beginning of document range for this worker. * @param snaps List of shard snapshots to aggregate. */ static planAggregations(start: string, snaps: firestore.DocumentSnapshot[]): AggregationPlan[]; protected static constructAggregate(shard: string, prefixLen: any): [string, boolean]; protected static aggrPrefixLen(start: string, end: string): number; protected static decodeShard(shard: string): string; protected static encodeShard(shard: string): string; protected static isPartialShard(shard: string): boolean; } export {}; //# sourceMappingURL=planner.d.ts.map