|
| 1 | +package com.datastax.driver.core; |
| 2 | + |
| 3 | +/** |
| 4 | + * Informations and known state of a Cassandra cluster. |
| 5 | + * <p> |
| 6 | + * This is the main entry point of the driver. A simple example of access to a |
| 7 | + * Cassandra cluster would be: |
| 8 | + * <code> |
| 9 | + * Cluster cluster = Cluster.Builder().addContactPoint("192.168.0.1").build(); |
| 10 | + * Session session = cluster.connect("db1"); |
| 11 | + * |
| 12 | + * for (CQLRow row : session.execute("SELECT * FROM table1")) |
| 13 | + * // do something ... |
| 14 | + * </code> |
| 15 | + * <p> |
| 16 | + * A cluster object maintains a permanent connection to one of the cluster node |
| 17 | + * that it uses solely to maintain informations on the state and current |
| 18 | + * topology of the cluster. Using the connection, the driver will discover all |
| 19 | + * the nodes composing the cluster as well as new nodes joining the cluster. |
| 20 | + * You can disable that connection through the disableStateConnection() method. |
| 21 | + * This is however discouraged as it means queries will only ever be executed |
| 22 | + * against node set as contact point. If you want to limit the number of nodes |
| 23 | + * to which this driver connects to, prefer maxConnectedNode(). |
| 24 | + */ |
| 25 | +public class Cluster { |
| 26 | + |
| 27 | + /** |
| 28 | + * Creates a new session on this cluster. |
| 29 | + * |
| 30 | + * @return a new session on this cluster sets to no keyspace. |
| 31 | + */ |
| 32 | + public Session connect() { |
| 33 | + return null; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Creates a new session on this cluster. |
| 38 | + * |
| 39 | + * @param authInfo The authorisation credentials to use to connect to |
| 40 | + * Cassandra nodes. |
| 41 | + * @return a new session on this cluster sets to no keyspace. |
| 42 | + */ |
| 43 | + public Session connect(AuthInfo authInfo) { |
| 44 | + return null; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Creates a new session on this cluster and sets a keyspace to use. |
| 49 | + * |
| 50 | + * @param keyspaceName The name of the keyspace to use for the created |
| 51 | + * <code>Session</code>. This can be later changed using {@link Session#use}. |
| 52 | + * @return a new session on this cluster sets to keyspace |
| 53 | + * <code>keyspaceName</code>. |
| 54 | + */ |
| 55 | + public Session connect(String keyspace) { |
| 56 | + return null; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Creates a new session on this cluster and sets a keyspace to use. |
| 61 | + * |
| 62 | + * @param authInfo The authorisation credentials to use to connect to |
| 63 | + * Cassandra nodes. |
| 64 | + * @return a new session on this cluster sets to keyspace |
| 65 | + * <code>keyspaceName</code>. |
| 66 | + */ |
| 67 | + public Session connect(String keyspace, AuthInfo authInfo) { |
| 68 | + return null; |
| 69 | + } |
| 70 | + |
| 71 | + public class Builder { |
| 72 | + // TODO |
| 73 | + } |
| 74 | +} |
0 commit comments