From 5c49467e4513e260647a74f84042662d78ccdbc7 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Wed, 18 Sep 2019 19:16:00 -0400 Subject: tweaks --- src/client/northstar/utils/Extensions.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/client/northstar/utils') diff --git a/src/client/northstar/utils/Extensions.ts b/src/client/northstar/utils/Extensions.ts index ad3e06806..8254c775c 100644 --- a/src/client/northstar/utils/Extensions.ts +++ b/src/client/northstar/utils/Extensions.ts @@ -31,13 +31,19 @@ type BatchHandlerAsync = (batch: I[], context: BatchContext) => Promise type BatchConverter = BatchConverterSync | BatchConverterAsync; type BatchHandler = BatchHandlerSync | BatchHandlerAsync; type FixedBatcher = { batchSize: number } | { batchCount: number, mode?: Mode }; +interface ExecutorResult { + updated: A; + makeNextBatch: boolean; +} interface PredicateBatcher { - executor: (element: I, accumulator: A | undefined) => A | undefined; + executor: (element: I, accumulator: A) => ExecutorResult; initial: A; + persistAccumulator?: boolean; } interface PredicateBatcherAsync { - executor: (element: I, accumulator: A | undefined) => Promise; + executor: (element: I, accumulator: A) => Promise>; initial: A; + persistAccumulator?: boolean; } type Batcher = FixedBatcher | PredicateBatcher; type BatcherAsync = Batcher | PredicateBatcherAsync; -- cgit v1.2.3-70-g09d2