Commit c15914f7 authored by Sergey Petrunya's avatar Sergey Petrunya

Initial commit for Cassandra storage engine.

parent 6ed4a283
#
# suite.pm will make sure that all tests including this file
# will be skipped unless innodb or xtradb is enabled
#
# The test below is redundant
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'cassandra' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
{
--skip Test requires Cassandra.
}
drop table if exists t0, t1;
create table t1 (a int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR 42000: Incorrect column name 'First column must be named 'rowkey''
create table t1 (a int primary key, b int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR 42000: Incorrect column name 'First column must be named 'rowkey''
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='127.0.0.2' keyspace='foo' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace';
ERROR HY000: Can't create table 'test.t1' (errno: 140)
create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra
thrift_host='localhost' keyspace='mariadbtest' column_family='cf1';
insert into t1 values ('key0', 'data1');
drop table t1;
#
# Tests for cassandra storage engine
#
--source include/have_cassandra.inc
--disable_warnings
drop table if exists t0, t1;
--enable_warnings
# Test various errors on table creation.
--error ER_WRONG_COLUMN_NAME
create table t1 (a int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
--error ER_WRONG_COLUMN_NAME
create table t1 (a int primary key, b int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='127.0.0.2' keyspace='foo' column_family='colfam';
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam';
# No column family specified
--error ER_CANT_CREATE_TABLE
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace';
############################################################################
## Cassandra initialization:
############################################################################
--disable_parsing
./cqlsh --cql3
CREATE KEYSPACE mariadbtest
WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy'
AND strategy_options:replication_factor='1';
USE mariadbtest;
create columnfamily cf1 ( pk varchar primary key, data1 varchar);
--enable_parsing
############################################################################
## Cassandra initialization ends
############################################################################
# Now, create a table for real and insert data
create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra
thrift_host='localhost' keyspace='mariadbtest' column_family='cf1';
insert into t1 values ('key0', 'data1');
drop table t1;
############################################################################
## Cassandra cleanup
############################################################################
--disable_parsing
drop columnfamily cf1;
--enable_parsing
############################################################################
## Cassandra cleanup ends
############################################################################
SET(cassandra_sources
ha_cassandra.cc
ha_cassandra.h
cassandra_se.h
cassandra_se.cc
gen-cpp/Cassandra.cpp
gen-cpp/cassandra_types.h
gen-cpp/cassandra_types.cpp
gen-cpp/cassandra_constants.h
gen-cpp/cassandra_constants.cpp
gen-cpp/Cassandra.h)
#INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/)
#
STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
#LINK_DIRECTORIES(/home/psergey/cassandra/thrift/lib)
MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE LINK_LIBRARIES thrift)
# was: STORAGE_ENGINE MANDATORY
// Cassandra includes:
#include <inttypes.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdarg.h>
#include "Thrift.h"
#include "transport/TSocket.h"
#include "transport/TTransport.h"
#include "transport/TBufferTransports.h"
#include "protocol/TProtocol.h"
#include "protocol/TBinaryProtocol.h"
#include "gen-cpp/Cassandra.h"
// cassandra includes end
#include "cassandra_se.h"
using namespace std;
using namespace apache::thrift;
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
using namespace org::apache::cassandra;
void Cassandra_se_interface::print_error(const char *format, ...)
{
va_list ap;
va_start(ap, format);
// it's not a problem if output was truncated
vsnprintf(err_buffer, sizeof(err_buffer), format, ap);
va_end(ap);
}
/*
Implementation of connection to one Cassandra column family (ie., table)
*/
class Cassandra_se_impl: public Cassandra_se_interface
{
CassandraClient *cass; /* Connection to cassandra */
ConsistencyLevel::type cur_consistency_level;
std::string column_family;
std::string keyspace;
/* DDL checks */
KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */
CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/
std::vector<ColumnDef>::iterator column_ddl_it;
/* The list that was returned by the last key lookup */
std::vector<ColumnOrSuperColumn> col_supercol_vec;
public:
Cassandra_se_impl() : cass(NULL) {}
virtual ~Cassandra_se_impl(){ delete cass; }
bool connect(const char *host, const char *keyspace);
virtual void set_column_family(const char *cfname)
{
column_family.assign(cfname);
}
virtual bool insert(NameAndValue *fields);
virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found);
/* Functions to enumerate ColumnFamily's DDL data */
bool setup_ddl_checks();
void first_ddl_column();
bool next_ddl_column(char **name, int *name_len, char **value, int *value_len);
};
Cassandra_se_interface *get_cassandra_se()
{
return new Cassandra_se_impl;
}
#define CASS_TRY(x) try { \
x; \
}catch(TTransportException te){ \
print_error("%s [%d]", te.what(), te.getType()); \
}catch(InvalidRequestException ire){ \
print_error("%s [%s]", ire.what(), ire.why.c_str()); \
}catch(NotFoundException nfe){ \
print_error("%s", nfe.what()); \
} catch(...) { \
print_error("Unknown Exception"); \
}
bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg)
{
bool res= true;
keyspace.assign(keyspace_arg);
try {
boost::shared_ptr<TTransport> socket =
boost::shared_ptr<TSocket>(new TSocket(host, 9160));
boost::shared_ptr<TTransport> tr =
boost::shared_ptr<TFramedTransport>(new TFramedTransport (socket));
boost::shared_ptr<TProtocol> p =
boost::shared_ptr<TBinaryProtocol>(new TBinaryProtocol(tr));
cass= new CassandraClient(p);
tr->open();
cass->set_keyspace(keyspace_arg);
res= false; // success
}catch(TTransportException te){
print_error("%s [%d]", te.what(), te.getType());
}catch(InvalidRequestException ire){
print_error("%s [%s]", ire.what(), ire.why.c_str());
}catch(NotFoundException nfe){
print_error("%s", nfe.what());
}
catch(...) {
print_error("Unknown Exception");
}
// For now:
cur_consistency_level= ConsistencyLevel::ONE;
if (setup_ddl_checks())
res= true;
return res;
}
bool Cassandra_se_impl::setup_ddl_checks()
{
try {
cass->describe_keyspace(ks_def, keyspace);
std::vector<CfDef>::iterator it;
for (it= ks_def.cf_defs.begin(); it < ks_def.cf_defs.end(); it++)
{
cf_def= *it;
if (!cf_def.name.compare(column_family))
return false;
}
print_error("describe_keyspace() didn't return our column family");
} catch (InvalidRequestException ire) {
print_error("%s [%s]", ire.what(), ire.why.c_str());
} catch (NotFoundException nfe) {
print_error("keyspace not found: %s", nfe.what());
}
return true;
}
void Cassandra_se_impl::first_ddl_column()
{
column_ddl_it= cf_def.column_metadata.begin();
}
bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len,
char **type, int *type_len)
{
if (column_ddl_it == cf_def.column_metadata.end())
return true;
*name= (char*)(*column_ddl_it).name.c_str();
*name_len= (*column_ddl_it).name.length();
*type= (char*)(*column_ddl_it).validation_class.c_str();
*type_len= (*column_ddl_it).validation_class.length();
column_ddl_it++;
return false;
}
bool Cassandra_se_impl::insert(NameAndValue *fields)
{
ColumnParent cparent;
cparent.column_family= column_family;
Column c;
struct timeval td;
gettimeofday(&td, NULL);
int64_t ms = td.tv_sec;
ms = ms * 1000;
int64_t usec = td.tv_usec;
usec = usec / 1000;
ms += usec;
c.timestamp = ms;
c.__isset.timestamp = true;
std::string key;
key.assign(fields->value, fields->value_len);
fields++;
bool res= false;
try {
/* TODO: switch to batch_mutate(). Or, even to CQL? */
// TODO: what should INSERT table (co1, col2) VALUES ('foo', 'bar') mean?
// in SQL, it sets all columns.. what should it mean here? can we have
// it to work only for specified columns? (if yes, what do for
// VALUES()?)
c.__isset.value= true;
for(;fields->name; fields++)
{
c.name.assign(fields->name);
c.value.assign(fields->value, fields->value_len);
cass->insert(key, cparent, c, ConsistencyLevel::ONE);
}
} catch (...) {
res= true;
}
return res;
}
bool Cassandra_se_impl::get_slice(char *key, size_t key_len, NameAndValue *row, bool *found)
{
ColumnParent cparent;
cparent.column_family= column_family;
std::string rowkey_str;
rowkey_str.assign(key, key_len);
SlicePredicate slice_pred;
SliceRange sr;
sr.start = "";
sr.finish = "";
slice_pred.__set_slice_range(sr);
try {
std::vector<ColumnOrSuperColumn> &res= col_supercol_vec;
cass->get_slice(res, rowkey_str, cparent, slice_pred, ConsistencyLevel::ONE);
*found= true;
std::vector<ColumnOrSuperColumn>::iterator it;
if (res.size() == 0)
{
/*
No columns found. Cassandra doesn't allow records without any column =>
this means the seach key doesn't exist
*/
*found= false;
return false;
}
for (it= res.begin(); it < res.end(); it++)
{
ColumnOrSuperColumn cs= *it;
if (!cs.__isset.column)
return true;
row->name= (char*)cs.column.name.c_str();
row->value= (char*)cs.column.value.c_str();
row->value_len= cs.column.value.length();
row++;
}
row->name= NULL;
} catch (InvalidRequestException ire) {
return true;
} catch (UnavailableException ue) {
return true;
} catch (TimedOutException te) {
return true;
}
return false;
}
/*
This file is a "bridge" interface between cassandra+Thrift and MariaDB.
It is #included by both sides, so it must itself include neither (including
both together causes compile errors due to conflicts).
*/
/*
Storage for (name,value) pairs. name==NULL means 'non-object'.
This should be used for
- shipping data from sql to cassandra for INSERTs
- shipping data from cassandra to SQL for record reads.
*/
class NameAndValue
{
public:
char *name;
char *value;
size_t value_len;
};
/*
Interface to one cassandra column family, i.e. one 'table'
*/
class Cassandra_se_interface
{
public:
Cassandra_se_interface() { err_buffer[0]=0; }
virtual ~Cassandra_se_interface(){};
/* Init */
virtual bool connect(const char *host, const char *port)=0;
virtual void set_column_family(const char *cfname) = 0;
/* Check underlying DDL */
virtual bool setup_ddl_checks()=0;
virtual void first_ddl_column()=0;
virtual bool next_ddl_column(char **name, int *name_len, char **value,
int *value_len)=0;
/* Writes */
virtual bool insert(NameAndValue *fields)=0;
/* Reads */
virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found)=0 ;
/* Passing error messages up to ha_cassandra */
char err_buffer[512];
const char *error_str() { return err_buffer; }
void print_error(const char *format, ...);
};
Cassandra_se_interface *get_cassandra_se();
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include "Cassandra.h"
#include <protocol/TBinaryProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace ::org::apache::cassandra;
class CassandraHandler : virtual public CassandraIf {
public:
CassandraHandler() {
// Your initialization goes here
}
void login(const AuthenticationRequest& auth_request) {
// Your implementation goes here
printf("login\n");
}
void set_keyspace(const std::string& keyspace) {
// Your implementation goes here
printf("set_keyspace\n");
}
void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get\n");
}
void get_slice(std::vector<ColumnOrSuperColumn> & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get_slice\n");
}
int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get_count\n");
}
void multiget_slice(std::map<std::string, std::vector<ColumnOrSuperColumn> > & _return, const std::vector<std::string> & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("multiget_slice\n");
}
void multiget_count(std::map<std::string, int32_t> & _return, const std::vector<std::string> & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("multiget_count\n");
}
void get_range_slices(std::vector<KeySlice> & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get_range_slices\n");
}
void get_paged_slice(std::vector<KeySlice> & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get_paged_slice\n");
}
void get_indexed_slices(std::vector<KeySlice> & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("get_indexed_slices\n");
}
void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("insert\n");
}
void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("add\n");
}
void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("remove\n");
}
void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("remove_counter\n");
}
void batch_mutate(const std::map<std::string, std::map<std::string, std::vector<Mutation> > > & mutation_map, const ConsistencyLevel::type consistency_level) {
// Your implementation goes here
printf("batch_mutate\n");
}
void truncate(const std::string& cfname) {
// Your implementation goes here
printf("truncate\n");
}
void describe_schema_versions(std::map<std::string, std::vector<std::string> > & _return) {
// Your implementation goes here
printf("describe_schema_versions\n");
}
void describe_keyspaces(std::vector<KsDef> & _return) {
// Your implementation goes here
printf("describe_keyspaces\n");
}
void describe_cluster_name(std::string& _return) {
// Your implementation goes here
printf("describe_cluster_name\n");
}
void describe_version(std::string& _return) {
// Your implementation goes here
printf("describe_version\n");
}
void describe_ring(std::vector<TokenRange> & _return, const std::string& keyspace) {
// Your implementation goes here
printf("describe_ring\n");
}
void describe_token_map(std::map<std::string, std::string> & _return) {
// Your implementation goes here
printf("describe_token_map\n");
}
void describe_partitioner(std::string& _return) {
// Your implementation goes here
printf("describe_partitioner\n");
}
void describe_snitch(std::string& _return) {
// Your implementation goes here
printf("describe_snitch\n");
}
void describe_keyspace(KsDef& _return, const std::string& keyspace) {
// Your implementation goes here
printf("describe_keyspace\n");
}
void describe_splits(std::vector<std::string> & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) {
// Your implementation goes here
printf("describe_splits\n");
}
void system_add_column_family(std::string& _return, const CfDef& cf_def) {
// Your implementation goes here
printf("system_add_column_family\n");
}
void system_drop_column_family(std::string& _return, const std::string& column_family) {
// Your implementation goes here
printf("system_drop_column_family\n");
}
void system_add_keyspace(std::string& _return, const KsDef& ks_def) {
// Your implementation goes here
printf("system_add_keyspace\n");
}
void system_drop_keyspace(std::string& _return, const std::string& keyspace) {
// Your implementation goes here
printf("system_drop_keyspace\n");
}
void system_update_keyspace(std::string& _return, const KsDef& ks_def) {
// Your implementation goes here
printf("system_update_keyspace\n");
}
void system_update_column_family(std::string& _return, const CfDef& cf_def) {
// Your implementation goes here
printf("system_update_column_family\n");
}
void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) {
// Your implementation goes here
printf("execute_cql_query\n");
}
void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) {
// Your implementation goes here
printf("prepare_cql_query\n");
}
void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector<std::string> & values) {
// Your implementation goes here
printf("execute_prepared_cql_query\n");
}
void set_cql_version(const std::string& version) {
// Your implementation goes here
printf("set_cql_version\n");
}
};
int main(int argc, char **argv) {
int port = 9090;
shared_ptr<CassandraHandler> handler(new CassandraHandler());
shared_ptr<TProcessor> processor(new CassandraProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
return 0;
}
/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "cassandra_constants.h"
namespace org { namespace apache { namespace cassandra {
const cassandraConstants g_cassandra_constants;
cassandraConstants::cassandraConstants() {
cassandra_const_VERSION = "19.32.0";
}
}}} // namespace
/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef cassandra_CONSTANTS_H
#define cassandra_CONSTANTS_H
#include "cassandra_types.h"
namespace org { namespace apache { namespace cassandra {
class cassandraConstants {
public:
cassandraConstants();
// std::string VERSION;
char* cassandra_const_VERSION;
};
extern const cassandraConstants g_cassandra_constants;
}}} // namespace
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef cassandra_TYPES_H
#define cassandra_TYPES_H
#include <inttypes.h>
#include <netinet/in.h>
#include <Thrift.h>
#include <TApplicationException.h>
#include <protocol/TProtocol.h>
#include <transport/TTransport.h>
namespace org { namespace apache { namespace cassandra {
struct ConsistencyLevel {
enum type {
ONE = 1,
QUORUM = 2,
LOCAL_QUORUM = 3,
EACH_QUORUM = 4,
ALL = 5,
ANY = 6,
TWO = 7,
THREE = 8
};
};
extern const std::map<int, const char*> _ConsistencyLevel_VALUES_TO_NAMES;
struct IndexOperator {
enum type {
EQ = 0,
GTE = 1,
GT = 2,
LTE = 3,
LT = 4
};
};
extern const std::map<int, const char*> _IndexOperator_VALUES_TO_NAMES;
struct IndexType {
enum type {
KEYS = 0,
CUSTOM = 1
};
};
extern const std::map<int, const char*> _IndexType_VALUES_TO_NAMES;
struct Compression {
enum type {
GZIP = 1,
NONE = 2
};
};
extern const std::map<int, const char*> _Compression_VALUES_TO_NAMES;
struct CqlResultType {
enum type {
ROWS = 1,
VOID = 2,
INT = 3
};
};
extern const std::map<int, const char*> _CqlResultType_VALUES_TO_NAMES;
typedef struct _Column__isset {
_Column__isset() : value(false), timestamp(false), ttl(false) {}
bool value;
bool timestamp;
bool ttl;
} _Column__isset;
class Column {
public:
static const char* ascii_fingerprint; // = "3EE0E1C5C844001B62F08125068292CC";
static const uint8_t binary_fingerprint[16]; // = {0x3E,0xE0,0xE1,0xC5,0xC8,0x44,0x00,0x1B,0x62,0xF0,0x81,0x25,0x06,0x82,0x92,0xCC};
Column() : name(""), value(""), timestamp(0), ttl(0) {
}
virtual ~Column() throw() {}
std::string name;
std::string value;
int64_t timestamp;
int32_t ttl;
_Column__isset __isset;
void __set_name(const std::string& val) {
name = val;
}
void __set_value(const std::string& val) {
value = val;
__isset.value = true;
}
void __set_timestamp(const int64_t val) {
timestamp = val;
__isset.timestamp = true;
}
void __set_ttl(const int32_t val) {
ttl = val;
__isset.ttl = true;
}
bool operator == (const Column & rhs) const
{
if (!(name == rhs.name))
return false;
if (__isset.value != rhs.__isset.value)
return false;
else if (__isset.value && !(value == rhs.value))
return false;
if (__isset.timestamp != rhs.__isset.timestamp)
return false;
else if (__isset.timestamp && !(timestamp == rhs.timestamp))
return false;
if (__isset.ttl != rhs.__isset.ttl)
return false;
else if (__isset.ttl && !(ttl == rhs.ttl))
return false;
return true;
}
bool operator != (const Column &rhs) const {
return !(*this == rhs);
}
bool operator < (const Column & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class SuperColumn {
public:
static const char* ascii_fingerprint; // = "470EFC558004E98D92D604898305C04E";
static const uint8_t binary_fingerprint[16]; // = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E};
SuperColumn() : name("") {
}
virtual ~SuperColumn() throw() {}
std::string name;
std::vector<Column> columns;
void __set_name(const std::string& val) {
name = val;
}
void __set_columns(const std::vector<Column> & val) {
columns = val;
}
bool operator == (const SuperColumn & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(columns == rhs.columns))
return false;
return true;
}
bool operator != (const SuperColumn &rhs) const {
return !(*this == rhs);
}
bool operator < (const SuperColumn & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class CounterColumn {
public:
static const char* ascii_fingerprint; // = "1CCCF6FC31CFD1D61BBBB1BAF3590620";
static const uint8_t binary_fingerprint[16]; // = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20};
CounterColumn() : name(""), value(0) {
}
virtual ~CounterColumn() throw() {}
std::string name;
int64_t value;
void __set_name(const std::string& val) {
name = val;
}
void __set_value(const int64_t val) {
value = val;
}
bool operator == (const CounterColumn & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(value == rhs.value))
return false;
return true;
}
bool operator != (const CounterColumn &rhs) const {
return !(*this == rhs);
}
bool operator < (const CounterColumn & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class CounterSuperColumn {
public:
static const char* ascii_fingerprint; // = "CD4C8C4BF7753E46DE417CDE369343A4";
static const uint8_t binary_fingerprint[16]; // = {0xCD,0x4C,0x8C,0x4B,0xF7,0x75,0x3E,0x46,0xDE,0x41,0x7C,0xDE,0x36,0x93,0x43,0xA4};
CounterSuperColumn() : name("") {
}
virtual ~CounterSuperColumn() throw() {}
std::string name;
std::vector<CounterColumn> columns;
void __set_name(const std::string& val) {
name = val;
}
void __set_columns(const std::vector<CounterColumn> & val) {
columns = val;
}
bool operator == (const CounterSuperColumn & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(columns == rhs.columns))
return false;
return true;
}
bool operator != (const CounterSuperColumn &rhs) const {
return !(*this == rhs);
}
bool operator < (const CounterSuperColumn & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _ColumnOrSuperColumn__isset {
_ColumnOrSuperColumn__isset() : column(false), super_column(false), counter_column(false), counter_super_column(false) {}
bool column;
bool super_column;
bool counter_column;
bool counter_super_column;
} _ColumnOrSuperColumn__isset;
class ColumnOrSuperColumn {
public:
static const char* ascii_fingerprint; // = "2B34AC9E80F1DAA3A2A63B1AB1841E61";
static const uint8_t binary_fingerprint[16]; // = {0x2B,0x34,0xAC,0x9E,0x80,0xF1,0xDA,0xA3,0xA2,0xA6,0x3B,0x1A,0xB1,0x84,0x1E,0x61};
ColumnOrSuperColumn() {
}
virtual ~ColumnOrSuperColumn() throw() {}
Column column;
SuperColumn super_column;
CounterColumn counter_column;
CounterSuperColumn counter_super_column;
_ColumnOrSuperColumn__isset __isset;
void __set_column(const Column& val) {
column = val;
__isset.column = true;
}
void __set_super_column(const SuperColumn& val) {
super_column = val;
__isset.super_column = true;
}
void __set_counter_column(const CounterColumn& val) {
counter_column = val;
__isset.counter_column = true;
}
void __set_counter_super_column(const CounterSuperColumn& val) {
counter_super_column = val;
__isset.counter_super_column = true;
}
bool operator == (const ColumnOrSuperColumn & rhs) const
{
if (__isset.column != rhs.__isset.column)
return false;
else if (__isset.column && !(column == rhs.column))
return false;
if (__isset.super_column != rhs.__isset.super_column)
return false;
else if (__isset.super_column && !(super_column == rhs.super_column))
return false;
if (__isset.counter_column != rhs.__isset.counter_column)
return false;
else if (__isset.counter_column && !(counter_column == rhs.counter_column))
return false;
if (__isset.counter_super_column != rhs.__isset.counter_super_column)
return false;
else if (__isset.counter_super_column && !(counter_super_column == rhs.counter_super_column))
return false;
return true;
}
bool operator != (const ColumnOrSuperColumn &rhs) const {
return !(*this == rhs);
}
bool operator < (const ColumnOrSuperColumn & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class NotFoundException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
NotFoundException() {
}
virtual ~NotFoundException() throw() {}
bool operator == (const NotFoundException & /* rhs */) const
{
return true;
}
bool operator != (const NotFoundException &rhs) const {
return !(*this == rhs);
}
bool operator < (const NotFoundException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class InvalidRequestException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
InvalidRequestException() : why("") {
}
virtual ~InvalidRequestException() throw() {}
std::string why;
void __set_why(const std::string& val) {
why = val;
}
bool operator == (const InvalidRequestException & rhs) const
{
if (!(why == rhs.why))
return false;
return true;
}
bool operator != (const InvalidRequestException &rhs) const {
return !(*this == rhs);
}
bool operator < (const InvalidRequestException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class UnavailableException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
UnavailableException() {
}
virtual ~UnavailableException() throw() {}
bool operator == (const UnavailableException & /* rhs */) const
{
return true;
}
bool operator != (const UnavailableException &rhs) const {
return !(*this == rhs);
}
bool operator < (const UnavailableException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class TimedOutException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
TimedOutException() {
}
virtual ~TimedOutException() throw() {}
bool operator == (const TimedOutException & /* rhs */) const
{
return true;
}
bool operator != (const TimedOutException &rhs) const {
return !(*this == rhs);
}
bool operator < (const TimedOutException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class AuthenticationException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
AuthenticationException() : why("") {
}
virtual ~AuthenticationException() throw() {}
std::string why;
void __set_why(const std::string& val) {
why = val;
}
bool operator == (const AuthenticationException & rhs) const
{
if (!(why == rhs.why))
return false;
return true;
}
bool operator != (const AuthenticationException &rhs) const {
return !(*this == rhs);
}
bool operator < (const AuthenticationException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class AuthorizationException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
AuthorizationException() : why("") {
}
virtual ~AuthorizationException() throw() {}
std::string why;
void __set_why(const std::string& val) {
why = val;
}
bool operator == (const AuthorizationException & rhs) const
{
if (!(why == rhs.why))
return false;
return true;
}
bool operator != (const AuthorizationException &rhs) const {
return !(*this == rhs);
}
bool operator < (const AuthorizationException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class SchemaDisagreementException : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
SchemaDisagreementException() {
}
virtual ~SchemaDisagreementException() throw() {}
bool operator == (const SchemaDisagreementException & /* rhs */) const
{
return true;
}
bool operator != (const SchemaDisagreementException &rhs) const {
return !(*this == rhs);
}
bool operator < (const SchemaDisagreementException & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _ColumnParent__isset {
_ColumnParent__isset() : super_column(false) {}
bool super_column;
} _ColumnParent__isset;
class ColumnParent {
public:
static const char* ascii_fingerprint; // = "0A13AE61181713A4100DFFB3EC293822";
static const uint8_t binary_fingerprint[16]; // = {0x0A,0x13,0xAE,0x61,0x18,0x17,0x13,0xA4,0x10,0x0D,0xFF,0xB3,0xEC,0x29,0x38,0x22};
ColumnParent() : column_family(""), super_column("") {
}
virtual ~ColumnParent() throw() {}
std::string column_family;
std::string super_column;
_ColumnParent__isset __isset;
void __set_column_family(const std::string& val) {
column_family = val;
}
void __set_super_column(const std::string& val) {
super_column = val;
__isset.super_column = true;
}
bool operator == (const ColumnParent & rhs) const
{
if (!(column_family == rhs.column_family))
return false;
if (__isset.super_column != rhs.__isset.super_column)
return false;
else if (__isset.super_column && !(super_column == rhs.super_column))
return false;
return true;
}
bool operator != (const ColumnParent &rhs) const {
return !(*this == rhs);
}
bool operator < (const ColumnParent & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _ColumnPath__isset {
_ColumnPath__isset() : super_column(false), column(false) {}
bool super_column;
bool column;
} _ColumnPath__isset;
class ColumnPath {
public:
static const char* ascii_fingerprint; // = "606212895BCF63C757913CF35AEB3462";
static const uint8_t binary_fingerprint[16]; // = {0x60,0x62,0x12,0x89,0x5B,0xCF,0x63,0xC7,0x57,0x91,0x3C,0xF3,0x5A,0xEB,0x34,0x62};
ColumnPath() : column_family(""), super_column(""), column("") {
}
virtual ~ColumnPath() throw() {}
std::string column_family;
std::string super_column;
std::string column;
_ColumnPath__isset __isset;
void __set_column_family(const std::string& val) {
column_family = val;
}
void __set_super_column(const std::string& val) {
super_column = val;
__isset.super_column = true;
}
void __set_column(const std::string& val) {
column = val;
__isset.column = true;
}
bool operator == (const ColumnPath & rhs) const
{
if (!(column_family == rhs.column_family))
return false;
if (__isset.super_column != rhs.__isset.super_column)
return false;
else if (__isset.super_column && !(super_column == rhs.super_column))
return false;
if (__isset.column != rhs.__isset.column)
return false;
else if (__isset.column && !(column == rhs.column))
return false;
return true;
}
bool operator != (const ColumnPath &rhs) const {
return !(*this == rhs);
}
bool operator < (const ColumnPath & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class SliceRange {
public:
static const char* ascii_fingerprint; // = "184D24C9A0B8D4415E234DB649CAE740";
static const uint8_t binary_fingerprint[16]; // = {0x18,0x4D,0x24,0xC9,0xA0,0xB8,0xD4,0x41,0x5E,0x23,0x4D,0xB6,0x49,0xCA,0xE7,0x40};
SliceRange() : start(""), finish(""), reversed(false), count(100) {
}
virtual ~SliceRange() throw() {}
std::string start;
std::string finish;
bool reversed;
int32_t count;
void __set_start(const std::string& val) {
start = val;
}
void __set_finish(const std::string& val) {
finish = val;
}
void __set_reversed(const bool val) {
reversed = val;
}
void __set_count(const int32_t val) {
count = val;
}
bool operator == (const SliceRange & rhs) const
{
if (!(start == rhs.start))
return false;
if (!(finish == rhs.finish))
return false;
if (!(reversed == rhs.reversed))
return false;
if (!(count == rhs.count))
return false;
return true;
}
bool operator != (const SliceRange &rhs) const {
return !(*this == rhs);
}
bool operator < (const SliceRange & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _SlicePredicate__isset {
_SlicePredicate__isset() : column_names(false), slice_range(false) {}
bool column_names;
bool slice_range;
} _SlicePredicate__isset;
class SlicePredicate {
public:
static const char* ascii_fingerprint; // = "F59D1D81C17DFFAF09988BF1C9CE5E27";
static const uint8_t binary_fingerprint[16]; // = {0xF5,0x9D,0x1D,0x81,0xC1,0x7D,0xFF,0xAF,0x09,0x98,0x8B,0xF1,0xC9,0xCE,0x5E,0x27};
SlicePredicate() {
}
virtual ~SlicePredicate() throw() {}
std::vector<std::string> column_names;
SliceRange slice_range;
_SlicePredicate__isset __isset;
void __set_column_names(const std::vector<std::string> & val) {
column_names = val;
__isset.column_names = true;
}
void __set_slice_range(const SliceRange& val) {
slice_range = val;
__isset.slice_range = true;
}
bool operator == (const SlicePredicate & rhs) const
{
if (__isset.column_names != rhs.__isset.column_names)
return false;
else if (__isset.column_names && !(column_names == rhs.column_names))
return false;
if (__isset.slice_range != rhs.__isset.slice_range)
return false;
else if (__isset.slice_range && !(slice_range == rhs.slice_range))
return false;
return true;
}
bool operator != (const SlicePredicate &rhs) const {
return !(*this == rhs);
}
bool operator < (const SlicePredicate & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class IndexExpression {
public:
static const char* ascii_fingerprint; // = "D9F4CFE2F293A8B1052FD3031DD2C847";
static const uint8_t binary_fingerprint[16]; // = {0xD9,0xF4,0xCF,0xE2,0xF2,0x93,0xA8,0xB1,0x05,0x2F,0xD3,0x03,0x1D,0xD2,0xC8,0x47};
IndexExpression() : column_name(""), op((IndexOperator::type)0), value("") {
}
virtual ~IndexExpression() throw() {}
std::string column_name;
IndexOperator::type op;
std::string value;
void __set_column_name(const std::string& val) {
column_name = val;
}
void __set_op(const IndexOperator::type val) {
op = val;
}
void __set_value(const std::string& val) {
value = val;
}
bool operator == (const IndexExpression & rhs) const
{
if (!(column_name == rhs.column_name))
return false;
if (!(op == rhs.op))
return false;
if (!(value == rhs.value))
return false;
return true;
}
bool operator != (const IndexExpression &rhs) const {
return !(*this == rhs);
}
bool operator < (const IndexExpression & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class IndexClause {
public:
static const char* ascii_fingerprint; // = "9B551B9AB86120B0EEA9005C77FD3C1F";
static const uint8_t binary_fingerprint[16]; // = {0x9B,0x55,0x1B,0x9A,0xB8,0x61,0x20,0xB0,0xEE,0xA9,0x00,0x5C,0x77,0xFD,0x3C,0x1F};
IndexClause() : start_key(""), count(100) {
}
virtual ~IndexClause() throw() {}
std::vector<IndexExpression> expressions;
std::string start_key;
int32_t count;
void __set_expressions(const std::vector<IndexExpression> & val) {
expressions = val;
}
void __set_start_key(const std::string& val) {
start_key = val;
}
void __set_count(const int32_t val) {
count = val;
}
bool operator == (const IndexClause & rhs) const
{
if (!(expressions == rhs.expressions))
return false;
if (!(start_key == rhs.start_key))
return false;
if (!(count == rhs.count))
return false;
return true;
}
bool operator != (const IndexClause &rhs) const {
return !(*this == rhs);
}
bool operator < (const IndexClause & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _KeyRange__isset {
_KeyRange__isset() : start_key(false), end_key(false), start_token(false), end_token(false), row_filter(false) {}
bool start_key;
bool end_key;
bool start_token;
bool end_token;
bool row_filter;
} _KeyRange__isset;
class KeyRange {
public:
static const char* ascii_fingerprint; // = "A6EC82FA0980B91C7C8EB013C61CA1B0";
static const uint8_t binary_fingerprint[16]; // = {0xA6,0xEC,0x82,0xFA,0x09,0x80,0xB9,0x1C,0x7C,0x8E,0xB0,0x13,0xC6,0x1C,0xA1,0xB0};
KeyRange() : start_key(""), end_key(""), start_token(""), end_token(""), count(100) {
}
virtual ~KeyRange() throw() {}
std::string start_key;
std::string end_key;
std::string start_token;
std::string end_token;
std::vector<IndexExpression> row_filter;
int32_t count;
_KeyRange__isset __isset;
void __set_start_key(const std::string& val) {
start_key = val;
__isset.start_key = true;
}
void __set_end_key(const std::string& val) {
end_key = val;
__isset.end_key = true;
}
void __set_start_token(const std::string& val) {
start_token = val;
__isset.start_token = true;
}
void __set_end_token(const std::string& val) {
end_token = val;
__isset.end_token = true;
}
void __set_row_filter(const std::vector<IndexExpression> & val) {
row_filter = val;
__isset.row_filter = true;
}
void __set_count(const int32_t val) {
count = val;
}
bool operator == (const KeyRange & rhs) const
{
if (__isset.start_key != rhs.__isset.start_key)
return false;
else if (__isset.start_key && !(start_key == rhs.start_key))
return false;
if (__isset.end_key != rhs.__isset.end_key)
return false;
else if (__isset.end_key && !(end_key == rhs.end_key))
return false;
if (__isset.start_token != rhs.__isset.start_token)
return false;
else if (__isset.start_token && !(start_token == rhs.start_token))
return false;
if (__isset.end_token != rhs.__isset.end_token)
return false;
else if (__isset.end_token && !(end_token == rhs.end_token))
return false;
if (__isset.row_filter != rhs.__isset.row_filter)
return false;
else if (__isset.row_filter && !(row_filter == rhs.row_filter))
return false;
if (!(count == rhs.count))
return false;
return true;
}
bool operator != (const KeyRange &rhs) const {
return !(*this == rhs);
}
bool operator < (const KeyRange & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class KeySlice {
public:
static const char* ascii_fingerprint; // = "D1568675B0C135C909E3169B72A4DA3D";
static const uint8_t binary_fingerprint[16]; // = {0xD1,0x56,0x86,0x75,0xB0,0xC1,0x35,0xC9,0x09,0xE3,0x16,0x9B,0x72,0xA4,0xDA,0x3D};
KeySlice() : key("") {
}
virtual ~KeySlice() throw() {}
std::string key;
std::vector<ColumnOrSuperColumn> columns;
void __set_key(const std::string& val) {
key = val;
}
void __set_columns(const std::vector<ColumnOrSuperColumn> & val) {
columns = val;
}
bool operator == (const KeySlice & rhs) const
{
if (!(key == rhs.key))
return false;
if (!(columns == rhs.columns))
return false;
return true;
}
bool operator != (const KeySlice &rhs) const {
return !(*this == rhs);
}
bool operator < (const KeySlice & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class KeyCount {
public:
static const char* ascii_fingerprint; // = "EEBC915CE44901401D881E6091423036";
static const uint8_t binary_fingerprint[16]; // = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36};
KeyCount() : key(""), count(0) {
}
virtual ~KeyCount() throw() {}
std::string key;
int32_t count;
void __set_key(const std::string& val) {
key = val;
}
void __set_count(const int32_t val) {
count = val;
}
bool operator == (const KeyCount & rhs) const
{
if (!(key == rhs.key))
return false;
if (!(count == rhs.count))
return false;
return true;
}
bool operator != (const KeyCount &rhs) const {
return !(*this == rhs);
}
bool operator < (const KeyCount & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _Deletion__isset {
_Deletion__isset() : timestamp(false), super_column(false), predicate(false) {}
bool timestamp;
bool super_column;
bool predicate;
} _Deletion__isset;
class Deletion {
public:
static const char* ascii_fingerprint; // = "40F33ECF1C932CA77C2414C4E6C60CBE";
static const uint8_t binary_fingerprint[16]; // = {0x40,0xF3,0x3E,0xCF,0x1C,0x93,0x2C,0xA7,0x7C,0x24,0x14,0xC4,0xE6,0xC6,0x0C,0xBE};
Deletion() : timestamp(0), super_column("") {
}
virtual ~Deletion() throw() {}
int64_t timestamp;
std::string super_column;
SlicePredicate predicate;
_Deletion__isset __isset;
void __set_timestamp(const int64_t val) {
timestamp = val;
__isset.timestamp = true;
}
void __set_super_column(const std::string& val) {
super_column = val;
__isset.super_column = true;
}
void __set_predicate(const SlicePredicate& val) {
predicate = val;
__isset.predicate = true;
}
bool operator == (const Deletion & rhs) const
{
if (__isset.timestamp != rhs.__isset.timestamp)
return false;
else if (__isset.timestamp && !(timestamp == rhs.timestamp))
return false;
if (__isset.super_column != rhs.__isset.super_column)
return false;
else if (__isset.super_column && !(super_column == rhs.super_column))
return false;
if (__isset.predicate != rhs.__isset.predicate)
return false;
else if (__isset.predicate && !(predicate == rhs.predicate))
return false;
return true;
}
bool operator != (const Deletion &rhs) const {
return !(*this == rhs);
}
bool operator < (const Deletion & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _Mutation__isset {
_Mutation__isset() : column_or_supercolumn(false), deletion(false) {}
bool column_or_supercolumn;
bool deletion;
} _Mutation__isset;
class Mutation {
public:
static const char* ascii_fingerprint; // = "E8B65DF3979C6868F80DF81F8E769E63";
static const uint8_t binary_fingerprint[16]; // = {0xE8,0xB6,0x5D,0xF3,0x97,0x9C,0x68,0x68,0xF8,0x0D,0xF8,0x1F,0x8E,0x76,0x9E,0x63};
Mutation() {
}
virtual ~Mutation() throw() {}
ColumnOrSuperColumn column_or_supercolumn;
Deletion deletion;
_Mutation__isset __isset;
void __set_column_or_supercolumn(const ColumnOrSuperColumn& val) {
column_or_supercolumn = val;
__isset.column_or_supercolumn = true;
}
void __set_deletion(const Deletion& val) {
deletion = val;
__isset.deletion = true;
}
bool operator == (const Mutation & rhs) const
{
if (__isset.column_or_supercolumn != rhs.__isset.column_or_supercolumn)
return false;
else if (__isset.column_or_supercolumn && !(column_or_supercolumn == rhs.column_or_supercolumn))
return false;
if (__isset.deletion != rhs.__isset.deletion)
return false;
else if (__isset.deletion && !(deletion == rhs.deletion))
return false;
return true;
}
bool operator != (const Mutation &rhs) const {
return !(*this == rhs);
}
bool operator < (const Mutation & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _EndpointDetails__isset {
_EndpointDetails__isset() : host(false), datacenter(false), rack(false) {}
bool host;
bool datacenter;
bool rack;
} _EndpointDetails__isset;
class EndpointDetails {
public:
static const char* ascii_fingerprint; // = "F4A50F0EC638C7F66026F9B6678FD89B";
static const uint8_t binary_fingerprint[16]; // = {0xF4,0xA5,0x0F,0x0E,0xC6,0x38,0xC7,0xF6,0x60,0x26,0xF9,0xB6,0x67,0x8F,0xD8,0x9B};
EndpointDetails() : host(""), datacenter(""), rack("") {
}
virtual ~EndpointDetails() throw() {}
std::string host;
std::string datacenter;
std::string rack;
_EndpointDetails__isset __isset;
void __set_host(const std::string& val) {
host = val;
}
void __set_datacenter(const std::string& val) {
datacenter = val;
}
void __set_rack(const std::string& val) {
rack = val;
__isset.rack = true;
}
bool operator == (const EndpointDetails & rhs) const
{
if (!(host == rhs.host))
return false;
if (!(datacenter == rhs.datacenter))
return false;
if (__isset.rack != rhs.__isset.rack)
return false;
else if (__isset.rack && !(rack == rhs.rack))
return false;
return true;
}
bool operator != (const EndpointDetails &rhs) const {
return !(*this == rhs);
}
bool operator < (const EndpointDetails & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _TokenRange__isset {
_TokenRange__isset() : rpc_endpoints(false), endpoint_details(false) {}
bool rpc_endpoints;
bool endpoint_details;
} _TokenRange__isset;
class TokenRange {
public:
static const char* ascii_fingerprint; // = "832268DC4CD6B17EE8881FC57EA04679";
static const uint8_t binary_fingerprint[16]; // = {0x83,0x22,0x68,0xDC,0x4C,0xD6,0xB1,0x7E,0xE8,0x88,0x1F,0xC5,0x7E,0xA0,0x46,0x79};
TokenRange() : start_token(""), end_token("") {
}
virtual ~TokenRange() throw() {}
std::string start_token;
std::string end_token;
std::vector<std::string> endpoints;
std::vector<std::string> rpc_endpoints;
std::vector<EndpointDetails> endpoint_details;
_TokenRange__isset __isset;
void __set_start_token(const std::string& val) {
start_token = val;
}
void __set_end_token(const std::string& val) {
end_token = val;
}
void __set_endpoints(const std::vector<std::string> & val) {
endpoints = val;
}
void __set_rpc_endpoints(const std::vector<std::string> & val) {
rpc_endpoints = val;
__isset.rpc_endpoints = true;
}
void __set_endpoint_details(const std::vector<EndpointDetails> & val) {
endpoint_details = val;
__isset.endpoint_details = true;
}
bool operator == (const TokenRange & rhs) const
{
if (!(start_token == rhs.start_token))
return false;
if (!(end_token == rhs.end_token))
return false;
if (!(endpoints == rhs.endpoints))
return false;
if (__isset.rpc_endpoints != rhs.__isset.rpc_endpoints)
return false;
else if (__isset.rpc_endpoints && !(rpc_endpoints == rhs.rpc_endpoints))
return false;
if (__isset.endpoint_details != rhs.__isset.endpoint_details)
return false;
else if (__isset.endpoint_details && !(endpoint_details == rhs.endpoint_details))
return false;
return true;
}
bool operator != (const TokenRange &rhs) const {
return !(*this == rhs);
}
bool operator < (const TokenRange & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class AuthenticationRequest {
public:
static const char* ascii_fingerprint; // = "5EA2D527ECA3BA20C77AFC023EE8C05F";
static const uint8_t binary_fingerprint[16]; // = {0x5E,0xA2,0xD5,0x27,0xEC,0xA3,0xBA,0x20,0xC7,0x7A,0xFC,0x02,0x3E,0xE8,0xC0,0x5F};
AuthenticationRequest() {
}
virtual ~AuthenticationRequest() throw() {}
std::map<std::string, std::string> credentials;
void __set_credentials(const std::map<std::string, std::string> & val) {
credentials = val;
}
bool operator == (const AuthenticationRequest & rhs) const
{
if (!(credentials == rhs.credentials))
return false;
return true;
}
bool operator != (const AuthenticationRequest &rhs) const {
return !(*this == rhs);
}
bool operator < (const AuthenticationRequest & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _ColumnDef__isset {
_ColumnDef__isset() : index_type(false), index_name(false), index_options(false) {}
bool index_type;
bool index_name;
bool index_options;
} _ColumnDef__isset;
class ColumnDef {
public:
static const char* ascii_fingerprint; // = "0D89CE83D7EDAD079AC3213ED1DCAA58";
static const uint8_t binary_fingerprint[16]; // = {0x0D,0x89,0xCE,0x83,0xD7,0xED,0xAD,0x07,0x9A,0xC3,0x21,0x3E,0xD1,0xDC,0xAA,0x58};
ColumnDef() : name(""), validation_class(""), index_type((IndexType::type)0), index_name("") {
}
virtual ~ColumnDef() throw() {}
std::string name;
std::string validation_class;
IndexType::type index_type;
std::string index_name;
std::map<std::string, std::string> index_options;
_ColumnDef__isset __isset;
void __set_name(const std::string& val) {
name = val;
}
void __set_validation_class(const std::string& val) {
validation_class = val;
}
void __set_index_type(const IndexType::type val) {
index_type = val;
__isset.index_type = true;
}
void __set_index_name(const std::string& val) {
index_name = val;
__isset.index_name = true;
}
void __set_index_options(const std::map<std::string, std::string> & val) {
index_options = val;
__isset.index_options = true;
}
bool operator == (const ColumnDef & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(validation_class == rhs.validation_class))
return false;
if (__isset.index_type != rhs.__isset.index_type)
return false;
else if (__isset.index_type && !(index_type == rhs.index_type))
return false;
if (__isset.index_name != rhs.__isset.index_name)
return false;
else if (__isset.index_name && !(index_name == rhs.index_name))
return false;
if (__isset.index_options != rhs.__isset.index_options)
return false;
else if (__isset.index_options && !(index_options == rhs.index_options))
return false;
return true;
}
bool operator != (const ColumnDef &rhs) const {
return !(*this == rhs);
}
bool operator < (const ColumnDef & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _CfDef__isset {
_CfDef__isset() : column_type(false), comparator_type(false), subcomparator_type(false), comment(false), read_repair_chance(false), column_metadata(false), gc_grace_seconds(false), default_validation_class(false), id(false), min_compaction_threshold(false), max_compaction_threshold(false), replicate_on_write(false), key_validation_class(false), key_alias(false), compaction_strategy(false), compaction_strategy_options(false), compression_options(false), bloom_filter_fp_chance(false), caching(false), dclocal_read_repair_chance(false), row_cache_size(false), key_cache_size(false), row_cache_save_period_in_seconds(false), key_cache_save_period_in_seconds(false), memtable_flush_after_mins(false), memtable_throughput_in_mb(false), memtable_operations_in_millions(false), merge_shards_chance(false), row_cache_provider(false), row_cache_keys_to_save(false) {}
bool column_type;
bool comparator_type;
bool subcomparator_type;
bool comment;
bool read_repair_chance;
bool column_metadata;
bool gc_grace_seconds;
bool default_validation_class;
bool id;
bool min_compaction_threshold;
bool max_compaction_threshold;
bool replicate_on_write;
bool key_validation_class;
bool key_alias;
bool compaction_strategy;
bool compaction_strategy_options;
bool compression_options;
bool bloom_filter_fp_chance;
bool caching;
bool dclocal_read_repair_chance;
bool row_cache_size;
bool key_cache_size;
bool row_cache_save_period_in_seconds;
bool key_cache_save_period_in_seconds;
bool memtable_flush_after_mins;
bool memtable_throughput_in_mb;
bool memtable_operations_in_millions;
bool merge_shards_chance;
bool row_cache_provider;
bool row_cache_keys_to_save;
} _CfDef__isset;
class CfDef {
public:
static const char* ascii_fingerprint; // = "231A260521B5DD99EFBCCBDD8768CA7D";
static const uint8_t binary_fingerprint[16]; // = {0x23,0x1A,0x26,0x05,0x21,0xB5,0xDD,0x99,0xEF,0xBC,0xCB,0xDD,0x87,0x68,0xCA,0x7D};
CfDef() : keyspace(""), name(""), column_type("Standard"), comparator_type("BytesType"), subcomparator_type(""), comment(""), read_repair_chance(0), gc_grace_seconds(0), default_validation_class(""), id(0), min_compaction_threshold(0), max_compaction_threshold(0), replicate_on_write(0), key_validation_class(""), key_alias(""), compaction_strategy(""), bloom_filter_fp_chance(0), caching("keys_only"), dclocal_read_repair_chance(0), row_cache_size(0), key_cache_size(0), row_cache_save_period_in_seconds(0), key_cache_save_period_in_seconds(0), memtable_flush_after_mins(0), memtable_throughput_in_mb(0), memtable_operations_in_millions(0), merge_shards_chance(0), row_cache_provider(""), row_cache_keys_to_save(0) {
}
virtual ~CfDef() throw() {}
std::string keyspace;
std::string name;
std::string column_type;
std::string comparator_type;
std::string subcomparator_type;
std::string comment;
double read_repair_chance;
std::vector<ColumnDef> column_metadata;
int32_t gc_grace_seconds;
std::string default_validation_class;
int32_t id;
int32_t min_compaction_threshold;
int32_t max_compaction_threshold;
bool replicate_on_write;
std::string key_validation_class;
std::string key_alias;
std::string compaction_strategy;
std::map<std::string, std::string> compaction_strategy_options;
std::map<std::string, std::string> compression_options;
double bloom_filter_fp_chance;
std::string caching;
double dclocal_read_repair_chance;
double row_cache_size;
double key_cache_size;
int32_t row_cache_save_period_in_seconds;
int32_t key_cache_save_period_in_seconds;
int32_t memtable_flush_after_mins;
int32_t memtable_throughput_in_mb;
double memtable_operations_in_millions;
double merge_shards_chance;
std::string row_cache_provider;
int32_t row_cache_keys_to_save;
_CfDef__isset __isset;
void __set_keyspace(const std::string& val) {
keyspace = val;
}
void __set_name(const std::string& val) {
name = val;
}
void __set_column_type(const std::string& val) {
column_type = val;
__isset.column_type = true;
}
void __set_comparator_type(const std::string& val) {
comparator_type = val;
__isset.comparator_type = true;
}
void __set_subcomparator_type(const std::string& val) {
subcomparator_type = val;
__isset.subcomparator_type = true;
}
void __set_comment(const std::string& val) {
comment = val;
__isset.comment = true;
}
void __set_read_repair_chance(const double val) {
read_repair_chance = val;
__isset.read_repair_chance = true;
}
void __set_column_metadata(const std::vector<ColumnDef> & val) {
column_metadata = val;
__isset.column_metadata = true;
}
void __set_gc_grace_seconds(const int32_t val) {
gc_grace_seconds = val;
__isset.gc_grace_seconds = true;
}
void __set_default_validation_class(const std::string& val) {
default_validation_class = val;
__isset.default_validation_class = true;
}
void __set_id(const int32_t val) {
id = val;
__isset.id = true;
}
void __set_min_compaction_threshold(const int32_t val) {
min_compaction_threshold = val;
__isset.min_compaction_threshold = true;
}
void __set_max_compaction_threshold(const int32_t val) {
max_compaction_threshold = val;
__isset.max_compaction_threshold = true;
}
void __set_replicate_on_write(const bool val) {
replicate_on_write = val;
__isset.replicate_on_write = true;
}
void __set_key_validation_class(const std::string& val) {
key_validation_class = val;
__isset.key_validation_class = true;
}
void __set_key_alias(const std::string& val) {
key_alias = val;
__isset.key_alias = true;
}
void __set_compaction_strategy(const std::string& val) {
compaction_strategy = val;
__isset.compaction_strategy = true;
}
void __set_compaction_strategy_options(const std::map<std::string, std::string> & val) {
compaction_strategy_options = val;
__isset.compaction_strategy_options = true;
}
void __set_compression_options(const std::map<std::string, std::string> & val) {
compression_options = val;
__isset.compression_options = true;
}
void __set_bloom_filter_fp_chance(const double val) {
bloom_filter_fp_chance = val;
__isset.bloom_filter_fp_chance = true;
}
void __set_caching(const std::string& val) {
caching = val;
__isset.caching = true;
}
void __set_dclocal_read_repair_chance(const double val) {
dclocal_read_repair_chance = val;
__isset.dclocal_read_repair_chance = true;
}
void __set_row_cache_size(const double val) {
row_cache_size = val;
__isset.row_cache_size = true;
}
void __set_key_cache_size(const double val) {
key_cache_size = val;
__isset.key_cache_size = true;
}
void __set_row_cache_save_period_in_seconds(const int32_t val) {
row_cache_save_period_in_seconds = val;
__isset.row_cache_save_period_in_seconds = true;
}
void __set_key_cache_save_period_in_seconds(const int32_t val) {
key_cache_save_period_in_seconds = val;
__isset.key_cache_save_period_in_seconds = true;
}
void __set_memtable_flush_after_mins(const int32_t val) {
memtable_flush_after_mins = val;
__isset.memtable_flush_after_mins = true;
}
void __set_memtable_throughput_in_mb(const int32_t val) {
memtable_throughput_in_mb = val;
__isset.memtable_throughput_in_mb = true;
}
void __set_memtable_operations_in_millions(const double val) {
memtable_operations_in_millions = val;
__isset.memtable_operations_in_millions = true;
}
void __set_merge_shards_chance(const double val) {
merge_shards_chance = val;
__isset.merge_shards_chance = true;
}
void __set_row_cache_provider(const std::string& val) {
row_cache_provider = val;
__isset.row_cache_provider = true;
}
void __set_row_cache_keys_to_save(const int32_t val) {
row_cache_keys_to_save = val;
__isset.row_cache_keys_to_save = true;
}
bool operator == (const CfDef & rhs) const
{
if (!(keyspace == rhs.keyspace))
return false;
if (!(name == rhs.name))
return false;
if (__isset.column_type != rhs.__isset.column_type)
return false;
else if (__isset.column_type && !(column_type == rhs.column_type))
return false;
if (__isset.comparator_type != rhs.__isset.comparator_type)
return false;
else if (__isset.comparator_type && !(comparator_type == rhs.comparator_type))
return false;
if (__isset.subcomparator_type != rhs.__isset.subcomparator_type)
return false;
else if (__isset.subcomparator_type && !(subcomparator_type == rhs.subcomparator_type))
return false;
if (__isset.comment != rhs.__isset.comment)
return false;
else if (__isset.comment && !(comment == rhs.comment))
return false;
if (__isset.read_repair_chance != rhs.__isset.read_repair_chance)
return false;
else if (__isset.read_repair_chance && !(read_repair_chance == rhs.read_repair_chance))
return false;
if (__isset.column_metadata != rhs.__isset.column_metadata)
return false;
else if (__isset.column_metadata && !(column_metadata == rhs.column_metadata))
return false;
if (__isset.gc_grace_seconds != rhs.__isset.gc_grace_seconds)
return false;
else if (__isset.gc_grace_seconds && !(gc_grace_seconds == rhs.gc_grace_seconds))
return false;
if (__isset.default_validation_class != rhs.__isset.default_validation_class)
return false;
else if (__isset.default_validation_class && !(default_validation_class == rhs.default_validation_class))
return false;
if (__isset.id != rhs.__isset.id)
return false;
else if (__isset.id && !(id == rhs.id))
return false;
if (__isset.min_compaction_threshold != rhs.__isset.min_compaction_threshold)
return false;
else if (__isset.min_compaction_threshold && !(min_compaction_threshold == rhs.min_compaction_threshold))
return false;
if (__isset.max_compaction_threshold != rhs.__isset.max_compaction_threshold)
return false;
else if (__isset.max_compaction_threshold && !(max_compaction_threshold == rhs.max_compaction_threshold))
return false;
if (__isset.replicate_on_write != rhs.__isset.replicate_on_write)
return false;
else if (__isset.replicate_on_write && !(replicate_on_write == rhs.replicate_on_write))
return false;
if (__isset.key_validation_class != rhs.__isset.key_validation_class)
return false;
else if (__isset.key_validation_class && !(key_validation_class == rhs.key_validation_class))
return false;
if (__isset.key_alias != rhs.__isset.key_alias)
return false;
else if (__isset.key_alias && !(key_alias == rhs.key_alias))
return false;
if (__isset.compaction_strategy != rhs.__isset.compaction_strategy)
return false;
else if (__isset.compaction_strategy && !(compaction_strategy == rhs.compaction_strategy))
return false;
if (__isset.compaction_strategy_options != rhs.__isset.compaction_strategy_options)
return false;
else if (__isset.compaction_strategy_options && !(compaction_strategy_options == rhs.compaction_strategy_options))
return false;
if (__isset.compression_options != rhs.__isset.compression_options)
return false;
else if (__isset.compression_options && !(compression_options == rhs.compression_options))
return false;
if (__isset.bloom_filter_fp_chance != rhs.__isset.bloom_filter_fp_chance)
return false;
else if (__isset.bloom_filter_fp_chance && !(bloom_filter_fp_chance == rhs.bloom_filter_fp_chance))
return false;
if (__isset.caching != rhs.__isset.caching)
return false;
else if (__isset.caching && !(caching == rhs.caching))
return false;
if (__isset.dclocal_read_repair_chance != rhs.__isset.dclocal_read_repair_chance)
return false;
else if (__isset.dclocal_read_repair_chance && !(dclocal_read_repair_chance == rhs.dclocal_read_repair_chance))
return false;
if (__isset.row_cache_size != rhs.__isset.row_cache_size)
return false;
else if (__isset.row_cache_size && !(row_cache_size == rhs.row_cache_size))
return false;
if (__isset.key_cache_size != rhs.__isset.key_cache_size)
return false;
else if (__isset.key_cache_size && !(key_cache_size == rhs.key_cache_size))
return false;
if (__isset.row_cache_save_period_in_seconds != rhs.__isset.row_cache_save_period_in_seconds)
return false;
else if (__isset.row_cache_save_period_in_seconds && !(row_cache_save_period_in_seconds == rhs.row_cache_save_period_in_seconds))
return false;
if (__isset.key_cache_save_period_in_seconds != rhs.__isset.key_cache_save_period_in_seconds)
return false;
else if (__isset.key_cache_save_period_in_seconds && !(key_cache_save_period_in_seconds == rhs.key_cache_save_period_in_seconds))
return false;
if (__isset.memtable_flush_after_mins != rhs.__isset.memtable_flush_after_mins)
return false;
else if (__isset.memtable_flush_after_mins && !(memtable_flush_after_mins == rhs.memtable_flush_after_mins))
return false;
if (__isset.memtable_throughput_in_mb != rhs.__isset.memtable_throughput_in_mb)
return false;
else if (__isset.memtable_throughput_in_mb && !(memtable_throughput_in_mb == rhs.memtable_throughput_in_mb))
return false;
if (__isset.memtable_operations_in_millions != rhs.__isset.memtable_operations_in_millions)
return false;
else if (__isset.memtable_operations_in_millions && !(memtable_operations_in_millions == rhs.memtable_operations_in_millions))
return false;
if (__isset.merge_shards_chance != rhs.__isset.merge_shards_chance)
return false;
else if (__isset.merge_shards_chance && !(merge_shards_chance == rhs.merge_shards_chance))
return false;
if (__isset.row_cache_provider != rhs.__isset.row_cache_provider)
return false;
else if (__isset.row_cache_provider && !(row_cache_provider == rhs.row_cache_provider))
return false;
if (__isset.row_cache_keys_to_save != rhs.__isset.row_cache_keys_to_save)
return false;
else if (__isset.row_cache_keys_to_save && !(row_cache_keys_to_save == rhs.row_cache_keys_to_save))
return false;
return true;
}
bool operator != (const CfDef &rhs) const {
return !(*this == rhs);
}
bool operator < (const CfDef & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _KsDef__isset {
_KsDef__isset() : strategy_options(false), replication_factor(false), durable_writes(false) {}
bool strategy_options;
bool replication_factor;
bool durable_writes;
} _KsDef__isset;
class KsDef {
public:
static const char* ascii_fingerprint; // = "0767851B6476EB3777A21E59E912E11A";
static const uint8_t binary_fingerprint[16]; // = {0x07,0x67,0x85,0x1B,0x64,0x76,0xEB,0x37,0x77,0xA2,0x1E,0x59,0xE9,0x12,0xE1,0x1A};
KsDef() : name(""), strategy_class(""), replication_factor(0), durable_writes(true) {
}
virtual ~KsDef() throw() {}
std::string name;
std::string strategy_class;
std::map<std::string, std::string> strategy_options;
int32_t replication_factor;
std::vector<CfDef> cf_defs;
bool durable_writes;
_KsDef__isset __isset;
void __set_name(const std::string& val) {
name = val;
}
void __set_strategy_class(const std::string& val) {
strategy_class = val;
}
void __set_strategy_options(const std::map<std::string, std::string> & val) {
strategy_options = val;
__isset.strategy_options = true;
}
void __set_replication_factor(const int32_t val) {
replication_factor = val;
__isset.replication_factor = true;
}
void __set_cf_defs(const std::vector<CfDef> & val) {
cf_defs = val;
}
void __set_durable_writes(const bool val) {
durable_writes = val;
__isset.durable_writes = true;
}
bool operator == (const KsDef & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(strategy_class == rhs.strategy_class))
return false;
if (__isset.strategy_options != rhs.__isset.strategy_options)
return false;
else if (__isset.strategy_options && !(strategy_options == rhs.strategy_options))
return false;
if (__isset.replication_factor != rhs.__isset.replication_factor)
return false;
else if (__isset.replication_factor && !(replication_factor == rhs.replication_factor))
return false;
if (!(cf_defs == rhs.cf_defs))
return false;
if (__isset.durable_writes != rhs.__isset.durable_writes)
return false;
else if (__isset.durable_writes && !(durable_writes == rhs.durable_writes))
return false;
return true;
}
bool operator != (const KsDef &rhs) const {
return !(*this == rhs);
}
bool operator < (const KsDef & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class CqlRow {
public:
static const char* ascii_fingerprint; // = "470EFC558004E98D92D604898305C04E";
static const uint8_t binary_fingerprint[16]; // = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E};
CqlRow() : key("") {
}
virtual ~CqlRow() throw() {}
std::string key;
std::vector<Column> columns;
void __set_key(const std::string& val) {
key = val;
}
void __set_columns(const std::vector<Column> & val) {
columns = val;
}
bool operator == (const CqlRow & rhs) const
{
if (!(key == rhs.key))
return false;
if (!(columns == rhs.columns))
return false;
return true;
}
bool operator != (const CqlRow &rhs) const {
return !(*this == rhs);
}
bool operator < (const CqlRow & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class CqlMetadata {
public:
static const char* ascii_fingerprint; // = "B7C5A4AA9652C744A48EBC1C12D531E7";
static const uint8_t binary_fingerprint[16]; // = {0xB7,0xC5,0xA4,0xAA,0x96,0x52,0xC7,0x44,0xA4,0x8E,0xBC,0x1C,0x12,0xD5,0x31,0xE7};
CqlMetadata() : default_name_type(""), default_value_type("") {
}
virtual ~CqlMetadata() throw() {}
std::map<std::string, std::string> name_types;
std::map<std::string, std::string> value_types;
std::string default_name_type;
std::string default_value_type;
void __set_name_types(const std::map<std::string, std::string> & val) {
name_types = val;
}
void __set_value_types(const std::map<std::string, std::string> & val) {
value_types = val;
}
void __set_default_name_type(const std::string& val) {
default_name_type = val;
}
void __set_default_value_type(const std::string& val) {
default_value_type = val;
}
bool operator == (const CqlMetadata & rhs) const
{
if (!(name_types == rhs.name_types))
return false;
if (!(value_types == rhs.value_types))
return false;
if (!(default_name_type == rhs.default_name_type))
return false;
if (!(default_value_type == rhs.default_value_type))
return false;
return true;
}
bool operator != (const CqlMetadata &rhs) const {
return !(*this == rhs);
}
bool operator < (const CqlMetadata & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _CqlResult__isset {
_CqlResult__isset() : rows(false), num(false), schema(false) {}
bool rows;
bool num;
bool schema;
} _CqlResult__isset;
class CqlResult {
public:
static const char* ascii_fingerprint; // = "521B9CE5AF77539F7267F6952B609E81";
static const uint8_t binary_fingerprint[16]; // = {0x52,0x1B,0x9C,0xE5,0xAF,0x77,0x53,0x9F,0x72,0x67,0xF6,0x95,0x2B,0x60,0x9E,0x81};
CqlResult() : type((CqlResultType::type)0), num(0) {
}
virtual ~CqlResult() throw() {}
CqlResultType::type type;
std::vector<CqlRow> rows;
int32_t num;
CqlMetadata schema;
_CqlResult__isset __isset;
void __set_type(const CqlResultType::type val) {
type = val;
}
void __set_rows(const std::vector<CqlRow> & val) {
rows = val;
__isset.rows = true;
}
void __set_num(const int32_t val) {
num = val;
__isset.num = true;
}
void __set_schema(const CqlMetadata& val) {
schema = val;
__isset.schema = true;
}
bool operator == (const CqlResult & rhs) const
{
if (!(type == rhs.type))
return false;
if (__isset.rows != rhs.__isset.rows)
return false;
else if (__isset.rows && !(rows == rhs.rows))
return false;
if (__isset.num != rhs.__isset.num)
return false;
else if (__isset.num && !(num == rhs.num))
return false;
if (__isset.schema != rhs.__isset.schema)
return false;
else if (__isset.schema && !(schema == rhs.schema))
return false;
return true;
}
bool operator != (const CqlResult &rhs) const {
return !(*this == rhs);
}
bool operator < (const CqlResult & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _CqlPreparedResult__isset {
_CqlPreparedResult__isset() : variable_types(false), variable_names(false) {}
bool variable_types;
bool variable_names;
} _CqlPreparedResult__isset;
class CqlPreparedResult {
public:
static const char* ascii_fingerprint; // = "7E1663EC688DFDC28722BF36F9F64E6F";
static const uint8_t binary_fingerprint[16]; // = {0x7E,0x16,0x63,0xEC,0x68,0x8D,0xFD,0xC2,0x87,0x22,0xBF,0x36,0xF9,0xF6,0x4E,0x6F};
CqlPreparedResult() : itemId(0), count(0) {
}
virtual ~CqlPreparedResult() throw() {}
int32_t itemId;
int32_t count;
std::vector<std::string> variable_types;
std::vector<std::string> variable_names;
_CqlPreparedResult__isset __isset;
void __set_itemId(const int32_t val) {
itemId = val;
}
void __set_count(const int32_t val) {
count = val;
}
void __set_variable_types(const std::vector<std::string> & val) {
variable_types = val;
__isset.variable_types = true;
}
void __set_variable_names(const std::vector<std::string> & val) {
variable_names = val;
__isset.variable_names = true;
}
bool operator == (const CqlPreparedResult & rhs) const
{
if (!(itemId == rhs.itemId))
return false;
if (!(count == rhs.count))
return false;
if (__isset.variable_types != rhs.__isset.variable_types)
return false;
else if (__isset.variable_types && !(variable_types == rhs.variable_types))
return false;
if (__isset.variable_names != rhs.__isset.variable_names)
return false;
else if (__isset.variable_names && !(variable_names == rhs.variable_names))
return false;
return true;
}
bool operator != (const CqlPreparedResult &rhs) const {
return !(*this == rhs);
}
bool operator < (const CqlPreparedResult & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
}}} // namespace
#endif
/*
MP AB copyrights
*/
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include <mysql/plugin.h>
#include "ha_cassandra.h"
#include "sql_class.h"
static handler *cassandra_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
handlerton *cassandra_hton;
/*
Hash used to track the number of open tables; variable for example share
methods
*/
static HASH cassandra_open_tables;
/* The mutex used to init the hash; variable for example share methods */
mysql_mutex_t cassandra_mutex;
/**
Structure for CREATE TABLE options (table options).
It needs to be called ha_table_option_struct.
The option values can be specified in the CREATE TABLE at the end:
CREATE TABLE ( ... ) *here*
*/
struct ha_table_option_struct
{
const char *host;
const char *keyspace;
const char *column_family;
};
ha_create_table_option cassandra_table_option_list[]=
{
/*
one option that takes an arbitrary string
*/
HA_TOPTION_STRING("thrift_host", host),
HA_TOPTION_STRING("keyspace", keyspace),
HA_TOPTION_STRING("column_family", column_family),
HA_TOPTION_END
};
/**
@brief
Function we use in the creation of our hash to get key.
*/
static uchar* cassandra_get_key(CASSANDRA_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
return (uchar*) share->table_name;
}
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_CASSANDRA_SHARE_mutex;
static PSI_mutex_info all_cassandra_mutexes[]=
{
{ &ex_key_mutex_example, "cassandra", PSI_FLAG_GLOBAL},
{ &ex_key_mutex_CASSANDRA_SHARE_mutex, "CASSANDRA_SHARE::mutex", 0}
};
static void init_cassandra_psi_keys()
{
const char* category= "cassandra";
int count;
if (PSI_server == NULL)
return;
count= array_elements(all_cassandra_mutexes);
PSI_server->register_mutex(category, all_cassandra_mutexes, count);
}
#endif
static int cassandra_init_func(void *p)
{
DBUG_ENTER("cassandra_init_func");
#ifdef HAVE_PSI_INTERFACE
init_cassandra_psi_keys();
#endif
cassandra_hton= (handlerton *)p;
mysql_mutex_init(ex_key_mutex_example, &cassandra_mutex, MY_MUTEX_INIT_FAST);
(void) my_hash_init(&cassandra_open_tables,system_charset_info,32,0,0,
(my_hash_get_key) cassandra_get_key,0,0);
cassandra_hton->state= SHOW_OPTION_YES;
cassandra_hton->create= cassandra_create_handler;
cassandra_hton->flags= HTON_CAN_RECREATE;
cassandra_hton->table_options= cassandra_table_option_list;
//cassandra_hton->field_options= example_field_option_list;
cassandra_hton->field_options= NULL;
DBUG_RETURN(0);
}
static int cassandra_done_func(void *p)
{
int error= 0;
DBUG_ENTER("cassandra_done_func");
if (cassandra_open_tables.records)
error= 1;
my_hash_free(&cassandra_open_tables);
mysql_mutex_destroy(&cassandra_mutex);
DBUG_RETURN(error);
}
/**
@brief
Example of simple lock controls. The "share" it creates is a
structure we will pass to each cassandra handler. Do you have to have
one of these? Well, you have pieces that are used for locking, and
they are needed to function.
*/
static CASSANDRA_SHARE *get_share(const char *table_name, TABLE *table)
{
CASSANDRA_SHARE *share;
uint length;
char *tmp_name;
mysql_mutex_lock(&cassandra_mutex);
length=(uint) strlen(table_name);
if (!(share=(CASSANDRA_SHARE*) my_hash_search(&cassandra_open_tables,
(uchar*) table_name,
length)))
{
if (!(share=(CASSANDRA_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share),
&tmp_name, length+1,
NullS)))
{
mysql_mutex_unlock(&cassandra_mutex);
return NULL;
}
share->use_count=0;
share->table_name_length=length;
share->table_name=tmp_name;
strmov(share->table_name,table_name);
if (my_hash_insert(&cassandra_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
mysql_mutex_init(ex_key_mutex_CASSANDRA_SHARE_mutex,
&share->mutex, MY_MUTEX_INIT_FAST);
}
share->use_count++;
mysql_mutex_unlock(&cassandra_mutex);
return share;
error:
mysql_mutex_destroy(&share->mutex);
my_free(share);
return NULL;
}
/**
@brief
Free lock controls. We call this whenever we close a table. If the table had
the last reference to the share, then we free memory associated with it.
*/
static int free_share(CASSANDRA_SHARE *share)
{
mysql_mutex_lock(&cassandra_mutex);
if (!--share->use_count)
{
my_hash_delete(&cassandra_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->mutex);
my_free(share);
}
mysql_mutex_unlock(&cassandra_mutex);
return 0;
}
static handler* cassandra_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_cassandra(hton, table);
}
ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg),
se(NULL), names_and_vals(NULL)
{}
static const char *ha_cassandra_exts[] = {
NullS
};
const char **ha_cassandra::bas_ext() const
{
return ha_cassandra_exts;
}
int ha_cassandra::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_cassandra::open");
if (!(share = get_share(name, table)))
DBUG_RETURN(1);
thr_lock_data_init(&share->lock,&lock,NULL);
ha_table_option_struct *options= table->s->option_struct;
fprintf(stderr, "ha_cass: open thrift_host=%s keyspace=%s column_family=%s\n",
options->host, options->keyspace, options->column_family);
DBUG_ASSERT(!se);
if (!options->host || !options->keyspace || !options->column_family)
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
se= get_cassandra_se();
se->set_column_family(options->column_family);
if (se->connect(options->host, options->keyspace))
{
my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str());
DBUG_RETURN(HA_ERR_NO_CONNECTION);
}
DBUG_RETURN(0);
}
int ha_cassandra::close(void)
{
DBUG_ENTER("ha_cassandra::close");
delete se;
se= NULL;
if (names_and_vals)
{
my_free(names_and_vals);
names_and_vals= NULL;
}
DBUG_RETURN(free_share(share));
}
/**
@brief
create() is called to create a database. The variable name will have the name
of the table.
@details
When create() is called you do not need to worry about
opening the table. Also, the .frm file will have already been
created so adjusting create_info is not necessary. You can overwrite
the .frm file at this point if you wish to change the table
definition, but there are no methods currently provided for doing
so.
Called from handle.cc by ha_create_table().
@see
ha_create_table() in handle.cc
*/
int ha_cassandra::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info)
{
ha_table_option_struct *options= table_arg->s->option_struct;
DBUG_ENTER("ha_cassandra::create");
DBUG_ASSERT(options);
//psergey-todo: This is called for CREATE TABLE... check options here.
/*
if (table_arg->s->fields != 2)
{
my_error(ER_WRONG_COLUMN_NAME, MYF(0), "The table must have two fields");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
}
*/
Field **pfield= table_arg->s->field;
if (strcmp((*pfield)->field_name, "rowkey"))
{
my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be named 'rowkey'");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
}
if (table_arg->s->keys != 1 || table_arg->s->primary_key !=0 ||
table_arg->key_info[0].key_parts != 1 ||
table_arg->key_info[0].key_part[0].fieldnr != 1)
{
my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Table must have one PRIMARY KEY(rowkey)");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
}
/*
pfield++;
if (strcmp((*pfield)->field_name, "data"))
{
my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Second column must be named 'data'");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
}
*/
#ifndef DBUG_OFF
/*
DBUG_PRINT("info", ("strparam: '%-.64s' ullparam: %llu enumparam: %u "\
"boolparam: %u",
(options->strparam ? options->strparam : "<NULL>"),
options->ullparam, options->enumparam, options->boolparam));
psergey-todo: check table definition!
for (Field **field= table_arg->s->field; *field; field++)
{
ha_field_option_struct *field_options= (*field)->option_struct;
DBUG_ASSERT(field_options);
DBUG_PRINT("info", ("field: %s complex: '%-.64s'",
(*field)->field_name,
(field_options->complex_param_to_parse_it_in_engine ?
field_options->complex_param_to_parse_it_in_engine :
"<NULL>")));
}
*/
#endif
DBUG_ASSERT(!se);
if (!options->host || !options->keyspace || !options->column_family)
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
se= get_cassandra_se();
se->set_column_family(options->column_family);
if (se->connect(options->host, options->keyspace))
{
my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str());
DBUG_RETURN(HA_ERR_NO_CONNECTION);
}
/*
TODO: what about mapping the primary key? It has a 'type', too...
see CfDef::key_validation_class ? see also CfDef::key_alias?
*/
se->first_ddl_column();
char *col_name;
int col_name_len;
char *col_type;
int col_type_len;
while (!se->next_ddl_column(&col_name, &col_name_len, &col_type,
&col_type_len))
{
/* Mapping for the 1st field is already known */
for (Field **field= table_arg->s->field + 1; *field; field++)
{
if (!strcmp((*field)->field_name, col_name))
{
//map_field_to_type(field, col_type);
}
}
}
DBUG_RETURN(0);
}
/*
Mapping needs to
- copy value from MySQL record to Thrift buffer
- copy value from Thrift bufer to MySQL record..
*/
const char * const validator_bigint="org.apache.cassandra.db.marshal.LongType";
const char * const validator_int="org.apache.cassandra.db.marshal.Int32Type";
const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType";
const char * const validator_float= "org.apache.cassandra.db.marshal.FloatType";
const char * const validator_double= "org.apache.cassandra.db.marshal.DoubleType";
void map_field_to_type(Field *field, const char *validator_name)
{
switch(field->type()) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
if (!strcmp(validator_name, validator_bigint))
{
//setup bigint validator
}
break;
case MYSQL_TYPE_FLOAT:
if (!strcmp(validator_name, validator_float))
break;
case MYSQL_TYPE_DOUBLE:
if (!strcmp(validator_name, validator_double))
break;
default:
DBUG_ASSERT(0);
}
}
void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
int ha_cassandra::index_read_map(uchar *buf, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
int rc;
DBUG_ENTER("ha_cassandra::index_read_map");
if (find_flag != HA_READ_KEY_EXACT)
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
// todo: decode the search key.
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
store_key_image_to_rec(table->field[0], (uchar*)key, key_len);
char buff[256];
String tmp(buff,sizeof(buff), &my_charset_bin);
tmp.length(0);
String *str;
str= table->field[0]->val_str(&tmp);
bool found;
if (se->get_slice((char*)str->ptr(), str->length(), get_names_and_vals(), &found))
rc= HA_ERR_INTERNAL_ERROR;
else
{
if (found)
{
//NameAndValue *nv= get_names_and_vals();
// TODO: walk through the (name, value) pairs and return values.
}
else
rc= HA_ERR_KEY_NOT_FOUND;
}
#ifdef NEW_CODE
se->get_slice();
for each column
{
find column;
}
#endif
DBUG_RETURN(rc);
}
int ha_cassandra::write_row(uchar *buf)
{
my_bitmap_map *old_map;
char buff[512];
NameAndValue *tuple;
NameAndValue *nv;
DBUG_ENTER("ha_cassandra::write_row");
/* Temporary malloc-happy code just to get INSERTs to work */
nv= tuple= get_names_and_vals();
old_map= dbug_tmp_use_all_columns(table, table->read_set);
for (Field **field= table->field; *field; field++, nv++)
{
String tmp(buff,sizeof(buff), &my_charset_bin);
tmp.length(0);
String *str;
str= (*field)->val_str(&tmp);
nv->name= (char*)(*field)->field_name;
nv->value_len= str->length();
nv->value= (char*)my_malloc(nv->value_len, MYF(0));
memcpy(nv->value, str->ptr(), nv->value_len);
}
nv->name= NULL;
dbug_tmp_restore_column_map(table->read_set, old_map);
//invoke!
bool res= se->insert(tuple);
for (nv= tuple; nv->name; nv++)
{
my_free(nv->value);
}
DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0);
}
NameAndValue *ha_cassandra::get_names_and_vals()
{
if (names_and_vals)
return names_and_vals;
else
{
size_t size= sizeof(NameAndValue) * (table->s->fields + 1);
names_and_vals= (NameAndValue*)my_malloc(size ,0);
memset(names_and_vals, 0, size);
return names_and_vals;
}
}
/////////////////////////////////////////////////////////////////////////////
// Dummy implementations start
/////////////////////////////////////////////////////////////////////////////
int ha_cassandra::index_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_cassandra::index_next");
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
}
int ha_cassandra::index_prev(uchar *buf)
{
int rc;
DBUG_ENTER("ha_cassandra::index_prev");
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
}
int ha_cassandra::index_first(uchar *buf)
{
int rc;
DBUG_ENTER("ha_cassandra::index_first");
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
}
int ha_cassandra::index_last(uchar *buf)
{
int rc;
DBUG_ENTER("ha_cassandra::index_last");
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
}
int ha_cassandra::rnd_init(bool scan)
{
DBUG_ENTER("ha_cassandra::rnd_init");
DBUG_RETURN(0);
}
int ha_cassandra::rnd_end()
{
DBUG_ENTER("ha_cassandra::rnd_end");
DBUG_RETURN(0);
}
int ha_cassandra::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_cassandra::rnd_next");
rc= HA_ERR_END_OF_FILE;
DBUG_RETURN(rc);
}
void ha_cassandra::position(const uchar *record)
{
DBUG_ENTER("ha_cassandra::position");
DBUG_VOID_RETURN;
}
int ha_cassandra::rnd_pos(uchar *buf, uchar *pos)
{
int rc;
DBUG_ENTER("ha_cassandra::rnd_pos");
rc= HA_ERR_WRONG_COMMAND;
DBUG_RETURN(rc);
}
ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key,
key_range *max_key)
{
DBUG_ENTER("ha_cassandra::records_in_range");
DBUG_RETURN(10); // low number to force index usage
}
int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
{
DBUG_ENTER("ha_cassandra::update_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
int ha_cassandra::info(uint flag)
{
DBUG_ENTER("ha_cassandra::info");
DBUG_RETURN(0);
}
int ha_cassandra::extra(enum ha_extra_function operation)
{
DBUG_ENTER("ha_cassandra::extra");
DBUG_RETURN(0);
}
THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
{
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
lock.type=lock_type;
*to++= &lock;
return to;
}
int ha_cassandra::external_lock(THD *thd, int lock_type)
{
DBUG_ENTER("ha_cassandra::external_lock");
DBUG_RETURN(0);
}
int ha_cassandra::delete_table(const char *name)
{
DBUG_ENTER("ha_cassandra::delete_table");
/* This is not implemented but we want someone to be able that it works. */
DBUG_RETURN(0);
}
int ha_cassandra::delete_row(const uchar *buf)
{
DBUG_ENTER("ha_cassandra::delete_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
int ha_cassandra::delete_all_rows()
{
DBUG_ENTER("ha_cassandra::delete_all_rows");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
/**
check_if_incompatible_data() called if ALTER TABLE can't detect otherwise
if new and old definition are compatible
@details If there are no other explicit signs like changed number of
fields this function will be called by compare_tables()
(sql/sql_tables.cc) to decide should we rewrite whole table or only .frm
file.
*/
bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes)
{
//ha_table_option_struct *param_old, *param_new;
DBUG_ENTER("ha_cassandra::check_if_incompatible_data");
DBUG_RETURN(COMPATIBLE_DATA_YES);
}
/////////////////////////////////////////////////////////////////////////////
// Dummy implementations end
/////////////////////////////////////////////////////////////////////////////
static struct st_mysql_sys_var* cassandra_system_variables[]= {
// MYSQL_SYSVAR(enum_var),
// MYSQL_SYSVAR(ulong_var),
NULL
};
struct st_mysql_storage_engine cassandra_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
static struct st_mysql_show_var func_status[]=
{
// {"example_func_example", (char *)show_func_example, SHOW_FUNC},
{0,0,SHOW_UNDEF}
};
maria_declare_plugin(cassandra)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&cassandra_storage_engine,
"CASSANDRA",
"Monty Program Ab",
"Cassandra storage engine",
PLUGIN_LICENSE_GPL,
cassandra_init_func, /* Plugin Init */
cassandra_done_func, /* Plugin Deinit */
0x0001, /* version number (0.1) */
func_status, /* status variables */
cassandra_system_variables, /* system variables */
"0.1", /* string version */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* maturity */
}
maria_declare_plugin_end;
/*
MP AB copyrights
*/
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
#include "my_global.h" /* ulonglong */
#include "thr_lock.h" /* THR_LOCK, THR_LOCK_DATA */
#include "handler.h" /* handler */
#include "my_base.h" /* ha_rows */
#include "cassandra_se.h"
/** @brief
CASSANDRA_SHARE is a structure that will be shared among all open handlers.
This example implements the minimum of what you will probably need.
*/
typedef struct st_cassandra_share {
char *table_name;
uint table_name_length,use_count;
mysql_mutex_t mutex;
THR_LOCK lock;
} CASSANDRA_SHARE;
/** @brief
Class definition for the storage engine
*/
class ha_cassandra: public handler
{
THR_LOCK_DATA lock; ///< MySQL lock
CASSANDRA_SHARE *share; ///< Shared lock info
Cassandra_se_interface *se;
/* pre-allocated array of #fields elements */
NameAndValue *names_and_vals;
NameAndValue *get_names_and_vals();
public:
ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg);
~ha_cassandra()
{
delete se;
}
/** @brief
The name that will be used for display purposes.
*/
const char *table_type() const { return "CASSANDRA"; }
/** @brief
The name of the index type that will be used for display.
Don't implement this method unless you really have indexes.
*/
const char *index_type(uint inx) { return "HASH"; }
/** @brief
The file extensions.
*/
const char **bas_ext() const;
/** @brief
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
ulonglong table_flags() const
{
/*
We are saying that this engine is just statement capable to have
an engine that can only handle statement-based logging. This is
used in testing.
*/
return HA_BINLOG_STMT_CAPABLE;
}
/** @brief
This is a bitmap of flags that indicates how the storage engine
implements indexes. The current index flags are documented in
handler.h. If you do not implement indexes, just return zero here.
@details
part is the key part to check. First key part is 0.
If all_parts is set, MySQL wants to know the flags for the combined
index, up to and including 'part'.
*/
ulong index_flags(uint inx, uint part, bool all_parts) const
{
return 0;
}
/** @brief
unireg.cc will call max_supported_record_length(), max_supported_keys(),
max_supported_key_parts(), uint max_supported_key_length()
to make sure that the storage engine can handle the data it is about to
send. Return *real* limits of your storage engine here; MySQL will do
min(your_limits, MySQL_limits) automatically.
*/
uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
/* Support only one Primary Key, for now */
uint max_supported_keys() const { return 1; }
uint max_supported_key_parts() const { return 1; }
/** @brief
unireg.cc will call this to make sure that the storage engine can handle
the data it is about to send. Return *real* limits of your storage engine
here; MySQL will do min(your_limits, MySQL_limits) automatically.
@details
There is no need to implement ..._key_... methods if your engine doesn't
support indexes.
*/
uint max_supported_key_length() const { return 16*1024; /* just to return something*/ }
/* At the moment, we're ok with default handler::index_init() implementation. */
int index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
/** @brief
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; }
/** @brief
This method will never be called if you do not implement indexes.
*/
virtual double read_time(uint, uint, ha_rows rows)
{ return (double) rows / 20.0+1; }
/*
Everything below are methods that we implement in ha_example.cc.
Most of these methods are not obligatory, skip them and
MySQL will treat them as not implemented
*/
/** @brief
We implement this in ha_example.cc; it's a required method.
*/
int open(const char *name, int mode, uint test_if_locked); // required
/** @brief
We implement this in ha_example.cc; it's a required method.
*/
int close(void); // required
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int write_row(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int update_row(const uchar *old_data, uchar *new_data);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int delete_row(const uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_next(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_prev(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_first(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_last(uchar *buf);
/** @brief
Unlike index_init(), rnd_init() can be called two consecutive times
without rnd_end() in between (it only makes sense if scan=1). In this
case, the second call should prepare for the new table scan (e.g if
rnd_init() allocates the cursor, the second call should position the
cursor to the start of the table; no need to deallocate and allocate
it again. This is a required method.
*/
int rnd_init(bool scan); //required
int rnd_end();
int rnd_next(uchar *buf); ///< required
int rnd_pos(uchar *buf, uchar *pos); ///< required
void position(const uchar *record); ///< required
int info(uint); ///< required
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type); ///< required
int delete_all_rows(void);
ha_rows records_in_range(uint inx, key_range *min_key,
key_range *max_key);
int delete_table(const char *from);
int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info); ///< required
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type); ///< required
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment