1
// This autogenerated skeleton file illustrates how to build a server.
2
// You should copy it to another filename to avoid overwriting it.
5
#include <thrift/protocol/TBinaryProtocol.h>
6
#include <thrift/server/TSimpleServer.h>
7
#include <thrift/transport/TServerSocket.h>
8
#include <thrift/transport/TBufferTransports.h>
10
using namespace ::apache::thrift;
11
using namespace ::apache::thrift::protocol;
12
using namespace ::apache::thrift::transport;
13
using namespace ::apache::thrift::server;
15
using boost::shared_ptr;
17
using namespace ::org::apache::cassandra;
19
class CassandraHandler : virtual public CassandraIf {
22
// Your initialization goes here
25
void login(const AuthenticationRequest& auth_request) {
26
// Your implementation goes here
30
void set_keyspace(const std::string& keyspace) {
31
// Your implementation goes here
32
printf("set_keyspace\n");
35
void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) {
36
// Your implementation goes here
40
void get_slice(std::vector<ColumnOrSuperColumn> & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
41
// Your implementation goes here
42
printf("get_slice\n");
45
int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) {
46
// Your implementation goes here
47
printf("get_count\n");
50
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) {
51
// Your implementation goes here
52
printf("multiget_slice\n");
55
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) {
56
// Your implementation goes here
57
printf("multiget_count\n");
60
void get_range_slices(std::vector<KeySlice> & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) {
61
// Your implementation goes here
62
printf("get_range_slices\n");
65
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) {
66
// Your implementation goes here
67
printf("get_paged_slice\n");
70
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) {
71
// Your implementation goes here
72
printf("get_indexed_slices\n");
75
void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) {
76
// Your implementation goes here
80
void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) {
81
// Your implementation goes here
85
void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) {
86
// Your implementation goes here
90
void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) {
91
// Your implementation goes here
92
printf("remove_counter\n");
95
void batch_mutate(const std::map<std::string, std::map<std::string, std::vector<Mutation> > > & mutation_map, const ConsistencyLevel::type consistency_level) {
96
// Your implementation goes here
97
printf("batch_mutate\n");
100
void truncate(const std::string& cfname) {
101
// Your implementation goes here
102
printf("truncate\n");
105
void describe_schema_versions(std::map<std::string, std::vector<std::string> > & _return) {
106
// Your implementation goes here
107
printf("describe_schema_versions\n");
110
void describe_keyspaces(std::vector<KsDef> & _return) {
111
// Your implementation goes here
112
printf("describe_keyspaces\n");
115
void describe_cluster_name(std::string& _return) {
116
// Your implementation goes here
117
printf("describe_cluster_name\n");
120
void describe_version(std::string& _return) {
121
// Your implementation goes here
122
printf("describe_version\n");
125
void describe_ring(std::vector<TokenRange> & _return, const std::string& keyspace) {
126
// Your implementation goes here
127
printf("describe_ring\n");
130
void describe_token_map(std::map<std::string, std::string> & _return) {
131
// Your implementation goes here
132
printf("describe_token_map\n");
135
void describe_partitioner(std::string& _return) {
136
// Your implementation goes here
137
printf("describe_partitioner\n");
140
void describe_snitch(std::string& _return) {
141
// Your implementation goes here
142
printf("describe_snitch\n");
145
void describe_keyspace(KsDef& _return, const std::string& keyspace) {
146
// Your implementation goes here
147
printf("describe_keyspace\n");
150
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) {
151
// Your implementation goes here
152
printf("describe_splits\n");
155
void system_add_column_family(std::string& _return, const CfDef& cf_def) {
156
// Your implementation goes here
157
printf("system_add_column_family\n");
160
void system_drop_column_family(std::string& _return, const std::string& column_family) {
161
// Your implementation goes here
162
printf("system_drop_column_family\n");
165
void system_add_keyspace(std::string& _return, const KsDef& ks_def) {
166
// Your implementation goes here
167
printf("system_add_keyspace\n");
170
void system_drop_keyspace(std::string& _return, const std::string& keyspace) {
171
// Your implementation goes here
172
printf("system_drop_keyspace\n");
175
void system_update_keyspace(std::string& _return, const KsDef& ks_def) {
176
// Your implementation goes here
177
printf("system_update_keyspace\n");
180
void system_update_column_family(std::string& _return, const CfDef& cf_def) {
181
// Your implementation goes here
182
printf("system_update_column_family\n");
185
void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) {
186
// Your implementation goes here
187
printf("execute_cql_query\n");
190
void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) {
191
// Your implementation goes here
192
printf("prepare_cql_query\n");
195
void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector<std::string> & values) {
196
// Your implementation goes here
197
printf("execute_prepared_cql_query\n");
200
void set_cql_version(const std::string& version) {
201
// Your implementation goes here
202
printf("set_cql_version\n");
207
int main(int argc, char **argv) {
209
shared_ptr<CassandraHandler> handler(new CassandraHandler());
210
shared_ptr<TProcessor> processor(new CassandraProcessor(handler));
211
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
212
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
213
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
215
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);