Coder Social home page Coder Social logo

jetcd's Introduction

jetcd - A Java Client for etcd

Build Status License Maven Central GitHub release

jetcd is the official java client for etcdv3.

Note: jetcd is work-in-progress and may break backward compatibility.

Java Versions

Java 8 or above is required.

Download

Maven

<dependency>
  <groupId>com.coreos</groupId>
  <artifactId>jetcd-core</artifactId>
  <version>0.0.1</version>
</dependency>

Development snapshots are available in Sonatypes's snapshot repository.

Gradle

dependencies {
    compile 'com.coreos:jetcd-core:0.0.1'
}

Manual

Download latest jetcd-core jar from Maven and all its dependent jars:

grpc-core-1.5.0.jar grpc-netty-1.5.0.jar grpc-protobuf-1.5.0.jar grpc-stub-1.5.0.jar slf4j-api-1.7.2.jar

Usage

// create client
Client client = Client.builder().endpoints("http://localhost:2379").build();
KV kvClient = client.getKVClient();

ByteSequence key = ByteSequence.fromString("test_key");
ByteSequence value = ByteSequence.fromString("test_value");

// put the key-value
kvClient.put(key, value).get();
// get the CompletableFuture
CompletableFuture<GetResponse> getFuture = kvClient.get(key);
// get the value from CompletableFuture
GetResponse response = getFuture.get();
// delete the key
DeleteResponse deleteRangeResponse = kvClient.delete(key).get();

For full etcd v3 API, plesase refer to API_Reference.

Examples

The examples are standalone projects that show usage of jetcd.

Versioning

The project follows Semantic Versioning.

The current major version is zero (0.y.z). Anything may change at any time. The public API should not be considered stable.

Running tests

The project is to be tested against a three node etcd setup, launched by the scripts/run_etcd.sh shell script:

./etc/scripts/run_etcd.sh

It should work on either macOS or Linux.

Note: Make sure you don't have a default etcd running on your system! The script uses the default port 2379 for the first node, which fails to launch if that port is already taken.

mvn test
...

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Feb 23, 2017 6:40:18 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@48a242ce] Created with target etcd
Feb 23, 2017 6:40:18 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@20d3d15a] Created with target etcd
Feb 23, 2017 6:40:18 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@548a102f] Created with target etcd
Feb 23, 2017 6:40:18 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@17c386de] Created with target etcd
Feb 23, 2017 6:40:19 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@25d250c6] Created with target etcd
Feb 23, 2017 6:40:27 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@3eb7fc54] Created with target etcd
Feb 23, 2017 6:40:27 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@6ef888f6] Created with target etcd
Feb 23, 2017 6:40:33 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@49b0b76] Created with target etcd
Feb 23, 2017 6:40:33 PM io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@6f96c77] Created with target etcd
Tests run: 37, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.797 sec - in TestSuite

Results :

Tests run: 37, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.229 s
[INFO] Finished at: 2017-02-23T18:40:34+02:00
[INFO] Final Memory: 37M/587M
[INFO] ------------------------------------------------------------------------

Contact

  • Mailing list: etcd-dev
  • IRC: #etcd on freenode.org

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

Reporting bugs

See reporting bugs for details about reporting any issues.

License

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

jetcd's People

Contributors

fanminshi avatar xiang90 avatar lburgazzoli avatar stupidhod avatar adohe avatar heyitsanthony avatar skyao avatar oscerd avatar hongchaodeng avatar oza avatar grisu118 avatar ikonglong avatar scienjus avatar stonelion avatar thilinamanamgoda avatar dowenliu-xyz avatar donsonx avatar raoofm avatar paoloantinori avatar gavvvr avatar joshua-jin avatar ericchiang avatar emiapwil avatar danielrohe avatar

Watchers

James Cloos avatar Bryan Tidd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.