2021-01-31 00:36:21 +01:00
|
|
|
package it.cavallium.dbengine.database.collections;
|
|
|
|
|
2023-02-09 23:34:25 +01:00
|
|
|
import it.cavallium.dbengine.buffers.Buf;
|
2021-01-31 00:36:21 +01:00
|
|
|
import it.cavallium.dbengine.client.CompositeSnapshot;
|
|
|
|
import it.cavallium.dbengine.database.LLDictionary;
|
2021-02-02 19:40:37 +01:00
|
|
|
import it.cavallium.dbengine.database.serialization.Serializer;
|
|
|
|
import it.cavallium.dbengine.database.serialization.SerializerFixedBinaryLength;
|
2021-12-18 18:16:56 +01:00
|
|
|
import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap;
|
2021-01-31 00:36:21 +01:00
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
|
2021-12-18 18:16:56 +01:00
|
|
|
public class SubStageGetterMap<T, U> implements
|
|
|
|
SubStageGetter<Object2ObjectSortedMap<T, U>, DatabaseMapDictionary<T, U>> {
|
2021-01-31 00:36:21 +01:00
|
|
|
|
2022-03-12 02:55:18 +01:00
|
|
|
final SerializerFixedBinaryLength<T> keySerializer;
|
|
|
|
final Serializer<U> valueSerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
|
2021-09-02 17:15:40 +02:00
|
|
|
public SubStageGetterMap(SerializerFixedBinaryLength<T> keySerializer,
|
|
|
|
Serializer<U> valueSerializer) {
|
2021-01-31 19:52:47 +01:00
|
|
|
this.keySerializer = keySerializer;
|
|
|
|
this.valueSerializer = valueSerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-02-09 23:34:25 +01:00
|
|
|
public DatabaseMapDictionary<T, U> subStage(LLDictionary dictionary,
|
2021-01-31 00:36:21 +01:00
|
|
|
@Nullable CompositeSnapshot snapshot,
|
2023-02-09 23:34:25 +01:00
|
|
|
Buf prefixKey) {
|
|
|
|
return DatabaseMapDictionary.tail(dictionary, prefixKey, keySerializer, valueSerializer);
|
2021-02-02 15:36:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getKeyBinaryLength() {
|
|
|
|
return keySerializer.getSerializedBinaryLength();
|
2021-01-31 00:36:21 +01:00
|
|
|
}
|
|
|
|
}
|