-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new repo to address the datastax and asytanax co-existing problem
- Loading branch information
Showing
10 changed files
with
789 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!-- | ||
Copyright 2016 Intuit | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.intuit.wasabi</groupId> | ||
<artifactId>wasabi</artifactId> | ||
<version>1.0.20160715100540-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>wasabi-cassandra-datastax</artifactId> | ||
<packaging>jar</packaging> | ||
<name>${project.artifactId}</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.datastax.cassandra</groupId> | ||
<artifactId>cassandra-driver-core</artifactId> | ||
<version>3.0.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.datastax.cassandra</groupId> | ||
<artifactId>cassandra-driver-mapping</artifactId> | ||
<version>3.0.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.oneandone.troilus</groupId> | ||
<artifactId>troilus-core</artifactId> | ||
<version>0.18</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.reactivex</groupId> | ||
<artifactId>rxjava</artifactId> | ||
<version>1.1.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.dropwizard.metrics</groupId> | ||
<artifactId>metrics-healthchecks</artifactId> | ||
<version>3.1.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-lang</groupId> | ||
<artifactId>commons-lang</artifactId> | ||
<version>2.6</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
167 changes: 167 additions & 0 deletions
167
...assandra-datastax/src/main/java/com/intuit/wasabi/cassandra/datastax/CassandraDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/******************************************************************************* | ||
* Copyright 2016 Intuit | ||
* | ||
* 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. | ||
*******************************************************************************/ | ||
package com.intuit.wasabi.cassandra.datastax; | ||
|
||
import com.datastax.driver.core.ConsistencyLevel; | ||
import com.datastax.driver.core.Session; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Low-level access to Cassandra using Astyanax | ||
*/ | ||
public interface CassandraDriver extends Closeable { | ||
|
||
/** | ||
* Check whether the keyspace has already been initialized | ||
* | ||
* @return True if the keyspace has already been intialized | ||
*/ | ||
boolean isKeyspaceInitialized(); | ||
|
||
/** | ||
* Initialize the keyspace. | ||
* | ||
* @throws IOException when cannot connect to cassandra | ||
*/ | ||
void initializeKeyspace() throws IOException; | ||
|
||
/** | ||
* The session {@link Session} managed by this driver | ||
* | ||
* @return The Session instance. Never null. | ||
*/ | ||
Session getSession(); | ||
|
||
//////////////////////////////////////////////////////////////////////////// | ||
// Types | ||
//////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Configuration to be provided to driver implementations | ||
*/ | ||
interface Configuration { | ||
|
||
/** | ||
* Returns keyspace name | ||
* @return keyspace name | ||
*/ | ||
String getKeyspaceName(); | ||
|
||
/** | ||
* Returns Cassandra port | ||
* @return port number | ||
*/ | ||
int getPort(); | ||
|
||
/** | ||
* Are we using a SSL connection | ||
* @return true if using SSL | ||
*/ | ||
Boolean useSSL(); | ||
|
||
/** | ||
* Absolute path for the SSL trust keystore file | ||
* @return the path to SSL key store file | ||
*/ | ||
String getSSLTrustStore(); | ||
|
||
|
||
/** | ||
* Password for the SSL trust keystore | ||
* @return password for ssl trust keystore | ||
*/ | ||
String getSSLTrustStorePassword(); | ||
|
||
/** | ||
* Returns the keyspace replication factor | ||
* @return replication factor of keyspace | ||
*/ | ||
int getKeyspaceReplicationFactor(); | ||
|
||
/** | ||
* Returns the keyspace strategy class | ||
* @return Keyspace strategy class | ||
*/ | ||
String getKeyspaceStrategyClass(); | ||
|
||
/** | ||
* Returns node hosts | ||
* @return Node hosts, comma-separated | ||
*/ | ||
List<String> getNodeHosts(); | ||
|
||
/** | ||
* Returns max connections per host | ||
* @return Max connections per host | ||
*/ | ||
int getMaxConnectionsPerHost(); | ||
|
||
// /** | ||
// * The target version of Cassandra | ||
// * @return target version number | ||
// */ | ||
// String getTargetVersion(); | ||
// | ||
// /** | ||
// * Returns CQL version | ||
// * @return CQL version | ||
// */ | ||
// String getCQLVersion(); | ||
|
||
/** | ||
* Returns the default read consistency | ||
* @return Default read consistency | ||
*/ | ||
ConsistencyLevel getDefaultReadConsistency(); | ||
|
||
/** | ||
* Returns the default write consistency | ||
* @return default write consistency | ||
*/ | ||
ConsistencyLevel getDefaultWriteConsistency(); | ||
|
||
/** | ||
* Returns the string reflecting the values of the replication factor for each mentioned data center. | ||
* @return Format of the value is DataCenter1:ReplicationFactor,DataCenter2:ReplicationFactor,.... | ||
*/ | ||
String getNetworkTopologyReplicationValues(); | ||
|
||
// /** | ||
// * Returns the astyanax ConnectionPoolType | ||
// * | ||
// * @return ConnectionPoolType Default:TOKEN_AWARE | ||
// */ | ||
// PoolingOptions getConnectionPoolType(); | ||
|
||
/** | ||
* | ||
* @return an Optional value that contains the name of the local dc for load balancing | ||
*/ | ||
Optional<String> getTokenAwareLoadBalancingLocalDC(); | ||
|
||
/** | ||
* | ||
* @return an Integer value of the number of remote host(s) to be used for load balancing | ||
*/ | ||
|
||
Integer getTokenAwareLoadBalancingUsedHostsPerRemoteDc(); | ||
|
||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...datastax/src/main/java/com/intuit/wasabi/cassandra/datastax/DefaultCassandraConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright 2016 Intuit | ||
* | ||
* 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. | ||
*******************************************************************************/ | ||
package com.intuit.wasabi.cassandra.datastax; | ||
|
||
/** | ||
* Cassandra related constants | ||
*/ | ||
public interface DefaultCassandraConstant { | ||
|
||
/** | ||
* Default Cassandra version | ||
*/ | ||
public static final String DEFAULT_CASSANDRA_VERSION = "2.0"; | ||
|
||
/** | ||
* Default CQL version | ||
*/ | ||
public static final String DEFAULT_CQL_VERSION = "3.0.0"; | ||
|
||
} |
Oops, something went wrong.