From 723160864f4279163c44b6d25cb10b37ef3a7955 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sat, 30 Jan 2021 00:26:58 +0100 Subject: [PATCH] Update LLLocalDictionary.java --- .../database/disk/LLLocalDictionary.java | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java index 1dabd05..a21e501 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java @@ -13,7 +13,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; -import java.util.Optional; import java.util.function.Function; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,11 +24,8 @@ import org.rocksdb.RocksDB; import org.rocksdb.RocksDBException; import org.rocksdb.RocksIterator; import org.rocksdb.Snapshot; -import org.rocksdb.WriteBatch; import org.rocksdb.WriteOptions; import org.warp.commonutils.concurrency.atomicity.NotAtomic; -import org.warp.commonutils.functional.CancellableBiFunction; -import org.warp.commonutils.functional.ConsumerResult; import org.warp.commonutils.type.VariableWrapper; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -106,7 +102,7 @@ public class LLLocalDictionary implements LLDictionary { } @Override - public Mono isEmpty(@Nullable LLSnapshot snapshot, LLRange range) { + public Mono isRangeEmpty(@Nullable LLSnapshot snapshot, LLRange range) { if (range.isSingle()) { return containsKey(snapshot, range.getSingle()).map(contains -> !contains); } else { @@ -464,11 +460,6 @@ public class LLLocalDictionary implements LLDictionary { db.flush(new FlushOptions().setWaitForFlush(true).setAllowWriteStall(true), cfh); db.flushWal(true); - - var finalSize = exactSize(null); - if (finalSize != 0) { - throw new IllegalStateException("The dictionary is not empty after calling clear()"); - } } return null; }) @@ -551,26 +542,6 @@ public class LLLocalDictionary implements LLDictionary { } } - @Override - public Mono isRangeEmpty(@Nullable LLSnapshot snapshot, LLRange range) { - return Mono - .fromCallable(() -> { - try (RocksIterator iter = db.newIterator(cfh, resolveSnapshot(snapshot))) { - if (range.hasMin()) { - iter.seek(range.getMin()); - } else { - iter.seekToFirst(); - } - if (!iter.isValid()) { - return true; - } - return range.hasMax() && Arrays.compareUnsigned(iter.key(), range.getMax()) > 0; - } - }) - .onErrorMap(IOException::new) - .subscribeOn(Schedulers.boundedElastic()); - } - @Override public Mono> removeOne(LLRange range) { return Mono