package it.cavallium.dbengine.database; import java.util.Map.Entry; import java.util.function.Function; import org.jetbrains.annotations.Nullable; import org.warp.commonutils.concurrency.atomicity.NotAtomic; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @NotAtomic public interface LLDictionary extends LLKeyValueDatabaseStructure { Mono get(@Nullable LLSnapshot snapshot, byte[] key); Mono put(byte[] key, byte[] value, LLDictionaryResultType resultType); Mono remove(byte[] key, LLDictionaryResultType resultType); Flux> getMulti(@Nullable LLSnapshot snapshot, Flux keys); Flux> putMulti(Flux> entries, boolean getOldValues); Flux> getRange(@Nullable LLSnapshot snapshot, LLRange range); Flux> setRange(LLRange range, Flux> entries, boolean getOldValues); default Mono replaceRange(LLRange range, boolean canKeysChange, Function, Mono>> entriesReplacer) { Flux> replacedFlux = this.getRange(null, range).flatMap(entriesReplacer); if (canKeysChange) { return this .setRange(range, replacedFlux, false) .then(); } else { return this .putMulti(replacedFlux, false) .then(); } } Mono isRangeEmpty(@Nullable LLSnapshot snapshot, LLRange range); Mono sizeRange(@Nullable LLSnapshot snapshot, LLRange range, boolean fast); Mono> removeOne(LLRange range); }