CavalliumDBEngine/src/main/java/it/cavallium/dbengine/database/LLSingleton.java

35 lines
997 B
Java
Raw Normal View History

2020-12-07 22:15:18 +01:00
package it.cavallium.dbengine.database;
2022-03-16 13:47:56 +01:00
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
2022-07-15 02:44:50 +02:00
import io.netty5.util.Send;
import it.cavallium.dbengine.database.disk.BinarySerializationFunction;
2021-11-12 02:05:44 +01:00
import it.cavallium.dbengine.database.serialization.SerializationFunction;
import it.unimi.dsi.fastutil.bytes.ByteList;
import java.util.function.Function;
2020-12-07 22:15:18 +01:00
import org.jetbrains.annotations.Nullable;
2021-01-30 10:52:14 +01:00
import reactor.core.publisher.Mono;
2020-12-07 22:15:18 +01:00
public interface LLSingleton extends LLKeyValueDatabaseStructure {
2021-11-12 02:05:44 +01:00
BufferAllocator getAllocator();
Mono<Buffer> get(@Nullable LLSnapshot snapshot);
2020-12-07 22:15:18 +01:00
Mono<Void> set(Mono<Buffer> value);
2021-11-12 02:05:44 +01:00
default Mono<Buffer> update(BinarySerializationFunction updater,
2022-03-20 14:33:27 +01:00
UpdateReturnMode updateReturnMode) {
return this
.updateAndGetDelta(updater)
.transform(prev -> LLUtils.resolveLLDelta(prev, updateReturnMode));
}
Mono<LLDelta> updateAndGetDelta(BinarySerializationFunction updater);
2022-03-20 14:33:27 +01:00
String getColumnName();
String getName();
2020-12-07 22:15:18 +01:00
}