Skip to content

Commit 8a88042

Browse files
committed
Update ProxyTarantoolClient documentation
Update ProxyTarantoolClient documentation according to our new documentation policy Closes #307
1 parent 7f46c17 commit 8a88042

2 files changed

Lines changed: 7 additions & 39 deletions

File tree

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ with sharding via [vshard](https://github.com/tarantool/vshard).
1919
Example of single instance Tarantool application and java app connected using cartridge-java.
2020

2121
The easiest way to start experimenting with cartridge-java and single instance tarantool app is to use
22-
[single instance test](/src/test/java/io/tarantool/driver/integration/SingleInstanceExampleTest.java).
22+
[single instance test](/src/test/java/io/tarantool/driver/integration/SingleInstanceExampleIT.java).
2323
You can set breakpoints and run it in debug mode.
2424
Testcontainers will start [single instance tarantool application](src/test/resources/single-instance.lua) for you.
2525
So you will be able to manipulate data in Tarantool in real life through java expressions or Tarantool console.
@@ -34,9 +34,6 @@ https://github.com/tarantool/cartridge-java/blob/2f8e826deb9833a5deb6d21177527a4
3434
Example of client API usage
3535
https://github.com/tarantool/cartridge-java/blob/2f8e826deb9833a5deb6d21177527a46e8fdd039/src/test/java/io/tarantool/driver/integration/SingleInstanceExampleTest.java#L64-L79
3636

37-
You can read more about Cartridge applications in its [documentation](https://www.tarantool.io/ru/doc/latest/how-to/getting_started_cartridge/).
38-
Also look at available Cartridge application [examples](https://github.com/tarantool/examples).
39-
4037
If you use this code in another project don't forget to add `cartridge-driver` dependency:
4138
```xml
4239
<dependency>

docs/ProxyTarantoolClient.md

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,11 @@ This section shows the necessary settings for connecting to instances with a use
66
stored functions or Cartridge roles implementing the API similar to the one of [tarantool/crud](https://github.com/tarantool/crud).
77
Works with `tarantool/crud` 0.3.0+.
88

9-
See an example of how to set up a proxy client working with `tarantool/crud`:
9+
Example of TarantoolClient set up
10+
https://github.com/tarantool/cartridge-java/blob/67536ed2478794c414f7d0b291eaa5d35742fe4a/src/test/java/io/tarantool/driver/integration/ProxyTarantoolClientExampleIT.java#L45-L55
1011

11-
```java
12-
class Scratch {
13-
public static void main(String[] args) {
12+
Example of client API usage
13+
https://github.com/tarantool/cartridge-java/blob/8d094b784864ccf74a472fdd4f9419714374ca0b/src/test/java/io/tarantool/driver/integration/ProxyTarantoolClientExampleIT.java#L63-L104
1414

15-
TarantoolClient<TarantoolTuple, TarantoolResult<TarantoolTuple>> client = TarantoolClientFactory.createClient()
16-
.withAddress("123.123.123.1")
17-
// use the value of cluster_cookie parameter in the init.lua file in your Cartridge application
18-
.withCredentials("admin", "secret-cluster-cookie")
19-
.withProxyMethodMapping()
20-
// also you may use a lambda function for specifying the proxy methods' names
21-
.withProxyMethodMapping(builder -> builder.withSelectFunctionName("customSelect"))
22-
.build();
23-
24-
TarantoolSpaceOperations<TarantoolTuple, TarantoolResult<TarantoolTuple>> testSpace = client.space("testSpace");
25-
26-
// Use TarantoolTupleFactory for instantiating new tuples
27-
TarantoolTupleFactory tupleFactory = new DefaultTarantoolTupleFactory(client.getConfig().getMessagePackMapper());
28-
// Pass the field corresponding to bucket_id as null for tarantool/crud to compute it automatically
29-
TarantoolTuple tuple = tupleFactory.create(1_000_000, null, "profile_name");
30-
// Primary index key value will be determined from the tuple
31-
Conditions conditions = Conditions.after(tuple);
32-
TarantoolResult<TarantoolTuple> updateResult = testSpace.update(conditions, tuple).get();
33-
34-
Conditions conditions = Conditions.greaterOrEquals("profile_id", 1_000_000);
35-
// crud.select(...) on the Cartridge router will be called internally
36-
TarantoolResult<TarantoolTuple> selectResult = testSpace.select(conditions).get();
37-
assertEquals(20, selectResult.size());
38-
39-
// Any other operations with tuples as described in the examples above
40-
...
41-
42-
client.close();
43-
}
44-
}
45-
```
15+
You can read more about Cartridge applications in its [documentation](https://www.tarantool.io/ru/doc/latest/how-to/getting_started_cartridge/).
16+
Also look at available Cartridge application [examples](https://github.com/tarantool/examples).

0 commit comments

Comments
 (0)