Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.13 KB

README.md

File metadata and controls

37 lines (25 loc) · 1.13 KB

jetcd

Build Status

Java client for etcd v3.

Getting started

Usage

EtcdClient client = EtcdClientBuilder.newBuilder().endpoints("http://localhost:2379").build();
EtcdKV kvClient = client.getKVClient();

ByteString key = ByteString.copyFrom("test_key", "UTF-8");
ByteString value = ByteString.copyFrom("test_value", "UTF-8");

// put the key-value
kvClient.put(key, value).get();
// get the value
ListenableFuture<RangeResponse> getFeature = kvClient.get(key);
RangeResponse response = getFeature.get();
assertEquals(response.getKvsCount(), 1);
assertEquals(response.getKvs(0).getValue().toStringUtf8(), "test_value");
// delete the key
kvClient.delete(key).get()

For full etcd v3 API, plesase refer to API_Reference.

Contact

License

jetcd is under the Apache 2.0 license. See the LICENSE file for details.