2020-12-07 22:15:18 +01:00
|
|
|
package it.cavallium.dbengine.database;
|
|
|
|
|
|
|
|
import com.google.common.primitives.Ints;
|
|
|
|
import com.google.common.primitives.Longs;
|
2021-10-30 11:13:46 +02:00
|
|
|
import io.micrometer.core.instrument.MeterRegistry;
|
2021-09-17 16:56:28 +02:00
|
|
|
import io.net5.buffer.api.BufferAllocator;
|
2021-01-31 00:36:21 +01:00
|
|
|
import it.cavallium.dbengine.database.collections.DatabaseInt;
|
2021-02-05 20:34:58 +01:00
|
|
|
import it.cavallium.dbengine.database.collections.DatabaseLong;
|
2020-12-07 22:15:18 +01:00
|
|
|
import java.nio.charset.StandardCharsets;
|
2021-01-31 15:47:48 +01:00
|
|
|
import reactor.core.publisher.Mono;
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-31 19:52:47 +01:00
|
|
|
public interface LLKeyValueDatabase extends LLSnapshottable, LLKeyValueDatabaseStructure {
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-31 15:47:48 +01:00
|
|
|
Mono<? extends LLSingleton> getSingleton(byte[] singletonListColumnName, byte[] name, byte[] defaultValue);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-02-13 01:31:24 +01:00
|
|
|
Mono<? extends LLDictionary> getDictionary(byte[] columnName, UpdateMode updateMode);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-31 15:47:48 +01:00
|
|
|
@Deprecated
|
2021-02-13 01:31:24 +01:00
|
|
|
default Mono<? extends LLDictionary> getDeprecatedSet(String name, UpdateMode updateMode) {
|
2021-06-19 16:26:54 +02:00
|
|
|
return getDictionary(Column.deprecatedSet(name).name().getBytes(StandardCharsets.US_ASCII), updateMode);
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|
|
|
|
|
2021-02-13 01:31:24 +01:00
|
|
|
default Mono<? extends LLDictionary> getDictionary(String name, UpdateMode updateMode) {
|
2021-06-19 16:26:54 +02:00
|
|
|
return getDictionary(Column.dictionary(name).name().getBytes(StandardCharsets.US_ASCII), updateMode);
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 15:47:48 +01:00
|
|
|
default Mono<DatabaseInt> getInteger(String singletonListName, String name, int defaultValue) {
|
|
|
|
return this
|
2021-06-19 16:26:54 +02:00
|
|
|
.getSingleton(Column.special(singletonListName).name().getBytes(StandardCharsets.US_ASCII),
|
2021-01-31 15:47:48 +01:00
|
|
|
name.getBytes(StandardCharsets.US_ASCII),
|
|
|
|
Ints.toByteArray(defaultValue)
|
|
|
|
)
|
|
|
|
.map(DatabaseInt::new);
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|
|
|
|
|
2021-02-05 20:34:58 +01:00
|
|
|
default Mono<DatabaseLong> getLong(String singletonListName, String name, long defaultValue) {
|
2021-01-31 15:47:48 +01:00
|
|
|
return this
|
2021-06-19 16:26:54 +02:00
|
|
|
.getSingleton(Column.special(singletonListName).name().getBytes(StandardCharsets.US_ASCII),
|
2021-01-31 15:47:48 +01:00
|
|
|
name.getBytes(StandardCharsets.US_ASCII),
|
|
|
|
Longs.toByteArray(defaultValue)
|
|
|
|
)
|
2021-02-05 20:34:58 +01:00
|
|
|
.map(DatabaseLong::new);
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 15:47:48 +01:00
|
|
|
Mono<Long> getProperty(String propertyName);
|
2021-01-31 19:52:47 +01:00
|
|
|
|
2021-06-27 15:06:48 +02:00
|
|
|
Mono<Void> verifyChecksum();
|
|
|
|
|
2021-08-29 23:18:03 +02:00
|
|
|
BufferAllocator getAllocator();
|
2021-05-03 21:41:51 +02:00
|
|
|
|
2021-10-30 11:13:46 +02:00
|
|
|
MeterRegistry getMeterRegistry();
|
|
|
|
|
2021-01-31 19:52:47 +01:00
|
|
|
Mono<Void> close();
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|