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

io.tarantool.driver.api.TarantoolCallOperations 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.api;

import io.tarantool.driver.exceptions.TarantoolClientException;
import io.tarantool.driver.mappers.CallResultMapper;
import io.tarantool.driver.mappers.MessagePackMapper;
import io.tarantool.driver.mappers.MessagePackObjectMapper;
import io.tarantool.driver.mappers.converters.ValueConverter;
import io.tarantool.driver.mappers.factories.ResultMapperFactoryFactory;
import org.msgpack.value.Value;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

/**
 * Aggregates all call operation variants
 *
 * @author Alexey Kuzin
 */
public interface TarantoolCallOperations {
    /**
     * Execute a function defined on Tarantool instance. The value mapper specified in the client configuration will be
     * used for converting the result values from MessagePack entities to objects.
     * TODO example function call
     *
     * @param functionName function name, must not be null or empty
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    CompletableFuture> call(String functionName) throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance, The value mapper specified in the client configuration will be
     * used for converting the result values from MessagePack entities to objects.
     *
     * @param functionName function name, must not be null or empty
     * @param arguments    vararg array of function arguments. The object mapper specified in the client configuration
     *                     will be used for arguments conversion to MessagePack entities
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    CompletableFuture> call(String functionName, Object... arguments) throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The value mapper specified in the client configuration will be
     * used for converting the result values from MessagePack entities to objects.
     *
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments. The object mapper specified in the client configuration
     *                     will be used for arguments conversion to MessagePack entities
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    CompletableFuture> call(String functionName, List arguments) throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance
     *
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments
     * @param mapper       mapper for arguments object-to-MessagePack entity conversion and result values conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected
     */
    CompletableFuture> call(String functionName, List arguments, MessagePackMapper mapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples. The value
     * mapper specified in the client configuration will be used for converting the result values from MessagePack
     * arrays to the specified entity type.
     *
     * @param           desired function call result type
     * @param functionName function name, must not be null or empty
     * @param entityClass  target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(String functionName, Class entityClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.
     *
     * @param           desired function call result type
     * @param functionName function name, must not be null or empty
     * @param resultMapper mapper for result value MessagePack entity-to-object conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(
        String functionName,
        CallResultMapper, SingleValueCallResult>> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.
     * The value mapper specified in the client configuration will be used for converting the result values from
     * MessagePack arrays to the specified entity type.
     *
     * @param           desired function call result type
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments. The object mapper specified in the client configuration
     *                     will be used for arguments conversion to MessagePack entities
     * @param entityClass  target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(
        String functionName,
        List arguments,
        Class entityClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.
     *
     * @param           desired function call result type
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments. The object mapper specified in the client configuration
     *                     will be used for arguments conversion to MessagePack entities
     * @param resultMapper mapper for result value MessagePack entity-to-object conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(
        String functionName,
        List arguments,
        CallResultMapper, SingleValueCallResult>> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples. The value
     * mapper specified in the client configuration will be used for converting the result values from MessagePack
     * arrays to the specified entity type.
     *
     * @param              desired function call result type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param entityClass     target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        Class entityClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.
     *
     * @param              desired function call result type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param resultMapper    mapper for result value MessagePack entity-to-object conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture> call(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        CallResultMapper, SingleValueCallResult>> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param              target result content type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param resultClass     target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param              target result content type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param valueConverter  MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param              target result content type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param resultMapper    mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param           target result content type
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments
     * @param resultClass  target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param             target result content type
     * @param functionName   function name, must not be null or empty
     * @param arguments      list of function arguments
     * @param valueConverter MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param           target result content type
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments
     * @param resultMapper mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        List arguments,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param           target result content type
     * @param functionName function name, must not be null or empty
     * @param resultClass  target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param             target result content type
     * @param functionName   function name, must not be null or empty
     * @param valueConverter MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. The first item of the call result will be interpreted as a
     * value, and the second -- as an error
     *
     * @param           target result content type
     * @param functionName function name, must not be null or empty
     * @param resultMapper mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
     CompletableFuture callForSingleResult(
        String functionName,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param arguments               list of function arguments
     * @param argumentsMapper         mapper for arguments object-to-MessagePack entity conversion
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param resultClass             target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        Supplier resultContainerSupplier,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param arguments               list of function arguments
     * @param argumentsMapper         mapper for arguments object-to-MessagePack entity conversion
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param valueConverter          MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        Supplier resultContainerSupplier,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param              target result content type
     * @param              target result type
     * @param functionName    function name, must not be null or empty
     * @param arguments       list of function arguments
     * @param argumentsMapper mapper for arguments object-to-MessagePack entity conversion
     * @param resultMapper    mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        MessagePackObjectMapper argumentsMapper,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param arguments               list of function arguments
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param resultClass             target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        Supplier resultContainerSupplier,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param arguments               list of function arguments
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param valueConverter          MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        Supplier resultContainerSupplier,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param           target result content type
     * @param           target result type
     * @param functionName function name, must not be null or empty
     * @param arguments    list of function arguments
     * @param resultMapper mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        List arguments,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param resultClass             target result entity class
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        Supplier resultContainerSupplier,
        Class resultClass)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param                      target result content type
     * @param                      target result type
     * @param functionName            function name, must not be null or empty
     * @param resultContainerSupplier supplier function for new empty result collection
     * @param valueConverter          MessagePack value to entity converter for each result item
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        Supplier resultContainerSupplier,
        ValueConverter valueConverter)
        throws TarantoolClientException;

    /**
     * Execute a function defined on Tarantool instance. All multi-return result items will be put into a list
     *
     * @param           target result content type
     * @param           target result type
     * @param functionName function name, must not be null or empty
     * @param resultMapper mapper for result conversion
     * @return some result
     * @throws TarantoolClientException if the client is not connected or some other error occurred
     */
    > CompletableFuture callForMultiResult(
        String functionName,
        CallResultMapper> resultMapper)
        throws TarantoolClientException;

    /**
     * Get the default factory for result mapper factory instances
     *
     * @return result mapper factory instances factory instance
     */
    ResultMapperFactoryFactory getResultMapperFactoryFactory();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy