com.mymed.model.core.wrappers.cassandra.api07
Interface ICassandraWrapper

All Known Implementing Classes:
CassandraWrapper

public interface ICassandraWrapper

CassandraWrapper API - for Cassandra starting at version 0.7

Author:
Milo Casagrande

Method Summary
 void batch_mutate(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.thrift.Mutation>>> mutationMap, org.apache.cassandra.thrift.ConsistencyLevel level)
          Execute the specified mutations on the keyspace
A Mutation specifies either columns to insert or columns to delete
 java.lang.String describe_cluster_name()
           
 org.apache.cassandra.thrift.KsDef describe_keyspace(java.lang.String keySpace)
           
 java.util.List<org.apache.cassandra.thrift.KsDef> describe_keyspaces()
           
 java.lang.String describe_partitioner()
           
 java.util.List<org.apache.cassandra.thrift.TokenRange> describe_ring(java.lang.String keySpace)
          Get the token ring; a map of ranges to host addresses.
 java.lang.String describe_snitch()
           
 java.lang.String describe_version()
           
 int get_count(java.lang.String key, org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.ConsistencyLevel level)
          Counts the column present in the column parent within the predicate
The method is not O(1).
 java.util.List<org.apache.cassandra.thrift.KeySlice> get_indexed_slices(org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.IndexClause clause, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.ConsistencyLevel level)
          Return a list of slices, but uses IndexClause instead of KeyRange.
 java.util.List<org.apache.cassandra.thrift.KeySlice> get_range_slices(org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.KeyRange range, org.apache.cassandra.thrift.ConsistencyLevel level)
          Return a list of slices for the keys within the specified KeyRange
Note that when using RandomPartitioner, keys are stored in the order of their MD5 hash, making it impossible to get a meaningful range of keys between two endpoints.
 java.util.List<org.apache.cassandra.thrift.ColumnOrSuperColumn> get_slice(java.lang.String key, org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.ConsistencyLevel level)
          Get the group of columns contained by the column parent specified by the given predicate
 org.apache.cassandra.thrift.ColumnOrSuperColumn get(java.lang.String key, org.apache.cassandra.thrift.ColumnPath path, org.apache.cassandra.thrift.ConsistencyLevel level)
          Get the Column or SuperColumn at the given column path
 void insert(java.lang.String key, org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.Column column, org.apache.cassandra.thrift.ConsistencyLevel level)
          Insert a Column consisting of (name, value, timestamp) at the given ColumnPath.column_family and optional ColumnPath.super_column.
 void login(org.apache.cassandra.thrift.AuthenticationRequest authRequest)
          Authenticates with the cluster for operations on the specified keyspace using the specified AuthenticationRequest credentials
 java.util.Map<java.nio.ByteBuffer,java.lang.Integer> multiget_count(java.util.List<java.lang.String> keys, org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.ConsistencyLevel level)
          A combination of multiget_slice and get_count
 java.util.Map<java.nio.ByteBuffer,java.util.List<org.apache.cassandra.thrift.ColumnOrSuperColumn>> multiget_slice(java.util.List<java.lang.String> keys, org.apache.cassandra.thrift.ColumnParent parent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.ConsistencyLevel level)
          Retrieve slices for column parent and predicate on each of the given keys in parallel
 void remove(java.lang.String key, org.apache.cassandra.thrift.ColumnPath path, long timeStamp, org.apache.cassandra.thrift.ConsistencyLevel level)
          Remove data from the row specified by key at the granularity specified by the ColumnPath path, and the given timestamp.
 void set_keyspace(java.lang.String keySpace)
          Set the keyspace to work on
 java.lang.String system_add_column_family(org.apache.cassandra.thrift.CfDef cfDef)
          Adds a column family.
 java.lang.String system_add_keyspace(org.apache.cassandra.thrift.KsDef ksDef)
          Creates a new keyspace and any column families defined with it.
 java.lang.String system_drop_column_family(java.lang.String columnFamily)
          Drops a column family.
 java.lang.String system_drop_keyspace(java.lang.String keySpace)
          Drops a keyspace.
 java.lang.String system_update_column_family(org.apache.cassandra.thrift.CfDef columnFamily)
          Update the properties of a column family
 java.lang.String system_update_keyspace(org.apache.cassandra.thrift.KsDef keySpace)
          Update the properties of a keyspace
 void truncate(java.lang.String columnFamily)
          Remove all the rows from the given column family
 

Method Detail

login

void login(org.apache.cassandra.thrift.AuthenticationRequest authRequest)
           throws InternalBackEndException
Authenticates with the cluster for operations on the specified keyspace using the specified AuthenticationRequest credentials

Parameters:
authRequest -
Throws:
InternalBackEndException

set_keyspace

void set_keyspace(java.lang.String keySpace)
                  throws InternalBackEndException
Set the keyspace to work on

Parameters:
keySpace - the name of the keyspace
Throws:
InternalBackEndException

get

org.apache.cassandra.thrift.ColumnOrSuperColumn get(java.lang.String key,
                                                    org.apache.cassandra.thrift.ColumnPath path,
                                                    org.apache.cassandra.thrift.ConsistencyLevel level)
                                                    throws IOBackEndException,
                                                           InternalBackEndException
Get the Column or SuperColumn at the given column path

Parameters:
key -
path -
level - the ConsistencyLevel to use
Returns:
the Column or SuperColumn at the given column path
Throws:
IOBackendException - if no value is present
InternalBackEndException
IOBackEndException

get_slice

java.util.List<org.apache.cassandra.thrift.ColumnOrSuperColumn> get_slice(java.lang.String key,
                                                                          org.apache.cassandra.thrift.ColumnParent parent,
                                                                          org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                          org.apache.cassandra.thrift.ConsistencyLevel level)
                                                                          throws InternalBackEndException,
                                                                                 IOBackEndException
Get the group of columns contained by the column parent specified by the given predicate

Parameters:
key -
parent - either a ColumnFamily or a ColumnFamily/ SuperColum pair
predicate - the SlicePredicate
level - the ConsistencyLevel to use
Returns:
the group of columns contained by the column parent
Throws:
InternalBackEndException
IOBackEndException

multiget_slice

java.util.Map<java.nio.ByteBuffer,java.util.List<org.apache.cassandra.thrift.ColumnOrSuperColumn>> multiget_slice(java.util.List<java.lang.String> keys,
                                                                                                                  org.apache.cassandra.thrift.ColumnParent parent,
                                                                                                                  org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                                                                  org.apache.cassandra.thrift.ConsistencyLevel level)
                                                                                                                  throws InternalBackEndException
Retrieve slices for column parent and predicate on each of the given keys in parallel

Parameters:
keys - the list of keys
parent -
predicate - the SlicePredicate
level - the ConsistencyLevel to use
Returns:
the slices for the given keys
Throws:
InternalBackEndException

get_count

int get_count(java.lang.String key,
              org.apache.cassandra.thrift.ColumnParent parent,
              org.apache.cassandra.thrift.SlicePredicate predicate,
              org.apache.cassandra.thrift.ConsistencyLevel level)
              throws InternalBackEndException
Counts the column present in the column parent within the predicate
The method is not O(1). It takes all the columns from disk to calculate the answer. The only benefit of the method is that you do not need to pull all the columns over Thrift interface to count them.

Parameters:
key -
parent -
predicate - the SlicePredicate
level - the ConsistencyLevel to use
Returns:
the number of columns
Throws:
InternalBackEndException

multiget_count

java.util.Map<java.nio.ByteBuffer,java.lang.Integer> multiget_count(java.util.List<java.lang.String> keys,
                                                                    org.apache.cassandra.thrift.ColumnParent parent,
                                                                    org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                    org.apache.cassandra.thrift.ConsistencyLevel level)
                                                                    throws InternalBackEndException
A combination of multiget_slice and get_count

Parameters:
keys -
parent -
predicate - the SlicePredicate
level - the ConsistencyLevel to use
Returns:
Throws:
InternalBackEndException

get_range_slices

java.util.List<org.apache.cassandra.thrift.KeySlice> get_range_slices(org.apache.cassandra.thrift.ColumnParent parent,
                                                                      org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                      org.apache.cassandra.thrift.KeyRange range,
                                                                      org.apache.cassandra.thrift.ConsistencyLevel level)
                                                                      throws InternalBackEndException
Return a list of slices for the keys within the specified KeyRange
Note that when using RandomPartitioner, keys are stored in the order of their MD5 hash, making it impossible to get a meaningful range of keys between two endpoints.

Parameters:
parent -
predicate - the SlicePredicate
range - the KeyRange
level - the ConsistencyLevel to use
Returns:
a list of slices
Throws:
InternalBackEndException

get_indexed_slices

java.util.List<org.apache.cassandra.thrift.KeySlice> get_indexed_slices(org.apache.cassandra.thrift.ColumnParent parent,
                                                                        org.apache.cassandra.thrift.IndexClause clause,
                                                                        org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                        org.apache.cassandra.thrift.ConsistencyLevel level)
                                                                        throws InternalBackEndException
Return a list of slices, but uses IndexClause instead of KeyRange. To use this method, the underlying ColumnFamily of the ColumnParent must have been configured with a column_metadata attribute, specifying at least the name and index_type attributes. See CfDef and ColumnDef for the list of attributes.

Parameters:
parent -
clause - the IndexClause to use
predicate - the SlicePredicate
level - the ConsistencyLevel to use
Returns:
a list of slices
Throws:
InternalBackEndException

insert

void insert(java.lang.String key,
            org.apache.cassandra.thrift.ColumnParent parent,
            org.apache.cassandra.thrift.Column column,
            org.apache.cassandra.thrift.ConsistencyLevel level)
            throws InternalBackEndException
