org.scale7.cassandra.pelops.pool
Interface IThriftPool

All Known Implementing Classes:
CachePerNodePool, CommonsBackedPool, DebuggingPool, ThriftPoolBase

public interface IThriftPool

The contract for connection pools used by pelops.


Nested Class Summary
static interface IThriftPool.IPooledConnection
          Defines an encapsulation for a connection to a Cassandra node.
 
Method Summary
 Mutator createMutator()
          Create a mutator object using the current time as the operation time stamp.
 Mutator createMutator(long timestamp)
          Create a mutator object with an arbitrary time stamp.
 Mutator createMutator(long timestamp, boolean deleteIfNull)
          Create a mutator object with an arbitrary time stamp.
 Mutator createMutator(long timestamp, boolean deleteIfNull, int ttl)
          Create a mutator object with an arbitrary time stamp.
 Mutator createMutator(long timestamp, int ttl)
          Create a mutator object with an arbitrary time stamp.
 RowDeletor createRowDeletor()
          Create a key deletor object using the current time as the operation time stamp.
 RowDeletor createRowDeletor(long timestamp)
          Create a key deletor object with an arbitrary time stamp.
 Selector createSelector()
          Create a selector object.
 IThriftPool.IPooledConnection getConnection()
          Get a connection from the pool.
 IThriftPool.IPooledConnection getConnectionExcept(String notNode)
          Get a connection from the pool trying to avoid the node specified by the notNode param.
 String getKeyspace()
          The keyspace this connection operates on.
 OperandPolicy getOperandPolicy()
          Get the current policy in force, which controls the general behavior of pelops.
 void shutdown()
          Shuts down the pool.
 

Method Detail

createSelector

Selector createSelector()
Create a selector object.

Returns:
A new selector object

createMutator

Mutator createMutator()
Create a mutator object using the current time as the operation time stamp. The mutator object must only be used to execute 1 mutation operation.

Returns:
A new mutator object

createMutator

Mutator createMutator(long timestamp)
Create a mutator object with an arbitrary time stamp. The mutator object must only be used to execute 1 mutation operation.

The created mutator will be created with the value of OperandPolicy.isDeleteIfNull().

Parameters:
timestamp - The default time stamp to use for operations
Returns:
A new mutator object

createMutator

Mutator createMutator(long timestamp,
                      int ttl)
Create a mutator object with an arbitrary time stamp. The mutator object must only be used to execute 1 mutation operation.

The created mutator will be created with the value of OperandPolicy.isDeleteIfNull().

Parameters:
timestamp - The default time stamp to use for operations
ttl - the ttl (in seconds) that columns created using the various Mutator.newColumn(org.scale7.cassandra.pelops.Bytes , org.scale7.cassandra.pelops.Bytes) will default to
Returns:
A new mutator object

createMutator

Mutator createMutator(long timestamp,
                      boolean deleteIfNull)
Create a mutator object with an arbitrary time stamp. The mutator object must only be used to execute 1 mutation operation.

Parameters:
timestamp - The default time stamp to use for operations
deleteIfNull - If true the mutator will default to issuing deletes when it detects null values on a column passed to the various write methods.
Returns:
A new mutator object

createMutator

Mutator createMutator(long timestamp,
                      boolean deleteIfNull,
                      int ttl)
Create a mutator object with an arbitrary time stamp. The mutator object must only be used to execute 1 mutation operation.

Parameters:
timestamp - The default time stamp to use for operations
deleteIfNull - If true the mutator will default to issuing deletes when it detects null values on a column passed to the various write methods.
ttl - the ttl (in seconds) that columns created using the various Mutator.newColumn(org.scale7.cassandra.pelops.Bytes , org.scale7.cassandra.pelops.Bytes) will default to
Returns:
A new mutator object

createRowDeletor

RowDeletor createRowDeletor()
Create a key deletor object using the current time as the operation time stamp.

Returns:
A new key deletor object

createRowDeletor

RowDeletor createRowDeletor(long timestamp)
Create a key deletor object with an arbitrary time stamp.

Parameters:
timestamp - The default time stamp to use for operations
Returns:
A new key deletor object

getConnection

IThriftPool.IPooledConnection getConnection()
                                            throws NoConnectionsAvailableException
Get a connection from the pool.

Returns:
the connection
Throws:
Exception - if an error occurs
NoConnectionsAvailableException

getConnectionExcept

IThriftPool.IPooledConnection getConnectionExcept(String notNode)
                                                  throws NoConnectionsAvailableException
Get a connection from the pool trying to avoid the node specified by the notNode param.

Parameters:
notNode - the node to avoid if possible
Returns:
the connection
Throws:
Exception - if an error occurs
NoConnectionsAvailableException

shutdown

void shutdown()
Shuts down the pool.

Calling this method after the pool has been shutdown should have no affect.


getOperandPolicy

OperandPolicy getOperandPolicy()
Get the current policy in force, which controls the general behavior of pelops.

Returns:
the current policy

getKeyspace

String getKeyspace()
The keyspace this connection operates on.

Returns:
the keyspace


Copyright © 2011. All Rights Reserved.