Package io.tarantool.driver.core
Class AbstractTarantoolClient<T extends Packable,R extends Collection<T>>
- java.lang.Object
-
- io.tarantool.driver.core.AbstractTarantoolClient<T,R>
-
- Type Parameters:
T
- target tuple typeR
- target tuple collection type
- All Implemented Interfaces:
TarantoolCallOperations
,TarantoolClient<T,R>
,TarantoolEvalOperations
,AutoCloseable
- Direct Known Subclasses:
ClusterTarantoolClient
public abstract class AbstractTarantoolClient<T extends Packable,R extends Collection<T>> extends Object implements TarantoolClient<T,R>
Basic Tarantool client implementation. Subclasses must provide the connection manager.
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractTarantoolClient(TarantoolClientConfig config)
Create a client.protected
AbstractTarantoolClient(TarantoolClientConfig config, ConnectionSelectionStrategyFactory selectionStrategyFactory, TarantoolConnectionListeners listeners)
Deprecated.AbstractTarantoolClient(TarantoolClientConfig config, TarantoolConnectionListeners listeners)
Create a client, specifying the connection established event listeners.
-
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> tupleClass)
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> tupleClass)
Execute a function defined on Tarantool instance.<T> CompletableFuture<TarantoolResult<T>>
call(String functionName, List<?> arguments, Class<T> tupleClass)
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.<S> CompletableFuture<S>
callForSingleResult(String functionName, CallResultMapper<S,SingleValueCallResult<S>> resultMapper)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, ValueConverter<org.msgpack.value.Value,S> valueConverter)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, Class<S> resultClass)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, CallResultMapper<S,SingleValueCallResult<S>> resultMapper)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, ValueConverter<org.msgpack.value.Value,S> valueConverter)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<S,SingleValueCallResult<S>> resultMapper)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, ValueConverter<org.msgpack.value.Value,S> valueConverter)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<S> resultClass)
Execute a function defined on Tarantool instance.<S> CompletableFuture<S>
callForSingleResult(String functionName, List<?> arguments, Class<S> resultClass)
Execute a function defined on Tarantool instance.void
close()
protected abstract TarantoolConnectionManager
connectionManager(TarantoolClientConfig config, TarantoolConnectionFactory connectionFactory, TarantoolConnectionListeners listeners)
Provides a connection manager for Tarantool server connectionsCompletableFuture<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.protected io.netty.bootstrap.Bootstrap
getBootstrap()
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, TarantoolConnectionManager connectionManager, TarantoolMetadataOperations metadata, TarantoolSpaceMetadata spaceMetadata)
Creates a space API implementation instance for the specified space
-
-
-
Constructor Detail
-
AbstractTarantoolClient
public AbstractTarantoolClient(TarantoolClientConfig config)
Create a client.- Parameters:
config
- the client configuration- See Also:
TarantoolClientConfig
-
AbstractTarantoolClient
protected AbstractTarantoolClient(TarantoolClientConfig config, ConnectionSelectionStrategyFactory selectionStrategyFactory, TarantoolConnectionListeners listeners)
Deprecated.Create a client, specifying the connection established event listeners.- Parameters:
config
- the client configurationselectionStrategyFactory
- instantiates strategies which provide the algorithm of selecting connections from the connection pool for performing the next requestlisteners
- connection established event listeners- See Also:
TarantoolClientConfig
-
AbstractTarantoolClient
public AbstractTarantoolClient(TarantoolClientConfig config, TarantoolConnectionListeners listeners)
Create a client, specifying the connection established event listeners.- Parameters:
config
- the client configurationlisteners
- connection established event listeners- See Also:
TarantoolClientConfig
-
-
Method Detail
-
connectionManager
protected abstract TarantoolConnectionManager connectionManager(TarantoolClientConfig config, TarantoolConnectionFactory connectionFactory, TarantoolConnectionListeners listeners)
Provides a connection manager for Tarantool server connections- Parameters:
config
- contains Tarantool client configuration optionsconnectionFactory
- provides helper methods for connection instantiationlisteners
- listeners which will be invoked once all connections are established- Returns:
- connection manager
-
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
-
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
-
space
public TarantoolSpaceOperations<T,R> space(String spaceName) 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:
spaceName
- name of the space, must not be null or empty- Returns:
- Tarantool space operations interface
- Throws:
TarantoolClientException
- if the client is not connected
-
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
-
spaceOperations
protected abstract TarantoolSpaceOperations<T,R> spaceOperations(TarantoolClientConfig config, TarantoolConnectionManager connectionManager, TarantoolMetadataOperations metadata, TarantoolSpaceMetadata spaceMetadata)
Creates a space API implementation instance for the specified space- Parameters:
config
- Tarantool client configurationconnectionManager
- configured internal connection managermetadata
- 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
-
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> tupleClass) 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 emptytupleClass
- 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> tupleClass) 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 entitiestupleClass
- 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> tupleClass) 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 conversiontupleClass
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, Class<S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, ValueConverter<org.msgpack.value.Value,S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, CallResultMapper<S,SingleValueCallResult<S>> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, Class<S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, ValueConverter<org.msgpack.value.Value,S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, CallResultMapper<S,SingleValueCallResult<S>> 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:
S
- 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
-
callForSingleResult
public <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, Class<S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, ValueConverter<org.msgpack.value.Value,S> 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:
S
- 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 <S> CompletableFuture<S> callForSingleResult(String functionName, List<?> arguments, MessagePackObjectMapper argumentsMapper, CallResultMapper<S,SingleValueCallResult<S>> 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:
S
- 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
-
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
-
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
-
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
-
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
-
getBootstrap
protected io.netty.bootstrap.Bootstrap getBootstrap()
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
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
-
-