Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from coreos/master
Browse files Browse the repository at this point in the history
fetch latest jetcd changes
  • Loading branch information
arikalcide authored Nov 26, 2017
2 parents 946109a + 6e83919 commit 1fce1fc
Show file tree
Hide file tree
Showing 214 changed files with 10,115 additions and 3,678 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.*
!.gitignore
!.travis.yml
target/
*.iml
logs/
Expand Down
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
24 changes: 19 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
sudo: required
install: true
language: java
sudo: false

services:
- docker

before_install:
- curl -s "https://get.sdkman.io" | bash
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk version
- mkdir -p "$HOME/.sdkman/etc"
- echo "sdkman_auto_answer=true" > "$HOME/.sdkman/etc/config"
- echo "sdkman_auto_selfupdate=true" >> "$HOME/.sdkman/etc/config"
- sdk install java 8u144-zulu

script:
- scripts/run_etcd.sh
- mvn clean verify
jdk:
- oraclejdk8
- ./etc/scripts/run_etcd_docker.sh
- sdk use java 8u144-zulu
- java -version
- ./mvnw clean install
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# How to contribute

jetcd is Apache 2.0 licensed and accepts contributions via GitHub pull requests. This document outlines some of the conventions on commit message formatting, contact points for developers, and other resources to help get contributions into etcd.

# Email and chat