Insert a Column consisting of (name, value, timestamp) at the given ColumnPath.column_family and optional ColumnPath.super_column. Note that a SuperColumn cannot directly contain binary values, it can only contain sub-Columns. Only one sub-Column may be inserted at a time, as well.

Parameters:
key -
parent -
column -
level -
Throws:
InternalBackEndException

batch_mutate

void batch_mutate(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.thrift.Mutation>>> mutationMap,
                  org.apache.cassandra.thrift.ConsistencyLevel level)
                  throws InternalBackEndException
Execute the specified mutations on the keyspace
A Mutation specifies either columns to insert or columns to delete

Parameters:
mutationMap -
level -
Throws:
InternalBackEndException

remove

void remove(java.lang.String key,
            org.apache.cassandra.thrift.ColumnPath path,
            long timeStamp,
            org.apache.cassandra.thrift.ConsistencyLevel level)
            throws InternalBackEndException
Remove data from the row specified by key at the granularity specified by the ColumnPath path, and the given timestamp.

Parameters:
key -
path -
timeStamp -
level - the ConsistencyLevel to use
Throws:
InternalBackEndException

truncate

void truncate(java.lang.String columnFamily)
              throws InternalBackEndException
Remove all the rows from the given column family

Parameters:
columnFamily -
Throws:
InternalBackEndException

describe_cluster_name

java.lang.String describe_cluster_name()
                                       throws InternalBackEndException
Returns:
the name of the cluster
Throws:
InternalBackEndException

describe_keyspace

org.apache.cassandra.thrift.KsDef describe_keyspace(java.lang.String keySpace)
                                                    throws InternalBackEndException,
                                                           IOBackEndException
Parameters:
keySpace -
Returns:
the information about the specified keyspace
Throws:
InternalBackEndException
IOBackEndException

describe_keyspaces

java.util.List<org.apache.cassandra.thrift.KsDef> describe_keyspaces()
                                                                     throws InternalBackEndException
Returns:
a list of all the keyspaces configured for the cluster
Throws:
InternalBackEndException

describe_partitioner

java.lang.String describe_partitioner()
                                      throws InternalBackEndException
Returns:
the name of the partitioner for the cluster
Throws:
InternalBackEndException

describe_ring

java.util.List<org.apache.cassandra.thrift.TokenRange> describe_ring(java.lang.String keySpace)
                                                                     throws InternalBackEndException
Get the token ring; a map of ranges to host addresses. Represented as a set of TokenRange instead of a map from range to list of end points

Parameters:
keySpace -
Returns:
Throws:
InternalBackEndException

describe_snitch

java.lang.String describe_snitch()
                                 throws InternalBackEndException
Returns:
the name of the snitch used for the cluster
Throws:
InternalBackEndException

describe_version

java.lang.String describe_version()
                                  throws InternalBackEndException
Returns:
the Thrift API version
Throws:
InternalBackEndException

system_add_column_family

java.lang.String system_add_column_family(org.apache.cassandra.thrift.CfDef cfDef)
                                          throws InternalBackEndException
Adds a column family. This method will throw an exception if a column family with the same name is already associated with the keyspace

Parameters:
cfDef -
Returns:
the new schema version ID
Throws:
InternalBackEndException

system_drop_column_family

java.lang.String system_drop_column_family(java.lang.String columnFamily)
                                           throws InternalBackEndException
Drops a column family. Creates a snapshot and then submits a 'graveyard' compaction during which the abandoned files will be deleted

Parameters:
columnFamily -
Returns:
the new schema version ID
Throws:
InternalBackEndException

system_add_keyspace

java.lang.String system_add_keyspace(org.apache.cassandra.thrift.KsDef ksDef)
                                     throws InternalBackEndException
Creates a new keyspace and any column families defined with it. Callers are not required to first create an empty keyspace and then create column families for it.

Parameters:
ksDef - the keyspace definition
Returns:
the new schema version ID
Throws:
InternalBackEndException

system_drop_keyspace

java.lang.String system_drop_keyspace(java.lang.String keySpace)
                                      throws InternalBackEndException
Drops a keyspace. Creates a snapshot and then submits a 'graveyard' compaction during which the abandoned files will be deleted

Parameters:
keySpace -
Returns:
the new schema version ID
Throws:
InternalBackEndException

system_update_column_family

java.lang.String system_update_column_family(org.apache.cassandra.thrift.CfDef columnFamily)
                                             throws InternalBackEndException
Update the properties of a column family

Parameters:
columnFamily -
Returns:
the new schema version ID
Throws:
InternalBackEndException

system_update_keyspace

java.lang.String system_update_keyspace(org.apache.cassandra.thrift.KsDef keySpace)
                                        throws InternalBackEndException
Update the properties of a keyspace

Parameters:
keySpace -
Returns:
the new schema version ID
Throws:
InternalBackEndException