Class ProxyTarantoolClient<T extends Packable,R extends Collection<T>>
- java.lang.Object
-
- io.tarantool.driver.core.ProxyTarantoolClient<T,R>
-
- Type Parameters:
T
- target tuple typeR
- target tuple collection type
- All Implemented Interfaces:
TarantoolCallOperations
,TarantoolClient<T,R>
,TarantoolEvalOperations
,AutoCloseable
- Direct Known Subclasses:
ProxyTarantoolTupleClient
public abstract class ProxyTarantoolClient<T extends Packable,R extends Collection<T>> extends Object implements TarantoolClient<T,R>
Client implementation that decorates aTarantoolClient
instance, proxying all CRUD operations through the instance'scall
method to the proxy functions defined on the Tarantool instance(s).Proxy functions to be called can be specified by overriding the methods of the implemented
ProxyOperationsMappingConfig
interface. These functions must be public API functions available on the Tarantool instance for the connected API user.It is recommended to use this client with the CRUD module ( https://github.com/tarantool/crud) installed on the target Tarantool instance. Be sure that the server instances you are connecting to with this client have the
crud-router
role enabled.The default implementation of metadata retrieving function is provided by the DDL module (https://github.com/tarantool/ddl). It is available by default on the Cartridge instances. In the other cases, you'll have to expose the DDL module as public API on the target Tarantool instance or use some other implementation of that function.
See https://github.com/tarantool/examples/blob/master/profile-storage/README.md
-
-
Constructor Summary
Constructors Constructor Description ProxyTarantoolClient(TarantoolClient<T,R> decoratedClient, ProxyOperationsMappingConfig mappingConfig)
Basic constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompletableFuture<List<?>>
call(String functionName)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, Class<T> entityClass)
Execute a function defined on Tarantool instance.CompletableFuture<List<?>>
call(String functionName, Object... arguments)
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.CompletableFuture<List<?>>
call(String functionName, List<?> arguments)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, List<?> arguments, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper)
Execute a function defined on Tarantool instance.CompletableFuture<List<?>>
call(String functionName, List<?> arguments, MessagePackMapper mapper)
Execute a function defined on Tarantool instance<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<T> entityClass)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, List<?> arguments, Class<T> entityClass)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, Supplier<R> resultContainerSupplier, Class<T> resultClass)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Supplier<R> resultContainerSupplier, Class<T> resultClass)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T,R extends List<T>>
CompletableFuture<R>callForMultiResult(String functionName, List<?> arguments, Supplier<R> resultContainerSupplier, Class<T> resultClass)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, CallResultMapper<T,SingleValueCallResult<T>> resultMapper)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, Class<T> resultClass)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, CallResultMapper<T,SingleValueCallResult<T>> resultMapper)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<T,SingleValueCallResult<T>> resultMapper)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, ValueConverter<org.msgpack.value.Value,T> valueConverter)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<T> resultClass)
Execute a function defined on Tarantool instance.<T> CompletableFuture<T>
callForSingleResult(String functionName, List<?> arguments, Class<T> resultClass)
Execute a function defined on Tarantool instance.void
close()
CompletableFuture<List<?>>
eval(String expression)
Execute a Lua expression in the Tarantool instance.CompletableFuture<List<?>>
eval(String expression, MessagePackValueMapper resultMapper)
Execute a Lua expression in the Tarantool instance.CompletableFuture<List<?>>
eval(String expression, List<?> arguments)
Execute a Lua expression in the Tarantool instance.CompletableFuture<List<?>>
eval(String expression, List<?> arguments, MessagePackObjectMapper argumentsMapper, MessagePackValueMapper resultMapper)
Execute a Lua expression in the Tarantool instance.CompletableFuture<List<?>>
eval(String expression, List<?> arguments, MessagePackValueMapper resultMapper)
Execute a Lua expression in the Tarantool instance.TarantoolClientConfig
getConfig()
Get the Tarantool client config passed to this clientTarantoolConnectionListeners
getConnectionListeners()
Get collection of connection listeners.ResultMapperFactoryFactory
getResultMapperFactoryFactory()
Get the default factory for result mapper factory instancesTarantoolVersion
getVersion()
Get the Tarantool server versionTarantoolMetadataOperations
metadata()
Provides operations for Tarantool spaces and indexes metadataTarantoolMetadataProvider
metadataProvider()
Provides implementation of retrieving the metadata for spaces and instances from Tarantool serversboolean
refresh()
Starts the process of establishing lacking connections to each hostTarantoolSpaceOperations<T,R>
space(int spaceId)
Provides CRUD and other operations for a Tarantool spaceTarantoolSpaceOperations<T,R>
space(String spaceName)
Provides CRUD and other operations for a Tarantool spaceprotected abstract TarantoolSpaceOperations<T,R>
spaceOperations(TarantoolClientConfig config, TarantoolCallOperations client, ProxyOperationsMappingConfig mappingConfig, TarantoolMetadataOperations metadata, TarantoolSpaceMetadata spaceMetadata)
Creates a space API implementation instance for the specified space
-
-
-
Constructor Detail
-
ProxyTarantoolClient
public ProxyTarantoolClient(TarantoolClient<T,R> decoratedClient, ProxyOperationsMappingConfig mappingConfig)
Basic constructor- Parameters:
decoratedClient
- configured Tarantool clientmappingConfig
- config for proxy operations mapping
-
-
Method Detail
-
space
public TarantoolSpaceOperations<T,R> space(int spaceId) throws TarantoolClientException
Description copied from interface:TarantoolClient
Provides CRUD and other operations for a Tarantool space- Specified by:
space
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Parameters:
spaceId
- ID of the space, must be greater than 0- Returns:
- Tarantool space operations implementation
- Throws:
TarantoolClientException
- if the client is not connected
-
space
public TarantoolSpaceOperations<T,R> space(String spaceName)
Description copied from interface:TarantoolClient
Provides CRUD and other operations for a Tarantool space- Specified by:
space
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Parameters:
spaceName
- name of the space, must not be null or empty- Returns:
- Tarantool space operations interface
-
spaceOperations
protected abstract TarantoolSpaceOperations<T,R> spaceOperations(TarantoolClientConfig config, TarantoolCallOperations client, ProxyOperationsMappingConfig mappingConfig, TarantoolMetadataOperations metadata, TarantoolSpaceMetadata spaceMetadata)
Creates a space API implementation instance for the specified space- Parameters:
config
- Tarantool client configurationclient
- configured client instancemappingConfig
- proxy operations mapping configurationmetadata
- metadata operationsspaceMetadata
- current space metadata- Returns:
- space API implementation instance
-
metadata
public TarantoolMetadataOperations metadata() throws TarantoolClientException
Description copied from interface:TarantoolClient
Provides operations for Tarantool spaces and indexes metadata- Specified by:
metadata
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
- Tarantool metadata operations implementation
- Throws:
TarantoolClientException
- if the client is not connected
-
metadataProvider
public TarantoolMetadataProvider metadataProvider()
Description copied from interface:TarantoolClient
Provides implementation of retrieving the metadata for spaces and instances from Tarantool servers- Specified by:
metadataProvider
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
- metadata provider instance
-
getConfig
public TarantoolClientConfig getConfig()
Description copied from interface:TarantoolClient
Get the Tarantool client config passed to this client- Specified by:
getConfig
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
TarantoolClientConfig
instance
-
getVersion
public TarantoolVersion getVersion() throws TarantoolClientException
Description copied from interface:TarantoolClient
Get the Tarantool server version- Specified by:
getVersion
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
TarantoolVersion
- Throws:
TarantoolClientException
- if the client is not connected
-
getConnectionListeners
public TarantoolConnectionListeners getConnectionListeners()
Description copied from interface:TarantoolClient
Get collection of connection listeners. Used for adding new listeners, removing listeners or examining the collection- Specified by:
getConnectionListeners
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
- connection listeners
-
getResultMapperFactoryFactory
public ResultMapperFactoryFactory getResultMapperFactoryFactory()
Description copied from interface:TarantoolCallOperations
Get the default factory for result mapper factory instances- Specified by:
getResultMapperFactoryFactory
in interfaceTarantoolCallOperations
- Returns:
- result mapper factory instances factory instance
-
call
public CompletableFuture<List<?>> call(String functionName) throws TarantoolClientException
Description copied from 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- Specified by:
call
in interfaceTarantoolCallOperations
- Parameters:
functionName
- function name, must not be null or empty- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public CompletableFuture<List<?>> call(String functionName, Object... arguments) throws TarantoolClientException
Description copied from 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.- Specified by:
call
in interfaceTarantoolCallOperations
- Parameters:
functionName
- function name, must not be null or emptyarguments
- vararg array of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entities- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public CompletableFuture<List<?>> call(String functionName, List<?> arguments) throws TarantoolClientException
Description copied from 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.- Specified by:
call
in interfaceTarantoolCallOperations
- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entities- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public CompletableFuture<List<?>> call(String functionName, List<?> arguments, MessagePackMapper mapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance- Specified by:
call
in interfaceTarantoolCallOperations
- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsmapper
- mapper for arguments object-to-MessagePack entity conversion and result values conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, Class<T> entityClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyentityClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, List<?> arguments, Class<T> entityClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entitiesentityClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, List<?> arguments, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entitiesresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<T> entityClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionentityClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
call
public <T> CompletableFuture<TarantoolResult<T>> call(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<TarantoolResult<T>,SingleValueCallResult<TarantoolResult<T>>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. The call result is interpreted as an array of tuples.- Specified by:
call
in interfaceTarantoolCallOperations
- Type Parameters:
T
- desired function call result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<T,SingleValueCallResult<T>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, List<?> arguments, CallResultMapper<T,SingleValueCallResult<T>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForSingleResult
public <T> CompletableFuture<T> callForSingleResult(String functionName, CallResultMapper<T,SingleValueCallResult<T>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
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- Specified by:
callForSingleResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content type- Parameters:
functionName
- function name, must not be null or emptyresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Supplier<R> resultContainerSupplier, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultContainerSupplier
- supplier function for new empty result collectionresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultContainerSupplier
- supplier function for new empty result collectionvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, Supplier<R> resultContainerSupplier, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsresultContainerSupplier
- supplier function for new empty result collectionresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsresultContainerSupplier
- supplier function for new empty result collectionvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, List<?> arguments, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyarguments
- list of function argumentsresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, Supplier<R> resultContainerSupplier, Class<T> resultClass) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyresultContainerSupplier
- supplier function for new empty result collectionresultClass
- target result entity class- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, Supplier<R> resultContainerSupplier, ValueConverter<org.msgpack.value.Value,T> valueConverter) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyresultContainerSupplier
- supplier function for new empty result collectionvalueConverter
- MessagePack value to entity converter for each result item- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
callForMultiResult
public <T,R extends List<T>> CompletableFuture<R> callForMultiResult(String functionName, CallResultMapper<R,MultiValueCallResult<T,R>> resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolCallOperations
Execute a function defined on Tarantool instance. All multi-return result items will be put into a list- Specified by:
callForMultiResult
in interfaceTarantoolCallOperations
- Type Parameters:
T
- target result content typeR
- target result type- Parameters:
functionName
- function name, must not be null or emptyresultMapper
- mapper for result conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected or some other error occurred
-
eval
public CompletableFuture<List<?>> eval(String expression) throws TarantoolClientException
Description copied from interface:TarantoolEvalOperations
Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with keywordreturn
. The value mapper specified in the client configuration will be used for converting the result values from MessagePack entities to objects.- Specified by:
eval
in interfaceTarantoolEvalOperations
- Parameters:
expression
- lua expression, must not be null or empty- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
eval
public CompletableFuture<List<?>> eval(String expression, List<?> arguments) throws TarantoolClientException
Description copied from interface:TarantoolEvalOperations
Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with keywordreturn
. The value mapper specified in the client configuration will be used for converting the result values from MessagePack entities to objects.- Specified by:
eval
in interfaceTarantoolEvalOperations
- Parameters:
expression
- lua expression, must not be null or emptyarguments
- the list of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entities- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
eval
public CompletableFuture<List<?>> eval(String expression, MessagePackValueMapper resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolEvalOperations
Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with keywordreturn
.- Specified by:
eval
in interfaceTarantoolEvalOperations
- Parameters:
expression
- lua expression, must not be null or emptyresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
eval
public CompletableFuture<List<?>> eval(String expression, List<?> arguments, MessagePackValueMapper resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolEvalOperations
Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with keywordreturn
.- Specified by:
eval
in interfaceTarantoolEvalOperations
- Parameters:
expression
- lua expression, must not be null or emptyarguments
- the list of function arguments. The object mapper specified in the client configuration will be used for arguments conversion to MessagePack entitiesresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
eval
public CompletableFuture<List<?>> eval(String expression, List<?> arguments, MessagePackObjectMapper argumentsMapper, MessagePackValueMapper resultMapper) throws TarantoolClientException
Description copied from interface:TarantoolEvalOperations
Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with keywordreturn
.- Specified by:
eval
in interfaceTarantoolEvalOperations
- Parameters:
expression
- lua expression, must not be null or emptyarguments
- the list of function argumentsargumentsMapper
- mapper for arguments object-to-MessagePack entity conversionresultMapper
- mapper for result value MessagePack entity-to-object conversion- Returns:
- some result
- Throws:
TarantoolClientException
- if the client is not connected
-
refresh
public boolean refresh()
Description copied from interface:TarantoolClient
Starts the process of establishing lacking connections to each host- Specified by:
refresh
in interfaceTarantoolClient<T extends Packable,R extends Collection<T>>
- Returns:
- returns true if the establishing process has been started, else false
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-