| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you 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 org.apache.usergrid.persistence.core.astyanax; |
| |
| |
| import org.safehaus.guicyfig.Default; |
| import org.safehaus.guicyfig.FigSingleton; |
| import org.safehaus.guicyfig.GuicyFig; |
| import org.safehaus.guicyfig.Key; |
| |
| |
| |
| /** |
| * Cassandra configuration interface. |
| */ |
| @FigSingleton |
| public interface CassandraFig extends GuicyFig { |
| |
| // main application cassandra properties |
| String READ_CONSISTENT_CL = "usergrid.consistent.read.cl"; |
| String READ_CL = "usergrid.read.cl"; |
| String WRITE_CL = "usergrid.write.cl"; |
| String SHARD_VALUES = "cassandra.shardvalues"; |
| String THRIFT_TRANSPORT_SIZE = "cassandra.thrift.transport.frame"; |
| String USERNAME = "cassandra.username"; |
| String PASSWORD = "cassandra.password"; |
| |
| // locks cassandra properties |
| String LOCKS_KEYSPACE_NAME = "cassandra.lock.keyspace"; |
| String LOCKS_KEYSPACE_REPLICATION = "cassandra.lock.keyspace.replication"; |
| String LOCKS_KEYSPACE_STRATEGY = "cassandra.lock.keyspace.strategy"; |
| String LOCKS_CL = "cassandra.lock.cl"; |
| String LOCKS_SHARED_POOL_FLAG = "cassandra.lock.use_shared_pool"; |
| String LOCKS_CONNECTIONS = "cassandra.lock.connections"; |
| String LOCKS_EXPIRATION = "cassandra.lock.expiration.milliseconds"; |
| |
| String LOCK_MANAGER_INIT_RETRIES = "cassandra.lock.init.retries"; |
| String LOCK_MANAGER_INIT_INTERVAL = "cassandra.lock.init.interval"; |
| |
| // re-usable default values |
| String DEFAULT_CONNECTION_POOLSIZE = "15"; |
| String DEFAULT_LOCKS_EXPIRATION = "3600000"; // 1 hour |
| |
| |
| @Key( "cassandra.hosts" ) |
| String getHosts(); |
| |
| @Key( "cassandra.version" ) |
| @Default( "2.1" ) |
| String getVersion(); |
| |
| @Key( "cassandra.cluster_name" ) |
| @Default( "Usergrid" ) |
| String getClusterName(); |
| |
| @Key( "cassandra.keyspace.application" ) |
| @Default( "Usergrid_Applications" ) |
| String getApplicationKeyspace(); |
| |
| @Key( "cassandra.port" ) |
| @Default( "9160" ) |
| int getThriftPort(); |
| |
| @Key( "cassandra.datacenter.local" ) |
| String getLocalDataCenter(); |
| |
| @Key( USERNAME ) |
| String getUsername(); |
| |
| @Key( PASSWORD ) |
| String getPassword(); |
| |
| @Key( "cassandra.connections" ) |
| @Default( DEFAULT_CONNECTION_POOLSIZE ) |
| int getConnections(); |
| |
| @Key( "cassandra.timeout" ) |
| @Default( "10000" ) |
| int getTimeout(); |
| |
| @Key("cassandra.discovery") |
| @Default( "RING_DESCRIBE" ) |
| String getDiscoveryType(); |
| |
| |
| @Default("CL_LOCAL_QUORUM") |
| @Key(READ_CL) |
| String getReadCL(); |
| |
| @Default("CL_QUORUM") |
| @Key(READ_CONSISTENT_CL) |
| String getConsistentReadCL(); |
| |
| @Default("CL_LOCAL_QUORUM") |
| @Key(WRITE_CL) |
| String getWriteCL(); |
| |
| /** |
| * Return the history of all shard values which are immutable. For instance, if shard values |
| * are initially set to 20 (the default) then increased to 40, the property should contain the string of |
| * "20, 40" so that we can read historic data. |
| * |
| * @return |
| */ |
| @Default("20") |
| @Key(SHARD_VALUES) |
| String getShardValues(); |
| |
| /** |
| * Get the thrift transport size. Should be set to what is on the cassandra servers. As we move to CQL, this will become obsolete |
| * @return |
| */ |
| @Key( THRIFT_TRANSPORT_SIZE) |
| @Default( "15728640" ) |
| int getThriftBufferSize(); |
| |
| |
| /** |
| * Returns the name of the keyspace that should be used for Locking |
| */ |
| @Key( LOCKS_KEYSPACE_NAME ) |
| @Default("Locks") |
| String getLocksKeyspace(); |
| |
| /** |
| * Returns the Astyanax consistency level for writing a Lock |
| */ |
| @Key(LOCKS_CL) |
| @Default("CL_LOCAL_QUORUM") |
| String getLocksCl(); |
| |
| /** |
| * Returns a flag on whether or not to share the connection pool with other keyspaces |
| */ |
| @Key( LOCKS_SHARED_POOL_FLAG ) |
| @Default("true") |
| boolean useSharedPoolForLocks(); |
| |
| /** |
| * Returns a flag on whether or not to share the connection pool with other keyspaces |
| */ |
| @Key( LOCKS_CONNECTIONS ) |
| @Default( DEFAULT_CONNECTION_POOLSIZE ) |
| int getConnectionsLocks(); |
| |
| /** |
| * Returns a flag on whether or not to share the connection pool with other keyspaces |
| */ |
| @Key( LOCKS_KEYSPACE_REPLICATION ) |
| @Default("replication_factor:1") |
| String getLocksKeyspaceReplication(); |
| |
| /** |
| * Returns a flag on whether or not to share the connection pool with other keyspaces |
| */ |
| @Key( LOCKS_KEYSPACE_STRATEGY ) |
| @Default( "org.apache.cassandra.locator.SimpleStrategy" ) |
| String getLocksKeyspaceStrategy(); |
| |
| /** |
| * Return the expiration that should be used for expiring a lock if it's not released |
| */ |
| @Key( LOCKS_EXPIRATION ) |
| @Default(DEFAULT_LOCKS_EXPIRATION) |
| int getLocksExpiration(); |
| |
| /** |
| * How many times to attempt lock keyspace and column family creation |
| */ |
| @Key( LOCK_MANAGER_INIT_RETRIES ) |
| @Default( "100" ) |
| int getLockManagerInitRetries(); |
| |
| /** |
| * Return the expiration that should be used for expiring a lock if it's not released |
| */ |
| @Key( LOCK_MANAGER_INIT_INTERVAL ) |
| @Default( "1000" ) |
| int getLockManagerInitInterval(); |
| |
| } |