Elffuss BraidHub

kikocis/java-driver public

Bootstrapping the self-hosted documentation for version 2.0.10
Changesetdb652e0543ae0a75bc04957ef4c7d0913cdfc88327a85f9605e8951897b5351a
AuthorAlexandre Dutra <alexdut@gmail.com> · 2015-03-12 17:27 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2015-05-04 12:53 +02:00
Parents08d1b5f9e8e0

Browse the files at this changeset

8 files changed

added README.md +137 −0
@@ -0,0 +1,137 @@
1+# Datastax Java Driver for Apache Cassandra
2+
3+![Travis Build](https://travis-ci.org/datastax/java-driver.svg?branch=2.0)
4+
5+*If you're reading this on github.com, please note that this is the readme
6+for the development version and that some features described here might
7+not yet have been released. You can find the documentation for latest
8+version through [Java driver
9+docs](http://datastax.github.io/java-driver/) or via the release tags,
10+[e.g.
11+2.0.10](https://github.com/datastax/java-driver/tree/2.0.10).*
12+
13+A modern, [feature-rich](features/) and highly tunable Java client
14+library for Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using
15+exclusively Cassandra's binary protocol and Cassandra Query Language v3.
16+
17+**Features:**
18+
19+* [Sync][sync] and [Async][async] API
20+* [Simple][simple_st], [Prepared][prepared_st], and [Batch][batch_st] statements
21+* Asynchronous IO, parallel execution, request pipelining
22+* [Connection pooling][pool]
23+* Auto node discovery
24+* Automatic reconnection
25+* Configurable [load balancing][lbp] and [retry policies][retry_policy]
26+* Works with any cluster size
27+* [Query builder][query_builder]
28+
29+[sync]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#execute(com.datastax.driver.core.Statement)
30+[async]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
31+[simple_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/SimpleStatement.html
32+[prepared_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#prepare(com.datastax.driver.core.RegularStatement)
33+[batch_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/BatchStatement.html
34+[pool]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/PoolingOptions.html
35+[lbp]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html
36+[retry_policy]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/RetryPolicy.html
37+[query_builder]: http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/querybuilder/QueryBuilder.html
38+
39+The driver architecture is based on layers. At the bottom lies the driver core.
40+This core handles everything related to the connections to a Cassandra
41+cluster (for example, connection pool, discovering new nodes, etc.) and exposes a simple,
42+relatively low-level API on top of which higher level layers can be built.
43+
44+The driver contains the following modules:
45+
46+- driver-core: the core layer.
47+- driver-examples: example applications using the other modules which are
48+ only meant for demonstration purposes.
49+
50+More modules including a simple object mapper will come shortly.
51+
52+Please refer to the README of each module for more information.
53+
54+**Community:**
55+
56+- JIRA: https://datastax-oss.atlassian.net/browse/JAVA
57+- MAILING LIST: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
58+- IRC: #datastax-drivers on [irc.freenode.net](http://freenode.net)
59+- TWITTER: Follow the latest news about DataStax Drivers - [@olim7t](http://twitter.com/olim7t), [@mfiguiere](http://twitter.com/mfiguiere)
60+- DOCS: http://www.datastax.com/documentation/developer/java-driver/2.0/index.html
61+- API: http://www.datastax.com/drivers/java/2.0
62+- CHANGELOG: https://github.com/datastax/java-driver/blob/2.0/driver-core/CHANGELOG.rst
63+
64+## What's new in 2.0.10
65+
66+* [Speculative query execution](features/speculative_execution/)
67+* [Query logger](features/logging/#logging-query-latencies)
68+* Access to the [paging state](features/paging/#manual-paging)
69+* Don't mark hosts down on client timeouts, and remove "suspected"
70+ mechanism
71+* Upgrade to Netty 4 and internal improvements around connection
72+ handling
73+* New connection pool resizing algorithm
74+* [Connection heartbeat](features/pooling/#heartbeat)
75+* Address translation for [EC2
76+ multi-region](features/address_resolution/#ec2-multi-region) deployments
77+* Changes to [dependency shading](features/shaded_jar/), and fixes to
78+ OSGI deployment descriptors
79+* Expose [token metadata](features/metadata/#token-metadata)
80+
81+For the full list of tickets, refer to the
82+[changelog](https://github.com/datastax/java-driver/blob/2.0/driver-core/CHANGELOG.rst).
83+
84+## Maven
85+
86+The last release of the driver is available on Maven Central. You can install
87+it in your application using the following Maven dependency:
88+
89+```xml
90+<dependency>
91+ <groupId>com.datastax.cassandra</groupId>
92+ <artifactId>cassandra-driver-core</artifactId>
93+ <version>2.0.10</version>
94+</dependency>
95+```
96+
97+We also provide a [shaded JAR](http://datastax.github.io/java-driver/features/shaded_jar/)
98+to avoid the explicit dependency to Netty.
99+
100+## Compatibility
101+
102+The Java client driver 2.0 ([branch 2.0](https://github.com/datastax/java-driver/tree/2.0)) is compatible with Apache
103+Cassandra 1.2 and 2.0, but some features are available only when using Apache Cassandra 2.0 (e.g. result set paging,
104+[BatchStatement](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java),
105+[lightweight transactions](http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html)
106+-- see [What's new in Cassandra 2.0](http://www.datastax.com/documentation/cassandra/2.0/cassandra/features/features_key_c.html)).
107+Trying to use these with a cluster running Cassandra 1.2 will result in
108+an [UnsupportedFeatureException](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java) being thrown.
109+
110+## Upgrading from 1.x branch
111+
112+If you are upgrading from the 1.x branch of the driver, be sure to have a look at
113+the [upgrade guide](https://github.com/datastax/java-driver/blob/2.0/driver-core/Upgrade_guide_to_2.0.rst).
114+
115+We used the opportunity of a major version bump to incorporate your feedback and improve the API,
116+to fix a number of inconsistencies and remove cruft.
117+Unfortunately this means there are some breaking changes, but the new API should be both simpler and more complete.
118+
119+### Troubleshooting
120+
121+If you are having issues connecting to the cluster (seeing `NoHostAvailableConnection` exceptions) please check the
122+[connection requirements](https://github.com/datastax/java-driver/wiki/Connection-requirements).
123+
124+## License
125+Copyright 2012-2015, DataStax
126+
127+Licensed under the Apache License, Version 2.0 (the "License");
128+you may not use this file except in compliance with the License.
129+You may obtain a copy of the License at
130+
131+http://www.apache.org/licenses/LICENSE-2.0
132+
133+Unless required by applicable law or agreed to in writing, software
134+distributed under the License is distributed on an "AS IS" BASIS,
135+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136+See the License for the specific language governing permissions and
137+limitations under the License.
deleted README.rst +0 −94
@@ -1,94 +0,0 @@
1-DataStax Java Driver for Apache Cassandra
2-=========================================
3-
4-.. image:: https://travis-ci.org/datastax/java-driver.svg?branch=2.0
5- :target: https://travis-ci.org/datastax/java-driver
6- :alt: Travis Build
7-
8-A Java client driver for Apache Cassandra. This driver works exclusively with
9-the Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol.
10-
11-- JIRA: https://datastax-oss.atlassian.net/browse/JAVA
12-- MAILING LIST: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
13-- IRC: #datastax-drivers on `irc.freenode.net <http://freenode.net>`_
14-- TWITTER: Follow the latest news about DataStax Drivers - `@olim7t <http://twitter.com/olim7t>`_, `@mfiguiere <http://twitter.com/mfiguiere>`_
15-- DOCS: http://www.datastax.com/documentation/developer/java-driver/2.0/index.html
16-- API: http://www.datastax.com/drivers/java/2.0
17-- CHANGELOG: https://github.com/datastax/java-driver/blob/2.0/driver-core/CHANGELOG.rst
18-
19-
20-The driver architecture is based on layers. At the bottom lies the driver core.
21-This core handles everything related to the connections to a Cassandra
22-cluster (for example, connection pool, discovering new nodes, etc.) and exposes a simple,
23-relatively low-level API on top of which higher level layer can be built.
24-
25-The driver contains the following modules:
26- - driver-core: the core layer.
27- - driver-examples: example applications using the other modules which are
28- only meant for demonstration purposes.
29-
30-More modules including a simple object mapper will come shortly.
31-
32-Please refer to the README of each module for more information.
33-
34-
35-Maven
36------
37-
38-The last release of the driver is available on Maven Central. You can install
39-it in your application using the following Maven dependency::
40-
41- <dependency>
42- <groupId>com.datastax.cassandra</groupId>
43- <artifactId>cassandra-driver-core</artifactId>
44- <version>2.0.9.2</version>
45- </dependency>
46-
47-Compatibility
48--------------
49-
50-The Java client driver 2.0 (`branch 2.0 <https://github.com/datastax/java-driver/tree/2.0>`_) is compatible with Apache
51-Cassandra 1.2 and 2.0, but some features are available only when using Apache Cassandra 2.0 (e.g. result set paging,
52-`BatchStatement <https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java>`_,
53-`lightweight transactions <http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html>`_
54--- see `What's new in Cassandra 2.0 <http://www.datastax.com/documentation/cassandra/2.0/cassandra/features/features_key_c.html>`_).
55-Trying to use these with a cluster running Cassandra 1.2 will result in
56-an `UnsupportedFeatureException <https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java>`_ being thrown.
57-
58-
59-Upgrading from 1.x branch
60--------------------------
61-
62-
63-If you are upgrading from the 1.x branch of the driver, be sure to have a look at
64-the `upgrade guide <https://github.com/datastax/java-driver/blob/2.0/driver-core/Upgrade_guide_to_2.0.rst>`_.
65-
66-We used the opportunity of a major version bump to incorporate your feedback and improve the API,
67-to fix a number of inconsistencies and remove cruft.
68-Unfortunately this means there are some breaking changes, but the new API should be both simpler and more complete.
69-
70-
71-Troubleshooting
72-~~~~~~~~~~~~~~~
73-
74-If you are having issues connecting to the cluster (seeing ``NoHostAvailableConnection`` exceptions) please check the
75-`connection requirements <https://github.com/datastax/java-driver/wiki/Connection-requirements>`_.
76-
77-
78-
79-
80-License
81--------
82-Copyright 2012-2014, DataStax
83-
84-Licensed under the Apache License, Version 2.0 (the "License");
85-you may not use this file except in compliance with the License.
86-You may obtain a copy of the License at
87-
88-http://www.apache.org/licenses/LICENSE-2.0
89-
90-Unless required by applicable law or agreed to in writing, software
91-distributed under the License is distributed on an "AS IS" BASIS,
92-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
93-See the License for the specific language governing permissions and
94-limitations under the License.
added docs.yaml +24 −0
@@ -0,0 +1,24 @@
1+# This is provided on the 2.0 branch for convenience. Use docs.yaml from the
2+# 2.1 branch to generate the docs for all versions.
3+title: Java Driver for Apache Cassandra
4+summary: High performance Java client for Apache Cassandra
5+homepage: http://datastax.github.io/java-driver/
6+sections:
7+ - title: Features
8+ prefix: /features
9+ sources:
10+ - type: markdown
11+ files: 'features/**/*.md'
12+links:
13+ - title: Code
14+ href: https://github.com/datastax/java-driver/
15+ - title: Docs
16+ href: http://datastax.github.io/java-driver/
17+ - title: Issues
18+ href: https://datastax-oss.atlassian.net/browse/JAVA/
19+ - title: Mailing List
20+ href: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
21+ - title: IRC Channel
22+ href: irc://irc.freenode.net/datastax-drivers
23+ - title: Releases
24+ href: https://github.com/datastax/java-driver/releases
modified driver-core/src/main/java/com/datastax/driver/core/package-info.java +1 −1
@@ -16,6 +16,6 @@
1616 /**
1717 * The main package for the DataStax Java driver for Cassandra.
1818 * <p>
19- * The main entry for this package is the {@code Cluster} class.
19+ * The main entry for this package is the {@link com.datastax.driver.core.Cluster} class.
2020 */
2121 package com.datastax.driver.core;
added features/README.md +7 −0
@@ -0,0 +1,7 @@
1+## Features
2+
3+This documentation is a work in progress. Use the "Read More" menu on the right hand side to browse currently documented features.
4+
5+You can also refer to the
6+[user documentation](http://www.datastax.com/documentation/developer/java-driver/2.1/java-driver/whatsNew2.html)
7+on the DataStax website.
No newline at the end of the file
added features/address_resolution/README.md +67 −0
@@ -0,0 +1,67 @@
1+## Address resolution
2+
3+The driver auto-detects new Cassandra nodes added to the cluster through server
4+side push notifications and through checking the system tables.
5+
6+For each node, the address the driver will receive will correspond to the address set as
7+`rpc_address` in the node's `cassandra.yaml` file. In most cases, this is the correct value.
8+However, sometimes the addresses received through this mechanism will either not be
9+reachable directly by the driver, or should not be the preferred address to use
10+(for instance, it might be a private IP, but some clients may have to use a public IP, or
11+go through a router).
12+
13+### The [AddressTranslater][at] interface
14+
15+This interface allows you to deal with such cases, by transforming the address sent by a
16+Cassandra node to another address to be used by the driver for connection.
17+
18+```java
19+public class MyAddressTranslater implements AddressTranslater {
20+ public InetSocketAddress translate(InetSocketAddress address) {
21+ ... // your custom translation logic
22+ }
23+}
24+
25+Cluster cluster = Cluster.builder()
26+ .addContactPoint("1.2.3.4")
27+ .withAddressTranslater(new MyAddressTranslater())
28+ .build();
29+```
30+
31+Notes:
32+
33+* the contact points provided while creating the `Cluster` are not translated, only addresses
34+ retrieved from or sent by Cassandra nodes are;
35+* you might want to implement [CloseableAddressTranslater][cat] if your
36+ implementation has state that should be cleaned up when the `Cluster`
37+ shuts down. This is provided as a separate interface for historical
38+ reasons, the `close()` method will be merged in `AddressTranslater` in a
39+ future release.
40+
41+[at]: http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/AddressTranslater.html
42+[cat]: http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/CloseableAddressTranslater.html
43+
44+### EC2 multi-region
45+
46+[EC2MultiRegionAddressTranslater][ec2] is provided out of the box. It
47+helps optimize network costs when your infrastructure (both Cassandra
48+nodes *and* clients) is distributed across multiple Amazon EC2 regions:
49+
50+* a client communicating with a Cassandra node *in the same EC2 region* should use the node's
51+ private IP (which is less expensive);
52+* a client communicating with a node in a different region should use the public IP.
53+
54+To use this implementation, provide an instance when initializing the `Cluster`:
55+
56+```java
57+Cluster cluster = Cluster.builder()
58+ .addContactPoint("1.2.3.4")
59+ .withAddressTranslater(new EC2MultiRegionAddressTranslater())
60+ .build();
61+```
62+
63+This class performs a reverse DNS lookup of the origin address, to find the domain name of the
64+target instance. Then it performs a forward DNS lookup of the domain name; the EC2 DNS does the
65+private/public switch automatically based on location.
66+
67+[ec2]: http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/EC2MultiRegionAddressTranslater.html
added features/heartbeat/README.md +42 −0
@@ -0,0 +1,42 @@
1+## Connection heartbeat
2+
3+If connections stay idle for too long, they might be dropped by
4+intermediate network devices (routers, firewalls...). Normally, TCP
5+keepalive should take care of this; but tweaking low-level keepalive
6+settings might be impractical in some environments.
7+
8+The driver provides application-side keepalive in the form of a
9+connection heartbeat: when a connection has been idle for a given amount
10+of time, the driver will simulate activity by writing a dummy request to
11+it.
12+
13+This feature is enabled by default. The default heartbeat interval is 30
14+seconds, it can be customized through `PoolingOptions`:
15+
16+```java
17+cluster.getConfiguration().getPoolingOptions()
18+ .setHeartbeatIntervalSeconds(60);
19+```
20+
21+This can be changed at runtime, but only connections created after that
22+will use the new interval. Most users will want to do this at startup:
23+
24+```java
25+Cluster cluster = Cluster.builder()
26+ .addContactPoint("127.0.0.1")
27+ .withPoolingOptions(new PoolingOptions()
28+ .setHeartbeatIntervalSeconds(60))
29+ .build();
30+```
31+
32+The heartbeat interval should be set higher than
33+[SocketOptions.readTimeoutMillis](http://www.datastax.com/drivers/java/2.1/com/datastax/driver/core/SocketOptions.html#getReadTimeoutMillis()):
34+the read timeout is the maximum time that the driver waits for a regular
35+query to complete, therefore the connection should not be considered
36+idle before it has elapsed.
37+
38+To disable heartbeat, set the interval to 0.
39+
40+Implementation note: the dummy request sent by heartbeat is an
41+[OPTIONS](https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v3.spec#L278)
42+message.
added features/shaded_jar/README.md +26 −0
@@ -0,0 +1,26 @@
1+## Using the shaded JAR
2+
3+The default driver JAR depends on [Netty](http://netty.io/), which is
4+used internally for networking.
5+
6+This explicit dependency can be a problem if your application already
7+uses another Netty version. To avoid conflicts, we provide a "shaded"
8+version of the JAR, which bundles the Netty classes under a different
9+package name:
10+
11+```xml
12+<dependency>
13+ <groupId>${project.groupId}</groupId>
14+ <artifactId>cassandra-driver-core</artifactId>
15+ <version>2.0.10</version>
16+ <classifier>shaded</classifier>
17+ <!-- Because the shaded JAR uses the original POM, you still need
18+ to exclude this dependency explicitly: -->
19+ <exclusions>
20+ <exclusion>
21+ <groupId>io.netty</groupId>
22+ <artifactId>*</artifactId>
23+ </exclusion>
24+ </exclusions>
25+</dependency>
26+```