1 // This autogenerated skeleton file illustrates how to build a server.
2 // You should copy it to another filename to avoid overwriting it.
3 
4 #include "Cassandra.h"
5 #include <protocol/TBinaryProtocol.h>
6 #include <server/TSimpleServer.h>
7 #include <transport/TServerSocket.h>
8 #include <transport/TBufferTransports.h>
9 
10 using namespace ::apache::thrift;
11 using namespace ::apache::thrift::protocol;
12 using namespace ::apache::thrift::transport;
13 using namespace ::apache::thrift::server;
14 
15 using boost::shared_ptr;
16 
17 using namespace  ::org::apache::cassandra;
18 
19 class CassandraHandler : virtual public CassandraIf {
20  public:
CassandraHandler()21   CassandraHandler() {
22     // Your initialization goes here
23   }
24 
login(const AuthenticationRequest & auth_request)25   void login(const AuthenticationRequest& auth_request) {
26     // Your implementation goes here
27     printf("login\n");
28   }
29 
set_keyspace(const std::string & keyspace)30   void set_keyspace(const std::string& keyspace) {
31     // Your implementation goes here
32     printf("set_keyspace\n");
33   }
34 
get(ColumnOrSuperColumn & _return,const std::string & key,const ColumnPath & column_path,const ConsistencyLevel::type consistency_level)35   void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) {
36     // Your implementation goes here
37     printf("get\n");
38   }
39 
get_slice(std::vector<ColumnOrSuperColumn> & _return,const std::string & key,const ColumnParent & column_parent,const SlicePredicate & predicate,const ConsistencyLevel::type consistency_level)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");
43   }
44 
get_count(const std::string & key,const ColumnParent & column_parent,const SlicePredicate & predicate,const ConsistencyLevel::type consistency_level)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");
48   }
49 
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)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");
53   }
54 
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)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");
58   }
59 
get_range_slices(std::vector<KeySlice> & _return,const ColumnParent & column_parent,const SlicePredicate & predicate,const KeyRange & range,const ConsistencyLevel::type consistency_level)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");
63   }
64 
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)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");
68   }
69 
get_indexed_slices(std::vector<KeySlice> & _return,const ColumnParent & column_parent,const IndexClause & index_clause,const SlicePredicate & column_predicate,const ConsistencyLevel::type consistency_level)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");
73   }
74 
insert(const std::string & key,const ColumnParent & column_parent,const Column & column,const ConsistencyLevel::type consistency_level)75   void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) {
76     // Your implementation goes here
77     printf("insert\n");
78   }
79 
add(const std::string & key,const ColumnParent & column_parent,const CounterColumn & column,const ConsistencyLevel::type consistency_level)80   void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) {
81     // Your implementation goes here
82     printf("add\n");
83   }
84 
remove(const std::string & key,const ColumnPath & column_path,const int64_t timestamp,const ConsistencyLevel::type consistency_level)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
87     printf("remove\n");
88   }
89 
remove_counter(const std::string & key,const ColumnPath & path,const ConsistencyLevel::type consistency_level)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");
93   }
94 
batch_mutate(const std::map<std::string,std::map<std::string,std::vector<Mutation>>> & mutation_map,const ConsistencyLevel::type consistency_level)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");
98   }
99 
truncate(const std::string & cfname)100   void truncate(const std::string& cfname) {
101     // Your implementation goes here
102     printf("truncate\n");
103   }
104 
describe_schema_versions(std::map<std::string,std::vector<std::string>> & _return)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");
108   }
109 
describe_keyspaces(std::vector<KsDef> & _return)110   void describe_keyspaces(std::vector<KsDef> & _return) {
111     // Your implementation goes here
112     printf("describe_keyspaces\n");
113   }
114 
describe_cluster_name(std::string & _return)115   void describe_cluster_name(std::string& _return) {
116     // Your implementation goes here
117     printf("describe_cluster_name\n");
118   }
119 
describe_version(std::string & _return)120   void describe_version(std::string& _return) {
121     // Your implementation goes here
122     printf("describe_version\n");
123   }
124 
describe_ring(std::vector<TokenRange> & _return,const std::string & keyspace)125   void describe_ring(std::vector<TokenRange> & _return, const std::string& keyspace) {
126     // Your implementation goes here
127     printf("describe_ring\n");
128   }
129 
describe_token_map(std::map<std::string,std::string> & _return)130   void describe_token_map(std::map<std::string, std::string> & _return) {
131     // Your implementation goes here
132     printf("describe_token_map\n");
133   }
134 
describe_partitioner(std::string & _return)135   void describe_partitioner(std::string& _return) {
136     // Your implementation goes here
137     printf("describe_partitioner\n");
138   }
139 
describe_snitch(std::string & _return)140   void describe_snitch(std::string& _return) {
141     // Your implementation goes here
142     printf("describe_snitch\n");
143   }
144 
describe_keyspace(KsDef & _return,const std::string & keyspace)145   void describe_keyspace(KsDef& _return, const std::string& keyspace) {
146     // Your implementation goes here
147     printf("describe_keyspace\n");
148   }
149 
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)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");
153   }
154 
system_add_column_family(std::string & _return,const CfDef & cf_def)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");
158   }
159 
system_drop_column_family(std::string & _return,const std::string & column_family)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");
163   }
164 
system_add_keyspace(std::string & _return,const KsDef & ks_def)165   void system_add_keyspace(std::string& _return, const KsDef& ks_def) {
166     // Your implementation goes here
167     printf("system_add_keyspace\n");
168   }
169 
system_drop_keyspace(std::string & _return,const std::string & keyspace)170   void system_drop_keyspace(std::string& _return, const std::string& keyspace) {
171     // Your implementation goes here
172     printf("system_drop_keyspace\n");
173   }
174 
system_update_keyspace(std::string & _return,const KsDef & ks_def)175   void system_update_keyspace(std::string& _return, const KsDef& ks_def) {
176     // Your implementation goes here
177     printf("system_update_keyspace\n");
178   }
179 
system_update_column_family(std::string & _return,const CfDef & cf_def)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");
183   }
184 
execute_cql_query(CqlResult & _return,const std::string & query,const Compression::type compression)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");
188   }
189 
prepare_cql_query(CqlPreparedResult & _return,const std::string & query,const Compression::type compression)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");
193   }
194 
execute_prepared_cql_query(CqlResult & _return,const int32_t itemId,const std::vector<std::string> & values)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");
198   }
199 
set_cql_version(const std::string & version)200   void set_cql_version(const std::string& version) {
201     // Your implementation goes here
202     printf("set_cql_version\n");
203   }
204 
205 };
206 
main(int argc,char ** argv)207 int main(int argc, char **argv) {
208   int port = 9090;
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());
214 
215   TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
216   server.serve();
217   return 0;
218 }
219 
220