- Email: [etcd-dev](https://groups.google.com/forum/?hl=en#!forum/etcd-dev)
- IRC: #[etcd](irc://irc.freenode.org:6667/#etcd) IRC channel on freenode.org

## Getting started

- Fork the repository on GitHub

## Reporting bugs and creating issues

Reporting bugs is one of the best ways to contribute. However, a good bug report has some very specific qualities, so please read over our short document on [reporting bugs](https://github.com/coreos/etcd/blob/master/Documentation/reporting_bugs.md) before submitting a bug report. This document might contain links to known issues, another good reason to take a look there before reporting a bug.

## Contribution flow

This is a rough outline of what a contributor's workflow looks like:

- Create a topic branch from where to base the contribution. This is usually master.
- Make commits of logical units.
- Make sure commit messages are in the proper format (see below).
- Push changes in a topic branch to a personal fork of the repository.
- Submit a pull request to coreos/jetcd.
- The PR must receive a LGTM from at least one maintainer found in the [MAINTAINERS](https://github.com/coreos/etcd/blob/master/MAINTAINERS) file.

Thanks for contributing!

### Code style

The coding style follows Google Java Style. See the [style doc](https://google.github.io/styleguide/javaguide.html) for details.

Please follow this style to make jetcd easy to review, maintain, and develop.

### Format of the commit message

We follow a rough convention for commit messages that is designed to answer two
questions: what changed and why. The subject line should feature the what and
the body of the commit should describe the why.

```
scripts: add the test-cluster command
this uses tmux to setup a test cluster that can easily be killed and started for debugging.
Fixes #38
```

The format can be described more formally as follows:

```
<subsystem>: <what changed>
<BLANK LINE>
<why this change was made>
<BLANK LINE>
<footer>
```

The first line is the subject and should be no longer than 70 characters, the second line is always blank, and other lines should be wrapped at 80 characters. This allows the message to be easier to read on GitHub as well as in various git tools.
5 changes: 5 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fanmin Shi <[email protected]> (@fanminshi) pkg:*
Luca Burgazzoli <[email protected]> (@lburgazzoli) pkg:*
Xiang Li <[email protected]> (@xiang90) pkg:*
Anthony Romano <[email protected]> (@heyitsanthony) pkg:*

76 changes: 66 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
# jetcd - A Java client for etcd
# jetcd - A Java Client for etcd
[![Build Status](https://img.shields.io/travis/coreos/jetcd/master.svg?style=flat-square)](https://travis-ci.org/coreos/jetcd)
[![License](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![Maven Central](https://img.shields.io/maven-central/v/com/coreos/jetcd-core.svg?style=flat-square)](https://search.maven.org/#search%7Cga%7C1%7Ccoreos)
[![GitHub release](https://img.shields.io/github/release/coreos/jetcd.svg?style=flat-square)](https://github.com/coreos/jetcd/releases)

jetcd requires JDK 8 to work correctly.
jetcd is the official java client for [etcd](https://github.com/coreos/etcd)v3.

[![Build Status](https://travis-ci.org/coreos/jetcd.svg?branch=master)](https://travis-ci.org/coreos/jetcd)
> Note: jetcd is work-in-progress and may break backward compatibility.
## Getting started
## Java Versions

Java 8 or above is required.

## Download

### Maven
```xml
<dependency>
<groupId>com.coreos</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.0.1</version>
</dependency>
```

Development snapshots are available in [Sonatypes's snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/).

### Gradle

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

### Manual

Download latest jetcd-core jar from [Maven](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.coreos%22%20AND%20v%3A%220.0.1%22) and all its dependent jars:

[grpc-core-1.5.0.jar](http://repo1.maven.org/maven2/io/grpc/grpc-core/1.5.0/)
[grpc-netty-1.5.0.jar](http://repo1.maven.org/maven2/io/grpc/grpc-netty/1.5.0/)
[grpc-protobuf-1.5.0.jar](http://repo1.maven.org/maven2/io/grpc/grpc-protobuf/1.5.0/)
[grpc-stub-1.5.0.jar](http://repo1.maven.org/maven2/io/grpc/grpc-stub/1.5.0/)
[slf4j-api-1.7.2.jar](http://repo1.maven.org/maven2/org/apache/directory/studio/org.slf4j.api/1.7.2/)

### Usage

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

ByteSequence key = ByteSequence.fromString("test_key");
Expand All @@ -19,21 +56,31 @@ ByteSequence value = ByteSequence.fromString("test_value");
// put the key-value
kvClient.put(key, value).get();
// get the CompletableFuture
CompletableFuture<RangeResponse> getFuture = kvClient.get(key);
CompletableFuture<GetResponse> getFuture = kvClient.get(key);
// get the value from CompletableFuture
RangeResponse response = getFuture.get();
GetResponse response = getFuture.get();
// delete the key
DeleteRangeResponse deleteRangeResponse = kvClient.delete(key).get();
DeleteResponse deleteRangeResponse = kvClient.delete(key).get();
```

For full etcd v3 API, plesase refer to [API_Reference](https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_reference_v3.md).

### Examples

The [examples](https://github.com/coreos/jetcd/tree/master/jetcd-examples) are standalone projects that show usage of jetcd.

## Versioning

The project follows [Semantic Versioning](http://semver.org/).

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](scripts/run_etcd.sh) shell script:
The project is to be tested against a three node `etcd` setup, launched by the [scripts/run_etcd.sh](etc/scripts/run_etcd.sh) shell script:

```
./scripts/run_etcd.sh
./etc/scripts/run_etcd.sh
```

It should work on either macOS or Linux.
Expand Down Expand Up @@ -84,6 +131,15 @@ Tests run: 37, Failures: 0, Errors: 0, Skipped: 0
## Contact

* Mailing list: [etcd-dev](https://groups.google.com/forum/?hl=en#!forum/etcd-dev)
* IRC: #[etcd](irc://irc.freenode.org:6667/#etcd) on freenode.org

## Contributing

See [CONTRIBUTING](https://github.com/coreos/jetcd/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow.

## Reporting bugs

See [reporting bugs](https://github.com/coreos/etcd/blob/master/Documentation/reporting_bugs.md) for details about reporting any issues.

## License

Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions etc/checkstyle-header-java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright 2017 The jetcd authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
30 changes: 24 additions & 6 deletions properties/checkstyle.xml → etc/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
<?xml version="1.0"?>
<!--
Copyright 2017 The jetcd authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
Expand Down Expand Up @@ -27,15 +44,16 @@
<property name="eachLine" value="true"/>
</module>

<!--
configure a filter to suppress audit events between a comment
containing CHECKSTYLE:OFF and a comment containing CHECKSTYLE:ON:

source: http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter
-->
<module name="SuppressionCommentFilter"/>

<module name="TreeWalker">
<!--
configure a filter to suppress audit events between a comment
containing CHECKSTYLE:OFF and a comment containing CHECKSTYLE:ON:
source: http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter
-->
<module name="SuppressionCommentFilter"/>
<module name="FileContentsHolder"/>
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
Expand Down
13 changes: 13 additions & 0 deletions etc/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2017 The jetcd authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
22 changes: 19 additions & 3 deletions scripts/run_etcd.sh → etc/scripts/run_etcd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#!/bin/bash

ETCD_VERSION="v3.2.1"
#
# Copyright 2017 The jetcd authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


ETCD_VERSION="v3.2.9"
OS=`uname`

if [[ $OS =~ ^Darwin ]]; then
Expand Down Expand Up @@ -31,7 +47,7 @@ cd ${DIRNAME}

./etcd --version

nohup bash -c './etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof&'
nohup bash -c './etcd --name infra1 --listen-client-urls http://127.0.0.1:12379 --advertise-client-urls http://127.0.0.1:12379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof&'

nohup bash -c './etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof&'

Expand Down
Loading

0 comments on commit 1fce1fc

Please sign in to comment.