From 64ff18963787f2920ec67c320881f5b6079dfc1e Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Thu, 11 Mar 2021 02:22:59 +0100 Subject: [PATCH] Bugfix in deep map --- .../collections/DatabaseMapDictionaryDeep.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java index 6c28fff..248ec3b 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java @@ -244,10 +244,17 @@ public class DatabaseMapDictionaryDeep> implem public Flux> setAllValuesAndGetPrevious(Flux> entries) { return getAllStages(null) .flatMap(stage -> stage.getValue().get(null).map(val -> Map.entry(stage.getKey(), val))) - .concatWith(entries + .concatWith(clear().then(entries .flatMap(entry -> at(null, entry.getKey()).map(us -> Tuples.of(us, entry.getValue()))) .flatMap(tuple -> tuple.getT1().set(tuple.getT2())) - .then(Mono.empty())); + .then(Mono.empty()))); + } + + @Override + public Mono clear() { + return dictionary + .setRange(range, Flux.empty(), false) + .then(); } //todo: temporary wrapper. convert the whole class to buffers