Skip to content

Commit 507dd15

Browse files
committed
chore: readme version & code snippets update
1 parent cef1028 commit 507dd15

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

README.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ Just include immudb4j as a dependency in your project:
5555
<dependency>
5656
<groupId>io.codenotary</groupId>
5757
<artifactId>immudb4j</artifactId>
58-
<version>0.3.0</version>
58+
<version>0.9.0</version>
5959
</dependency>
6060
```
6161
- if using Gradle:
6262
```groovy
63-
compile 'io.codenotary:immudb4j:0.3.0'
63+
compile 'io.codenotary:immudb4j:0.9.0'
6464
```
6565

6666
`immudb4j` is currently hosted on both [Maven Central] and [Github Packages].
@@ -77,9 +77,9 @@ and _Configuring Gradle for use with GitHub Packages_ at [Github Packages].
7777

7878
## Supported Versions
7979

80-
immudb4j supports the [latest immudb release], that is 0.9.0 at the time of this writing.
80+
immudb4j supports the [latest immudb release], that is 0.9.1 at the time of this writing.
8181

82-
[latest immudb release]: https://github.com/codenotary/immudb/releases/tag/v0.9.0
82+
[latest immudb release]: https://github.com/codenotary/immudb/releases/tag/v0.9.1
8383

8484
## Quickstart
8585

@@ -108,25 +108,26 @@ Setting `immudb` url and port:
108108
.build();
109109
```
110110

111-
Customizing the `Root Holder`:
111+
Customizing the `State Holder`:
112112
```java
113-
FileRootHolder rootHolder = FileRootHolder.newBuilder()
114-
.setRootsFolder("./my_immuapp_roots")
115-
.build();
113+
FileImmuStateHolder stateHolder = FileImmuStateHolder.newBuilder()
114+
.setStatesFolder("./my_immuapp_roots")
115+
.build();
116116

117117
ImmuClient immuClient = ImmuClient.newBuilder()
118-
.withRootHolder(rootHolder)
118+
.setStateHolder(stateHolder)
119119
.build();
120120
```
121121

122-
### User sessions
122+
### User Sessions
123123

124124
Use `login` and `logout` methods to initiate and terminate user sessions:
125125

126126
```java
127127
immuClient.login("usr1", "pwd1");
128128

129129
// Interact with immudb using logged-in user.
130+
//...
130131

131132
immuClient.logout();
132133
```
@@ -147,7 +148,7 @@ Specify the active database with:
147148
immuClient.useDatabase("db1");
148149
```
149150

150-
### Traditional read and write
151+
### Standard Read and Write
151152

152153
immudb provides standard read and write operations that behave as in a traditional
153154
key-value store i.e. no cryptographic verification is involved. Such operations
@@ -167,54 +168,57 @@ read or write operation:
167168

168169
```java
169170
try {
170-
client.safeSet("k123", new byte[]{1, 2, 3});
171+
client.verifiedSet("k123", new byte[]{1, 2, 3});
171172

172-
byte[] v = client.safeGet("k123");
173+
byte[] v = client.verifiedGet("k123");
173174

174175
} (catch VerificationException e) {
175176

176-
//TODO: tampering detected!
177+
// Check if it is a data tampering detected case!
177178

178179
}
179180
```
180181

181-
### Multi-key read and write
182+
### Multi-key Read and Write
182183

183184
Transactional multi-key read and write operations are supported by immudb and immudb4j.
184185

185186
Atomic multi-key write (all entries are persisted or none):
186187

187188
```java
188-
KVList.KVListBuilder builder = KVList.newBuilder();
189-
190-
builder.add("k123", new byte[]{1, 2, 3});
191-
builder.add("k321", new byte[]{3, 2, 1});
192-
193-
KVList kvList = builder.build();
194-
195-
client.setAll(kvList);
189+
String key1 = "sga-key1";
190+
byte[] val1 = new byte[] { 1 };
191+
String key2 = "sga-key2";
192+
byte[] val2 = new byte[] { 2, 3 };
193+
194+
List<KV> kvs = Arrays.asList(
195+
new KVPair(key1, val1),
196+
new KVPair(key2, val2));
197+
198+
KVList kvList = KVList.newBuilder().addAll(kvs).build();
199+
try {
200+
immuClient.setAll(kvList);
201+
} catch (CorruptedDataException e) {
202+
// ...
203+
}
196204
```
197205

198206
Atomic multi-key read (all entries are retrieved or none):
199207

200208
```java
201-
List<String> keyList = new ArrayList<String>();
202-
203-
keyList.add("k123");
204-
keyList.add("k321");
205-
206-
List<KV> result = client.getAll(keyList);
209+
List<String> keys = Arrays.asList(key1, key2, key3);
210+
List<KV> result = immuClient.getAll(keys);
207211

208212
for (KV kv : result) {
209213
byte[] key = kv.getKey();
210214
byte[] value = kv.getValue();
211-
...
215+
// ...
212216
}
213217
```
214218

215219
### Closing the client
216220

217-
For closing the connection with immudb server use the `shutdown` operation:
221+
Apart from the `logout`, for closing the connection with immudb server use the `shutdown` operation:
218222

219223
```java
220224
immuClient.shutdown();

0 commit comments

Comments
 (0)