2021-01-31 00:36:21 +01:00
|
|
|
package it.cavallium.dbengine.database.collections;
|
|
|
|
|
2021-02-01 10:56:14 +01:00
|
|
|
import io.netty.buffer.ByteBuf;
|
2021-01-31 00:36:21 +01:00
|
|
|
import it.cavallium.dbengine.client.CompositeSnapshot;
|
|
|
|
import it.cavallium.dbengine.database.LLDictionary;
|
|
|
|
import java.util.Map;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import reactor.core.publisher.Flux;
|
|
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
2021-01-31 22:20:00 +01:00
|
|
|
public class SubStageGetterMap<T, U> implements SubStageGetter<Map<T, U>, DatabaseStageEntry<Map<T, U>>> {
|
2021-01-31 00:36:21 +01:00
|
|
|
|
2021-02-01 10:56:14 +01:00
|
|
|
private final SerializerFixedBinaryLength<T, ByteBuf> keySerializer;
|
|
|
|
private final Serializer<U, ByteBuf> valueSerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
|
2021-02-01 10:56:14 +01:00
|
|
|
public SubStageGetterMap(SerializerFixedBinaryLength<T, ByteBuf> keySerializer, Serializer<U, ByteBuf> valueSerializer) {
|
2021-01-31 19:52:47 +01:00
|
|
|
this.keySerializer = keySerializer;
|
|
|
|
this.valueSerializer = valueSerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-01-31 19:52:47 +01:00
|
|
|
public Mono<DatabaseStageEntry<Map<T, U>>> subStage(LLDictionary dictionary,
|
2021-01-31 00:36:21 +01:00
|
|
|
@Nullable CompositeSnapshot snapshot,
|
|
|
|
byte[] prefixKey,
|
|
|
|
Flux<byte[]> keyFlux) {
|
2021-01-31 21:23:43 +01:00
|
|
|
return Mono.just(DatabaseMapDictionary.tail(dictionary, keySerializer, valueSerializer, prefixKey));
|
2021-01-31 00:36:21 +01:00
|
|
|
}
|
|
|
|
}
|