caminho
Version:
Tool for creating efficient data pipelines in a JavaScript environment
20 lines • 650 B
JavaScript
export class PendingDataControlInMemory {
size = 0;
buckets = new Map();
increment(bucketId, value = 1) {
this.size += value;
const current = this.buckets.get(bucketId) ?? 0;
this.buckets.set(bucketId, current + value);
}
decrement(bucketId, value = 1) {
this.size -= value;
const current = this.buckets.get(bucketId);
this.buckets.set(bucketId, current - value);
}
destroyBucket(bucketId) {
const inBucket = this.buckets.get(bucketId) ?? 0;
this.size -= inBucket;
this.buckets.delete(bucketId);
}
}
//# sourceMappingURL=PendingDataControl.js.map