package it.cavallium.dbengine.database; import java.util.List; import java.util.Map.Entry; import java.util.Optional; 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; @SuppressWarnings("unused") @NotAtomic public interface LLDictionary extends LLKeyValueDatabaseStructure { Mono get(@Nullable LLSnapshot snapshot, byte[] key); Mono put(byte[] key, byte[] value, LLDictionaryResultType resultType); Mono update(byte[] key, Function, Optional> updater); 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>> getRangeGrouped(@Nullable LLSnapshot snapshot, LLRange range, int prefixLength); Flux getRangeKeys(@Nullable LLSnapshot snapshot, LLRange range); Flux> getRangeKeysGrouped(@Nullable LLSnapshot snapshot, LLRange range, int prefixLength); Flux> setRange(LLRange range, Flux> entries, boolean getOldValues); default Mono replaceRange(LLRange range, boolean canKeysChange, Function, Mono>> entriesReplacer) { return Mono.defer(() -> { if (canKeysChange) { return this .setRange(range, this .getRange(null, range) .flatMap(entriesReplacer), false) .then(); } else { return this .putMulti(this .getRange(null, range) .flatMap(entriesReplacer), false) .then(); } }); } Mono isRangeEmpty(@Nullable LLSnapshot snapshot, LLRange range); Mono sizeRange(@Nullable LLSnapshot snapshot, LLRange range, boolean fast); Mono> getOne(@Nullable LLSnapshot snapshot, LLRange range); Mono getOneKey(@Nullable LLSnapshot snapshot, LLRange range); Mono> removeOne(LLRange range); }