Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Collection instead of List as arguments type in TarantoolClient #431

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
target/
.idea/
.settings/
.classpath
.project
.rocks/
tmp/
*.iml
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Internal and API changes

- **[breaking change]** replace `List` type with `Collection` for the `arguments` client API method parameters
- Bump testcontainers-java-tarantool to 1.0.1 ([#400](https://github.com/tarantool/cartridge-java/issues/400))
- Add `"mode"` option for select operation ([#107](https://github.com/tarantool/cartridge-java/issues/107))
- Change using of proxy client parameters (`mode`, `rollback_on_error`, `stop_on_error`) with enum classes ([#419](https://github.com/tarantool/cartridge-java/issues/419))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public interface MessagePackMapperBuilder {
*/
MessagePackMapperBuilder withDefaultArrayValueConverter();

/**
* Configure the mapper with default {@link Collection} to {@code MP_ARRAY} entity converter
*
* @return builder
*/
MessagePackMapperBuilder withDefaultCollectionObjectConverter();

/**
* Configure the mapper with default {@link List} to {@code MP_ARRAY} entity converter
*
Expand Down
37 changes: 19 additions & 18 deletions src/main/java/io/tarantool/driver/api/TarantoolCallOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.tarantool.driver.mappers.factories.ResultMapperFactoryFactory;
import org.msgpack.value.Value;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
Expand Down Expand Up @@ -51,7 +52,7 @@ public interface TarantoolCallOperations {
* @return some result
* @throws TarantoolClientException if the client is not connected or some other error occurred
*/
CompletableFuture<List<?>> call(String functionName, List<?> arguments) throws TarantoolClientException;
CompletableFuture<List<?>> call(String functionName, Collection<?> arguments) throws TarantoolClientException;

/**
* Execute a function defined on Tarantool instance
Expand All @@ -62,7 +63,7 @@ public interface TarantoolCallOperations {
* @return some result
* @throws TarantoolClientException if the client is not connected
*/
CompletableFuture<List<?>> call(String functionName, List<?> arguments, MessagePackMapper mapper)
CompletableFuture<List<?>> call(String functionName, Collection<?> arguments, MessagePackMapper mapper)
throws TarantoolClientException;

/**
Expand Down Expand Up @@ -108,7 +109,7 @@ <T> CompletableFuture<T> call(
*/
<T> CompletableFuture<TarantoolResult<T>> callForTupleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
Class<T> entityClass)
throws TarantoolClientException;

Expand All @@ -125,7 +126,7 @@ <T> CompletableFuture<TarantoolResult<T>> callForTupleResult(
*/
<T> CompletableFuture<T> call(
String functionName,
List<?> arguments,
Collection<?> arguments,
CallResultMapper<T, SingleValueCallResult<T>> resultMapper)
throws TarantoolClientException;

Expand All @@ -144,7 +145,7 @@ <T> CompletableFuture<T> call(
*/
<T> CompletableFuture<TarantoolResult<T>> callForTupleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
Class<T> entityClass)
throws TarantoolClientException;
Expand All @@ -162,7 +163,7 @@ <T> CompletableFuture<TarantoolResult<T>> callForTupleResult(
*/
<T> CompletableFuture<T> call(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
CallResultMapper<T, SingleValueCallResult<T>> resultMapper)
throws TarantoolClientException;
Expand All @@ -181,7 +182,7 @@ <T> CompletableFuture<T> call(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
Class<T> resultClass)
throws TarantoolClientException;
Expand All @@ -200,7 +201,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
ValueConverter<Value, T> valueConverter)
throws TarantoolClientException;
Expand All @@ -219,7 +220,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
CallResultMapper<T, SingleValueCallResult<T>> resultMapper)
throws TarantoolClientException;
Expand All @@ -237,7 +238,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
Class<T> resultClass)
throws TarantoolClientException;

Expand All @@ -254,7 +255,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
ValueConverter<Value, T> valueConverter)
throws TarantoolClientException;

Expand All @@ -271,7 +272,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T> CompletableFuture<T> callForSingleResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
CallResultMapper<T, SingleValueCallResult<T>> resultMapper)
throws TarantoolClientException;

Expand Down Expand Up @@ -335,7 +336,7 @@ <T> CompletableFuture<T> callForSingleResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
Supplier<R> resultContainerSupplier,
Class<T> resultClass)
Expand All @@ -356,7 +357,7 @@ <T, R extends List<T>> CompletableFuture<R> callForMultiResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
Supplier<R> resultContainerSupplier,
ValueConverter<Value, T> valueConverter)
Expand All @@ -376,7 +377,7 @@ <T, R extends List<T>> CompletableFuture<R> callForMultiResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
CallResultMapper<R, MultiValueCallResult<T, R>> resultMapper)
throws TarantoolClientException;
Expand All @@ -395,7 +396,7 @@ <T, R extends List<T>> CompletableFuture<R> callForMultiResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
Supplier<R> resultContainerSupplier,
Class<T> resultClass)
throws TarantoolClientException;
Expand All @@ -414,7 +415,7 @@ <T, R extends List<T>> CompletableFuture<R> callForMultiResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
Supplier<R> resultContainerSupplier,
ValueConverter<Value, T> valueConverter)
throws TarantoolClientException;
Expand All @@ -432,7 +433,7 @@ <T, R extends List<T>> CompletableFuture<R> callForMultiResult(
*/
<T, R extends List<T>> CompletableFuture<R> callForMultiResult(
String functionName,
List<?> arguments,
Collection<?> arguments,
CallResultMapper<R, MultiValueCallResult<T, R>> resultMapper)
throws TarantoolClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.tarantool.driver.mappers.MessagePackObjectMapper;
import io.tarantool.driver.mappers.MessagePackValueMapper;

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

Expand Down Expand Up @@ -35,7 +36,7 @@ public interface TarantoolEvalOperations {
* @return some result
* @throws TarantoolClientException if the client is not connected
*/
CompletableFuture<List<?>> eval(String expression, List<?> arguments) throws TarantoolClientException;
CompletableFuture<List<?>> eval(String expression, Collection<?> arguments) throws TarantoolClientException;

/**
* Execute a Lua expression in the Tarantool instance. If a result is expected, the expression must start with
Expand All @@ -60,7 +61,7 @@ CompletableFuture<List<?>> eval(String expression, MessagePackValueMapper result
* @return some result
* @throws TarantoolClientException if the client is not connected
*/
CompletableFuture<List<?>> eval(String expression, List<?> arguments, MessagePackValueMapper resultMapper)
CompletableFuture<List<?>> eval(String expression, Collection<?> arguments, MessagePackValueMapper resultMapper)
throws TarantoolClientException;

/**
Expand All @@ -76,7 +77,7 @@ CompletableFuture<List<?>> eval(String expression, List<?> arguments, MessagePac
*/
CompletableFuture<List<?>> eval(
String expression,
List<?> arguments,
Collection<?> arguments,
MessagePackObjectMapper argumentsMapper,
MessagePackValueMapper resultMapper) throws TarantoolClientException;
}
Loading
Loading