io.tarantool.driver.core.proxy.SelectProxyOperation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cartridge-driver Show documentation
Show all versions of cartridge-driver Show documentation
Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework
package io.tarantool.driver.core.proxy;
import io.tarantool.driver.api.SingleValueCallResult;
import io.tarantool.driver.api.TarantoolCallOperations;
import io.tarantool.driver.api.conditions.Conditions;
import io.tarantool.driver.api.metadata.TarantoolMetadataOperations;
import io.tarantool.driver.api.metadata.TarantoolSpaceMetadata;
import io.tarantool.driver.api.space.options.SelectOptions;
import io.tarantool.driver.mappers.CallResultMapper;
import io.tarantool.driver.mappers.MessagePackObjectMapper;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
/**
* Proxy operation for select
*
* @param result type
* @author Sergey Volgin
* @author Artyom Dubinin
*/
public final class SelectProxyOperation extends AbstractProxyOperation {
private SelectProxyOperation(
TarantoolCallOperations client,
String functionName,
List> arguments,
MessagePackObjectMapper argumentsMapper,
CallResultMapper> resultMapper) {
super(client, functionName, arguments, argumentsMapper, resultMapper);
}
/**
* The builder for this class.
*/
public static final class Builder
extends GenericOperationsBuilder> {
private final TarantoolMetadataOperations operations;
private final TarantoolSpaceMetadata metadata;
private Conditions conditions;
public Builder(TarantoolMetadataOperations operations, TarantoolSpaceMetadata metadata) {
this.operations = operations;
this.metadata = metadata;
}
@Override
Builder self() {
return this;
}
public Builder withConditions(Conditions conditions) {
this.conditions = conditions;
return this;
}
public SelectProxyOperation build() {
CRUDSelectOptions.Builder requestOptions = new CRUDSelectOptions.Builder()
.withTimeout(options.getTimeout())
.withSelectBatchSize(options.getBatchSize())
.withSelectLimit(Optional.of(conditions.getLimit()))
.withSelectAfter(Optional.ofNullable(conditions.getStartTuple()))
.withBucketId(options.getBucketId())
.withFields(options.getFields());
List> arguments = Arrays.asList(
spaceName,
conditions.toProxyQuery(operations, metadata),
requestOptions.build().asMap()
);
return new SelectProxyOperation<>(
this.client, this.functionName, arguments, this.argumentsMapper, this.resultMapper);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy