All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.core.proxy.DeleteProxyOperation Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.core.proxy;

import io.tarantool.driver.api.SingleValueCallResult;
import io.tarantool.driver.api.TarantoolCallOperations;
import io.tarantool.driver.api.space.options.DeleteOptions;
import io.tarantool.driver.mappers.CallResultMapper;
import io.tarantool.driver.mappers.MessagePackObjectMapper;
import io.tarantool.driver.protocol.TarantoolIndexQuery;

import java.util.Arrays;
import java.util.List;

/**
 * Proxy operation for delete
 *
 * @param  result type
 * @author Sergey Volgin
 * @author Artyom Dubinin
 */
public final class DeleteProxyOperation extends AbstractProxyOperation {

    private DeleteProxyOperation(
        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 TarantoolIndexQuery indexQuery;

        public Builder() {
        }

        @Override
        Builder self() {
            return this;
        }

        public Builder withIndexQuery(TarantoolIndexQuery indexQuery) {
            this.indexQuery = indexQuery;
            return this;
        }

        public DeleteProxyOperation build() {
            CRUDBucketIdOptions requestOptions = new CRUDDeleteOptions.Builder()
                .withTimeout(options.getTimeout())
                .withBucketId(options.getBucketId())
                .withFields(options.getFields())
                .build();

            List arguments = Arrays.asList(spaceName, indexQuery.getKeyValues(), requestOptions.asMap());

            return new DeleteProxyOperation<>(
                this.client, this.functionName, arguments, this.argumentsMapper, this.resultMapper);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy