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

io.tarantool.driver.api.TarantoolEvalOperations 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.MessagePackObjectMapper;
import io.tarantool.driver.mappers.MessagePackValueMapper;

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

/**
 * Aggregates all value operation variants
 *
 * @author Alexey Kuzin
 */
public interface TarantoolEvalOperations {
    /**
     * Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
     * keyword return. The value mapper specified in the client configuration will be used for converting
     * the result values from MessagePack entities to objects.
     *
     * @param expression lua expression, must not be null or empty
     * @return some result
     * @throws TarantoolClientException if the client is not connected
     */
    CompletableFuture> eval(String expression) throws TarantoolClientException;

    /**
     * Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
     * keyword return. The value mapper specified in the client configuration will be used for converting
     * the result values from MessagePack entities to objects.
     *
     * @param expression lua expression, must not be null or empty
     * @param arguments  the 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
     */
    CompletableFuture> eval(String expression, List arguments) throws TarantoolClientException;

    /**
     * Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
     * keyword return.
     *
     * @param expression   lua expression, 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
     */
    CompletableFuture> eval(String expression, MessagePackValueMapper resultMapper)
            throws TarantoolClientException;

    /**
     * Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
     * keyword return.
     *
     * @param expression   lua expression, must not be null or empty
     * @param arguments    the 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
     */
    CompletableFuture> eval(String expression, List arguments, MessagePackValueMapper resultMapper)
            throws TarantoolClientException;

    /**
     * Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
     * keyword return.
     *
     * @param expression      lua expression, must not be null or empty
     * @param arguments       the 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
     */
    CompletableFuture> eval(String expression,
                                    List arguments,
                                    MessagePackObjectMapper argumentsMapper,
                                    MessagePackValueMapper resultMapper) throws TarantoolClientException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy