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 12:43:28 +01:00
|
|
|
public class SubStageGetterMapDeep<T, U, US extends DatabaseStage<U>> implements
|
|
|
|
SubStageGetter<Map<T, U>, DatabaseStageEntry<Map<T, U>>> {
|
2021-01-31 00:36:21 +01:00
|
|
|
|
|
|
|
private final SubStageGetter<U, US> subStageGetter;
|
2021-02-01 10:56:14 +01:00
|
|
|
private final SerializerFixedBinaryLength<T, ByteBuf> keySerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
private final int keyExtLength;
|
|
|
|
|
2021-01-31 12:43:28 +01:00
|
|
|
public SubStageGetterMapDeep(SubStageGetter<U, US> subStageGetter,
|
2021-02-01 10:56:14 +01:00
|
|
|
SerializerFixedBinaryLength<T, ByteBuf> keySerializer,
|
2021-01-31 12:43:28 +01:00
|
|
|
int keyExtLength) {
|
2021-01-31 00:36:21 +01:00
|
|
|
this.subStageGetter = subStageGetter;
|
2021-01-31 12:43:28 +01:00
|
|
|
this.keySerializer = keySerializer;
|
2021-01-31 00:36:21 +01:00
|
|
|
this.keyExtLength = keyExtLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-01-31 12:43:28 +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(DatabaseMapDictionaryDeep.deepIntermediate(dictionary,
|
2021-01-31 12:43:28 +01:00
|
|
|
subStageGetter,
|
|
|
|
keySerializer,
|
|
|
|
prefixKey,
|
|
|
|
keyExtLength
|
|
|
|
));
|
2021-01-31 00:36:21 +01:00
|
|
|
}
|
|
|
|
}
|