cassandra 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,4 @@
1
- require 'test/unit'
2
- require "#{File.expand_path(File.dirname(__FILE__))}/../lib/cassandra"
3
-
4
- begin; require 'ruby-debug'; rescue LoadError; end
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
5
2
 
6
3
  class ComparableTypesTest < Test::Unit::TestCase
7
4
  include Cassandra::Constants
@@ -26,14 +23,16 @@ class ComparableTypesTest < Test::Unit::TestCase
26
23
 
27
24
  def test_uuid_sort
28
25
  ary = []
29
- 10.times { ary << UUID.new }
30
- assert_equal ary.sort, ary
26
+ 5.times { ary << UUID.new(Time.at(rand(2**31))) }
27
+ assert_equal ary.map { |_| _.seconds }.sort, ary.sort.map { |_| _.seconds }
28
+ assert_not_equal ary.sort, ary.sort_by {|_| _.to_guid }
31
29
  end
32
30
 
33
31
  def test_uuid_equality
34
32
  uuid = UUID.new
35
33
  assert_equal uuid, UUID.new(uuid.to_s)
36
34
  assert_equal uuid, UUID.new(uuid.to_i)
35
+ assert_equal uuid, UUID.new(uuid.to_guid)
37
36
  end
38
37
 
39
38
  def test_uuid_error
@@ -0,0 +1,14 @@
1
+
2
+ require 'test/unit'
3
+ require "#{File.expand_path(File.dirname(__FILE__))}/../lib/cassandra"
4
+ begin; require 'ruby-debug'; rescue LoadError; end
5
+
6
+ begin
7
+ @test_client = Cassandra.new('Twitter', '127.0.0.1')
8
+ rescue Thrift::TransportException => e
9
+ #FIXME Make server automatically start if not running
10
+ if e.message =~ /Could not connect/
11
+ puts "*** Please start the Cassandra server by running 'rake cassandra'. ***"
12
+ exit 1
13
+ end
14
+ end
@@ -12,30 +12,13 @@ require 'cassandra_types'
12
12
  class Client
13
13
  include ::Thrift::Client
14
14
 
15
- def get_slice_by_names(table, key, column_parent, column_names, consistency_level)
16
- send_get_slice_by_names(table, key, column_parent, column_names, consistency_level)
17
- return recv_get_slice_by_names()
18
- end
19
-
20
- def send_get_slice_by_names(table, key, column_parent, column_names, consistency_level)
21
- send_message('get_slice_by_names', Get_slice_by_names_args, :table => table, :key => key, :column_parent => column_parent, :column_names => column_names, :consistency_level => consistency_level)
22
- end
23
-
24
- def recv_get_slice_by_names()
25
- result = receive_message(Get_slice_by_names_result)
26
- return result.success unless result.success.nil?
27
- raise result.ire unless result.ire.nil?
28
- raise result.nfe unless result.nfe.nil?
29
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_slice_by_names failed: unknown result')
30
- end
31
-
32
- def get_slice(table, key, column_parent, start, finish, is_ascending, count, consistency_level)
33
- send_get_slice(table, key, column_parent, start, finish, is_ascending, count, consistency_level)
15
+ def get_slice(keyspace, key, column_parent, predicate, consistency_level)
16
+ send_get_slice(keyspace, key, column_parent, predicate, consistency_level)
34
17
  return recv_get_slice()
35
18
  end
36
19
 
37
- def send_get_slice(table, key, column_parent, start, finish, is_ascending, count, consistency_level)
38
- send_message('get_slice', Get_slice_args, :table => table, :key => key, :column_parent => column_parent, :start => start, :finish => finish, :is_ascending => is_ascending, :count => count, :consistency_level => consistency_level)
20
+ def send_get_slice(keyspace, key, column_parent, predicate, consistency_level)
21
+ send_message('get_slice', Get_slice_args, :keyspace => keyspace, :key => key, :column_parent => column_parent, :predicate => predicate, :consistency_level => consistency_level)
39
22
  end
40
23
 
41
24
  def recv_get_slice()
@@ -46,46 +29,46 @@ require 'cassandra_types'
46
29
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_slice failed: unknown result')
47
30
  end
48
31
 
49
- def get_column(table, key, column_path, consistency_level)
50
- send_get_column(table, key, column_path, consistency_level)
51
- return recv_get_column()
32
+ def get(keyspace, key, column_path, consistency_level)
33
+ send_get(keyspace, key, column_path, consistency_level)
34
+ return recv_get()
52
35
  end
53
36
 
54
- def send_get_column(table, key, column_path, consistency_level)
55
- send_message('get_column', Get_column_args, :table => table, :key => key, :column_path => column_path, :consistency_level => consistency_level)
37
+ def send_get(keyspace, key, column_path, consistency_level)
38
+ send_message('get', Get_args, :keyspace => keyspace, :key => key, :column_path => column_path, :consistency_level => consistency_level)
56
39
  end
57
40
 
58
- def recv_get_column()
59
- result = receive_message(Get_column_result)
41
+ def recv_get()
42
+ result = receive_message(Get_result)
60
43
  return result.success unless result.success.nil?
61
44
  raise result.ire unless result.ire.nil?
62
45
  raise result.nfe unless result.nfe.nil?
63
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_column failed: unknown result')
46
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get failed: unknown result')
64
47
  end
65
48
 
66
- def get_column_count(table, key, column_parent, consistency_level)
67
- send_get_column_count(table, key, column_parent, consistency_level)
68
- return recv_get_column_count()
49
+ def get_count(keyspace, key, column_parent, consistency_level)
50
+ send_get_count(keyspace, key, column_parent, consistency_level)
51
+ return recv_get_count()
69
52
  end
70
53
 
71
- def send_get_column_count(table, key, column_parent, consistency_level)
72
- send_message('get_column_count', Get_column_count_args, :table => table, :key => key, :column_parent => column_parent, :consistency_level => consistency_level)
54
+ def send_get_count(keyspace, key, column_parent, consistency_level)
55
+ send_message('get_count', Get_count_args, :keyspace => keyspace, :key => key, :column_parent => column_parent, :consistency_level => consistency_level)
73
56
  end
74
57
 
75
- def recv_get_column_count()
76
- result = receive_message(Get_column_count_result)
58
+ def recv_get_count()
59
+ result = receive_message(Get_count_result)
77
60
  return result.success unless result.success.nil?
78
61
  raise result.ire unless result.ire.nil?
79
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_column_count failed: unknown result')
62
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_count failed: unknown result')
80
63
  end
81
64
 
82
- def insert(table, key, column_path, value, timestamp, consistency_level)
83
- send_insert(table, key, column_path, value, timestamp, consistency_level)
65
+ def insert(keyspace, key, column_path, value, timestamp, consistency_level)
66
+ send_insert(keyspace, key, column_path, value, timestamp, consistency_level)
84
67
  recv_insert()
85
68
  end
86
69
 
87
- def send_insert(table, key, column_path, value, timestamp, consistency_level)
88
- send_message('insert', Insert_args, :table => table, :key => key, :column_path => column_path, :value => value, :timestamp => timestamp, :consistency_level => consistency_level)
70
+ def send_insert(keyspace, key, column_path, value, timestamp, consistency_level)
71
+ send_message('insert', Insert_args, :keyspace => keyspace, :key => key, :column_path => column_path, :value => value, :timestamp => timestamp, :consistency_level => consistency_level)
89
72
  end
90
73
 
91
74
  def recv_insert()
@@ -95,13 +78,13 @@ require 'cassandra_types'
95
78
  return
96
79
  end
97
80
 
98
- def batch_insert(table, batch_mutation, consistency_level)
99
- send_batch_insert(table, batch_mutation, consistency_level)
81
+ def batch_insert(keyspace, batch_mutation, consistency_level)
82
+ send_batch_insert(keyspace, batch_mutation, consistency_level)
100
83
  recv_batch_insert()
101
84
  end
102
85
 
103
- def send_batch_insert(table, batch_mutation, consistency_level)
104
- send_message('batch_insert', Batch_insert_args, :table => table, :batch_mutation => batch_mutation, :consistency_level => consistency_level)
86
+ def send_batch_insert(keyspace, batch_mutation, consistency_level)
87
+ send_message('batch_insert', Batch_insert_args, :keyspace => keyspace, :batch_mutation => batch_mutation, :consistency_level => consistency_level)
105
88
  end
106
89
 
107
90
  def recv_batch_insert()
@@ -111,13 +94,13 @@ require 'cassandra_types'
111
94
  return
112
95
  end
113
96
 
114
- def remove(table, key, column_path_or_parent, timestamp, consistency_level)
115
- send_remove(table, key, column_path_or_parent, timestamp, consistency_level)
97
+ def remove(keyspace, key, column_path, timestamp, consistency_level)
98
+ send_remove(keyspace, key, column_path, timestamp, consistency_level)
116
99
  recv_remove()
117
100
  end
118
101
 
119
- def send_remove(table, key, column_path_or_parent, timestamp, consistency_level)
120
- send_message('remove', Remove_args, :table => table, :key => key, :column_path_or_parent => column_path_or_parent, :timestamp => timestamp, :consistency_level => consistency_level)
102
+ def send_remove(keyspace, key, column_path, timestamp, consistency_level)
103
+ send_message('remove', Remove_args, :keyspace => keyspace, :key => key, :column_path => column_path, :timestamp => timestamp, :consistency_level => consistency_level)
121
104
  end
122
105
 
123
106
  def recv_remove()
@@ -127,62 +110,13 @@ require 'cassandra_types'
127
110
  return
128
111
  end
129
112
 
130
- def get_slice_super(table, key, column_family, start, finish, is_ascending, count, consistency_level)
131
- send_get_slice_super(table, key, column_family, start, finish, is_ascending, count, consistency_level)
132
- return recv_get_slice_super()
133
- end
134
-
135
- def send_get_slice_super(table, key, column_family, start, finish, is_ascending, count, consistency_level)
136
- send_message('get_slice_super', Get_slice_super_args, :table => table, :key => key, :column_family => column_family, :start => start, :finish => finish, :is_ascending => is_ascending, :count => count, :consistency_level => consistency_level)
137
- end
138
-
139
- def recv_get_slice_super()
140
- result = receive_message(Get_slice_super_result)
141
- return result.success unless result.success.nil?
142
- raise result.ire unless result.ire.nil?
143
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_slice_super failed: unknown result')
144
- end
145
-
146
- def get_slice_super_by_names(table, key, column_family, super_column_names, consistency_level)
147
- send_get_slice_super_by_names(table, key, column_family, super_column_names, consistency_level)
148
- return recv_get_slice_super_by_names()
149
- end
150
-
151
- def send_get_slice_super_by_names(table, key, column_family, super_column_names, consistency_level)
152
- send_message('get_slice_super_by_names', Get_slice_super_by_names_args, :table => table, :key => key, :column_family => column_family, :super_column_names => super_column_names, :consistency_level => consistency_level)
153
- end
154
-
155
- def recv_get_slice_super_by_names()
156
- result = receive_message(Get_slice_super_by_names_result)
157
- return result.success unless result.success.nil?
158
- raise result.ire unless result.ire.nil?
159
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_slice_super_by_names failed: unknown result')
160
- end
161
-
162
- def get_super_column(table, key, super_column_path, consistency_level)
163
- send_get_super_column(table, key, super_column_path, consistency_level)
164
- return recv_get_super_column()
165
- end
166
-
167
- def send_get_super_column(table, key, super_column_path, consistency_level)
168
- send_message('get_super_column', Get_super_column_args, :table => table, :key => key, :super_column_path => super_column_path, :consistency_level => consistency_level)
169
- end
170
-
171
- def recv_get_super_column()
172
- result = receive_message(Get_super_column_result)
173
- return result.success unless result.success.nil?
174
- raise result.ire unless result.ire.nil?
175
- raise result.nfe unless result.nfe.nil?
176
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_super_column failed: unknown result')
177
- end
178
-
179
- def batch_insert_super_column(table, batch_mutation_super, consistency_level)
180
- send_batch_insert_super_column(table, batch_mutation_super, consistency_level)
113
+ def batch_insert_super_column(keyspace, batch_mutation_super, consistency_level)
114
+ send_batch_insert_super_column(keyspace, batch_mutation_super, consistency_level)
181
115
  recv_batch_insert_super_column()
182
116
  end
183
117
 
184
- def send_batch_insert_super_column(table, batch_mutation_super, consistency_level)
185
- send_message('batch_insert_super_column', Batch_insert_super_column_args, :table => table, :batch_mutation_super => batch_mutation_super, :consistency_level => consistency_level)
118
+ def send_batch_insert_super_column(keyspace, batch_mutation_super, consistency_level)
119
+ send_message('batch_insert_super_column', Batch_insert_super_column_args, :keyspace => keyspace, :batch_mutation_super => batch_mutation_super, :consistency_level => consistency_level)
186
120
  end
187
121
 
188
122
  def recv_batch_insert_super_column()
@@ -192,13 +126,13 @@ require 'cassandra_types'
192
126
  return
193
127
  end
194
128
 
195
- def get_key_range(table, column_family, start, finish, count)
196
- send_get_key_range(table, column_family, start, finish, count)
129
+ def get_key_range(keyspace, column_family, start, finish, count)
130
+ send_get_key_range(keyspace, column_family, start, finish, count)
197
131
  return recv_get_key_range()
198
132
  end
199
133
 
200
- def send_get_key_range(table, column_family, start, finish, count)
201
- send_message('get_key_range', Get_key_range_args, :table => table, :column_family => column_family, :start => start, :finish => finish, :count => count)
134
+ def send_get_key_range(keyspace, column_family, start, finish, count)
135
+ send_message('get_key_range', Get_key_range_args, :keyspace => keyspace, :column_family => column_family, :start => start, :finish => finish, :count => count)
202
136
  end
203
137
 
204
138
  def recv_get_key_range()
@@ -238,20 +172,20 @@ require 'cassandra_types'
238
172
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_string_list_property failed: unknown result')
239
173
  end
240
174
 
241
- def describe_table(table)
242
- send_describe_table(table)
243
- return recv_describe_table()
175
+ def describe_keyspace(keyspace)
176
+ send_describe_keyspace(keyspace)
177
+ return recv_describe_keyspace()
244
178
  end
245
179
 
246
- def send_describe_table(table)
247
- send_message('describe_table', Describe_table_args, :table => table)
180
+ def send_describe_keyspace(keyspace)
181
+ send_message('describe_keyspace', Describe_keyspace_args, :keyspace => keyspace)
248
182
  end
249
183
 
250
- def recv_describe_table()
251
- result = receive_message(Describe_table_result)
184
+ def recv_describe_keyspace()
185
+ result = receive_message(Describe_keyspace_result)
252
186
  return result.success unless result.success.nil?
253
187
  raise result.nfe unless result.nfe.nil?
254
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_table failed: unknown result')
188
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_keyspace failed: unknown result')
255
189
  end
256
190
 
257
191
  def execute_query(query)
@@ -274,24 +208,11 @@ require 'cassandra_types'
274
208
  class Processor
275
209
  include ::Thrift::Processor
276
210
 
277
- def process_get_slice_by_names(seqid, iprot, oprot)
278
- args = read_args(iprot, Get_slice_by_names_args)
279
- result = Get_slice_by_names_result.new()
280
- begin
281
- result.success = @handler.get_slice_by_names(args.table, args.key, args.column_parent, args.column_names, args.consistency_level)
282
- rescue CassandraThrift::InvalidRequestException => ire
283
- result.ire = ire
284
- rescue CassandraThrift::NotFoundException => nfe
285
- result.nfe = nfe
286
- end
287
- write_result(result, oprot, 'get_slice_by_names', seqid)
288
- end
289
-
290
211
  def process_get_slice(seqid, iprot, oprot)
291
212
  args = read_args(iprot, Get_slice_args)
292
213
  result = Get_slice_result.new()
293
214
  begin
294
- result.success = @handler.get_slice(args.table, args.key, args.column_parent, args.start, args.finish, args.is_ascending, args.count, args.consistency_level)
215
+ result.success = @handler.get_slice(args.keyspace, args.key, args.column_parent, args.predicate, args.consistency_level)
295
216
  rescue CassandraThrift::InvalidRequestException => ire
296
217
  result.ire = ire
297
218
  rescue CassandraThrift::NotFoundException => nfe
@@ -300,35 +221,35 @@ require 'cassandra_types'
300
221
  write_result(result, oprot, 'get_slice', seqid)
301
222
  end
302
223
 
303
- def process_get_column(seqid, iprot, oprot)
304
- args = read_args(iprot, Get_column_args)
305
- result = Get_column_result.new()
224
+ def process_get(seqid, iprot, oprot)
225
+ args = read_args(iprot, Get_args)
226
+ result = Get_result.new()
306
227
  begin
307
- result.success = @handler.get_column(args.table, args.key, args.column_path, args.consistency_level)
228
+ result.success = @handler.get(args.keyspace, args.key, args.column_path, args.consistency_level)
308
229
  rescue CassandraThrift::InvalidRequestException => ire
309
230
  result.ire = ire
310
231
  rescue CassandraThrift::NotFoundException => nfe
311
232
  result.nfe = nfe
312
233
  end
313
- write_result(result, oprot, 'get_column', seqid)
234
+ write_result(result, oprot, 'get', seqid)
314
235
  end
315
236
 
316
- def process_get_column_count(seqid, iprot, oprot)
317
- args = read_args(iprot, Get_column_count_args)
318
- result = Get_column_count_result.new()
237
+ def process_get_count(seqid, iprot, oprot)
238
+ args = read_args(iprot, Get_count_args)
239
+ result = Get_count_result.new()
319
240
  begin
320
- result.success = @handler.get_column_count(args.table, args.key, args.column_parent, args.consistency_level)
241
+ result.success = @handler.get_count(args.keyspace, args.key, args.column_parent, args.consistency_level)
321
242
  rescue CassandraThrift::InvalidRequestException => ire
322
243
  result.ire = ire
323
244
  end
324
- write_result(result, oprot, 'get_column_count', seqid)
245
+ write_result(result, oprot, 'get_count', seqid)
325
246
  end
326
247
 
327
248
  def process_insert(seqid, iprot, oprot)
328
249
  args = read_args(iprot, Insert_args)
329
250
  result = Insert_result.new()
330
251
  begin
331
- @handler.insert(args.table, args.key, args.column_path, args.value, args.timestamp, args.consistency_level)
252
+ @handler.insert(args.keyspace, args.key, args.column_path, args.value, args.timestamp, args.consistency_level)
332
253
  rescue CassandraThrift::InvalidRequestException => ire
333
254
  result.ire = ire
334
255
  rescue CassandraThrift::UnavailableException => ue
@@ -341,7 +262,7 @@ require 'cassandra_types'
341
262
  args = read_args(iprot, Batch_insert_args)
342
263
  result = Batch_insert_result.new()
343
264
  begin
344
- @handler.batch_insert(args.table, args.batch_mutation, args.consistency_level)
265
+ @handler.batch_insert(args.keyspace, args.batch_mutation, args.consistency_level)
345
266
  rescue CassandraThrift::InvalidRequestException => ire
346
267
  result.ire = ire
347
268
  rescue CassandraThrift::UnavailableException => ue
@@ -354,7 +275,7 @@ require 'cassandra_types'
354
275
  args = read_args(iprot, Remove_args)
355
276
  result = Remove_result.new()
356
277
  begin
357
- @handler.remove(args.table, args.key, args.column_path_or_parent, args.timestamp, args.consistency_level)
278
+ @handler.remove(args.keyspace, args.key, args.column_path, args.timestamp, args.consistency_level)
358
279
  rescue CassandraThrift::InvalidRequestException => ire
359
280
  result.ire = ire
360
281
  rescue CassandraThrift::UnavailableException => ue
@@ -363,46 +284,11 @@ require 'cassandra_types'
363
284
  write_result(result, oprot, 'remove', seqid)
364
285
  end
365
286
 
366
- def process_get_slice_super(seqid, iprot, oprot)
367
- args = read_args(iprot, Get_slice_super_args)
368
- result = Get_slice_super_result.new()
369
- begin
370
- result.success = @handler.get_slice_super(args.table, args.key, args.column_family, args.start, args.finish, args.is_ascending, args.count, args.consistency_level)
371
- rescue CassandraThrift::InvalidRequestException => ire
372
- result.ire = ire
373
- end
374
- write_result(result, oprot, 'get_slice_super', seqid)
375
- end
376
-
377
- def process_get_slice_super_by_names(seqid, iprot, oprot)
378
- args = read_args(iprot, Get_slice_super_by_names_args)
379
- result = Get_slice_super_by_names_result.new()
380
- begin
381
- result.success = @handler.get_slice_super_by_names(args.table, args.key, args.column_family, args.super_column_names, args.consistency_level)
382
- rescue CassandraThrift::InvalidRequestException => ire
383
- result.ire = ire
384
- end
385
- write_result(result, oprot, 'get_slice_super_by_names', seqid)
386
- end
387
-
388
- def process_get_super_column(seqid, iprot, oprot)
389
- args = read_args(iprot, Get_super_column_args)
390
- result = Get_super_column_result.new()
391
- begin
392
- result.success = @handler.get_super_column(args.table, args.key, args.super_column_path, args.consistency_level)
393
- rescue CassandraThrift::InvalidRequestException => ire
394
- result.ire = ire
395
- rescue CassandraThrift::NotFoundException => nfe
396
- result.nfe = nfe
397
- end
398
- write_result(result, oprot, 'get_super_column', seqid)
399
- end
400
-
401
287
  def process_batch_insert_super_column(seqid, iprot, oprot)
402
288
  args = read_args(iprot, Batch_insert_super_column_args)
403
289
  result = Batch_insert_super_column_result.new()
404
290
  begin
405
- @handler.batch_insert_super_column(args.table, args.batch_mutation_super, args.consistency_level)
291
+ @handler.batch_insert_super_column(args.keyspace, args.batch_mutation_super, args.consistency_level)
406
292
  rescue CassandraThrift::InvalidRequestException => ire
407
293
  result.ire = ire
408
294
  rescue CassandraThrift::UnavailableException => ue
@@ -415,7 +301,7 @@ require 'cassandra_types'
415
301
  args = read_args(iprot, Get_key_range_args)
416
302
  result = Get_key_range_result.new()
417
303
  begin
418
- result.success = @handler.get_key_range(args.table, args.column_family, args.start, args.finish, args.count)
304
+ result.success = @handler.get_key_range(args.keyspace, args.column_family, args.start, args.finish, args.count)
419
305
  rescue CassandraThrift::InvalidRequestException => ire
420
306
  result.ire = ire
421
307
  end
@@ -436,15 +322,15 @@ require 'cassandra_types'
436
322
  write_result(result, oprot, 'get_string_list_property', seqid)
437
323
  end
438
324
 
439
- def process_describe_table(seqid, iprot, oprot)
440
- args = read_args(iprot, Describe_table_args)
441
- result = Describe_table_result.new()
325
+ def process_describe_keyspace(seqid, iprot, oprot)
326
+ args = read_args(iprot, Describe_keyspace_args)
327
+ result = Describe_keyspace_result.new()
442
328
  begin
443
- result.success = @handler.describe_table(args.table)
329
+ result.success = @handler.describe_keyspace(args.keyspace)
444
330
  rescue CassandraThrift::NotFoundException => nfe
445
331
  result.nfe = nfe
446
332
  end
447
- write_result(result, oprot, 'describe_table', seqid)
333
+ write_result(result, oprot, 'describe_keyspace', seqid)
448
334
  end
449
335
 
450
336
  def process_execute_query(seqid, iprot, oprot)
@@ -458,73 +344,20 @@ require 'cassandra_types'
458
344
 
459
345
  # HELPER FUNCTIONS AND STRUCTURES
460
346
 
461
- class Get_slice_by_names_args
462
- include ::Thrift::Struct
463
- TABLE = 1
464
- KEY = 2
465
- COLUMN_PARENT = 3
466
- COLUMN_NAMES = 4
467
- CONSISTENCY_LEVEL = 5
468
-
469
- ::Thrift::Struct.field_accessor self, :table, :key, :column_parent, :column_names, :consistency_level
470
- FIELDS = {
471
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
472
- KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
473
- COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
474
- COLUMN_NAMES => {:type => ::Thrift::Types::LIST, :name => 'column_names', :element => {:type => ::Thrift::Types::STRING}},
475
- CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
476
- }
477
-
478
- def struct_fields; FIELDS; end
479
-
480
- def validate
481
- unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
482
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
483
- end
484
- end
485
-
486
- end
487
-
488
- class Get_slice_by_names_result
489
- include ::Thrift::Struct
490
- SUCCESS = 0
491
- IRE = 1
492
- NFE = 2
493
-
494
- ::Thrift::Struct.field_accessor self, :success, :ire, :nfe
495
- FIELDS = {
496
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::Column}},
497
- IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
498
- NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}
499
- }
500
-
501
- def struct_fields; FIELDS; end
502
-
503
- def validate
504
- end
505
-
506
- end
507
-
508
347
  class Get_slice_args
509
348
  include ::Thrift::Struct
510
- TABLE = 1
349
+ KEYSPACE = 1
511
350
  KEY = 2
512
351
  COLUMN_PARENT = 3
513
- START = 4
514
- FINISH = 5
515
- IS_ASCENDING = 6
516
- COUNT = 7
517
- CONSISTENCY_LEVEL = 8
352
+ PREDICATE = 4
353
+ CONSISTENCY_LEVEL = 5
518
354
 
519
- ::Thrift::Struct.field_accessor self, :table, :key, :column_parent, :start, :finish, :is_ascending, :count, :consistency_level
355
+ ::Thrift::Struct.field_accessor self, :keyspace, :key, :column_parent, :predicate, :consistency_level
520
356
  FIELDS = {
521
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
357
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
522
358
  KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
523
359
  COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
524
- START => {:type => ::Thrift::Types::STRING, :name => 'start'},
525
- FINISH => {:type => ::Thrift::Types::STRING, :name => 'finish'},
526
- IS_ASCENDING => {:type => ::Thrift::Types::BOOL, :name => 'is_ascending'},
527
- COUNT => {:type => ::Thrift::Types::I32, :name => 'count', :default => 100},
360
+ PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate},
528
361
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
529
362
  }
530
363
 
@@ -546,7 +379,7 @@ require 'cassandra_types'
546
379
 
547
380
  ::Thrift::Struct.field_accessor self, :success, :ire, :nfe
548
381
  FIELDS = {
549
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::Column}},
382
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::ColumnOrSuperColumn}},
550
383
  IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
551
384
  NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}
552
385
  }
@@ -558,16 +391,16 @@ require 'cassandra_types'
558
391
 
559
392
  end
560
393
 
561
- class Get_column_args
394
+ class Get_args
562
395
  include ::Thrift::Struct
563
- TABLE = 1
396
+ KEYSPACE = 1
564
397
  KEY = 2
565
398
  COLUMN_PATH = 3
566
399
  CONSISTENCY_LEVEL = 4
567
400
 
568
- ::Thrift::Struct.field_accessor self, :table, :key, :column_path, :consistency_level
401
+ ::Thrift::Struct.field_accessor self, :keyspace, :key, :column_path, :consistency_level
569
402
  FIELDS = {
570
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
403
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
571
404
  KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
572
405
  COLUMN_PATH => {:type => ::Thrift::Types::STRUCT, :name => 'column_path', :class => CassandraThrift::ColumnPath},
573
406
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
@@ -583,7 +416,7 @@ require 'cassandra_types'
583
416
 
584
417
  end
585
418
 
586
- class Get_column_result
419
+ class Get_result
587
420
  include ::Thrift::Struct
588
421
  SUCCESS = 0
589
422
  IRE = 1
@@ -591,7 +424,7 @@ require 'cassandra_types'
591
424
 
592
425
  ::Thrift::Struct.field_accessor self, :success, :ire, :nfe
593
426
  FIELDS = {
594
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CassandraThrift::Column},
427
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CassandraThrift::ColumnOrSuperColumn},
595
428
  IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
596
429
  NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}
597
430
  }
@@ -603,16 +436,16 @@ require 'cassandra_types'
603
436
 
604
437
  end
605
438
 
606
- class Get_column_count_args
439
+ class Get_count_args
607
440
  include ::Thrift::Struct
608
- TABLE = 1
441
+ KEYSPACE = 1
609
442
  KEY = 2
610
443
  COLUMN_PARENT = 3
611
444
  CONSISTENCY_LEVEL = 5
612
445
 
613
- ::Thrift::Struct.field_accessor self, :table, :key, :column_parent, :consistency_level
446
+ ::Thrift::Struct.field_accessor self, :keyspace, :key, :column_parent, :consistency_level
614
447
  FIELDS = {
615
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
448
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
616
449
  KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
617
450
  COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
618
451
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
@@ -628,7 +461,7 @@ require 'cassandra_types'
628
461
 
629
462
  end
630
463
 
631
- class Get_column_count_result
464
+ class Get_count_result
632
465
  include ::Thrift::Struct
633
466
  SUCCESS = 0
634
467
  IRE = 1
@@ -648,16 +481,16 @@ require 'cassandra_types'
648
481
 
649
482
  class Insert_args
650
483
  include ::Thrift::Struct
651
- TABLE = 1
484
+ KEYSPACE = 1
652
485
  KEY = 2
653
486
  COLUMN_PATH = 3
654
487
  VALUE = 4
655
488
  TIMESTAMP = 5
656
489
  CONSISTENCY_LEVEL = 6
657
490
 
658
- ::Thrift::Struct.field_accessor self, :table, :key, :column_path, :value, :timestamp, :consistency_level
491
+ ::Thrift::Struct.field_accessor self, :keyspace, :key, :column_path, :value, :timestamp, :consistency_level
659
492
  FIELDS = {
660
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
493
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
661
494
  KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
662
495
  COLUMN_PATH => {:type => ::Thrift::Types::STRUCT, :name => 'column_path', :class => CassandraThrift::ColumnPath},
663
496
  VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'},
@@ -695,13 +528,13 @@ require 'cassandra_types'
695
528
 
696
529
  class Batch_insert_args
697
530
  include ::Thrift::Struct
698
- TABLE = 1
531
+ KEYSPACE = 1
699
532
  BATCH_MUTATION = 2
700
533
  CONSISTENCY_LEVEL = 3
701
534
 
702
- ::Thrift::Struct.field_accessor self, :table, :batch_mutation, :consistency_level
535
+ ::Thrift::Struct.field_accessor self, :keyspace, :batch_mutation, :consistency_level
703
536
  FIELDS = {
704
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
537
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
705
538
  BATCH_MUTATION => {:type => ::Thrift::Types::STRUCT, :name => 'batch_mutation', :class => CassandraThrift::BatchMutation},
706
539
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 0, :enum_class => CassandraThrift::ConsistencyLevel}
707
540
  }
@@ -736,17 +569,17 @@ require 'cassandra_types'
736
569
 
737
570
  class Remove_args
738
571
  include ::Thrift::Struct
739
- TABLE = 1
572
+ KEYSPACE = 1
740
573
  KEY = 2
741
- COLUMN_PATH_OR_PARENT = 3
574
+ COLUMN_PATH = 3
742
575
  TIMESTAMP = 4
743
576
  CONSISTENCY_LEVEL = 5
744
577
 
745
- ::Thrift::Struct.field_accessor self, :table, :key, :column_path_or_parent, :timestamp, :consistency_level
578
+ ::Thrift::Struct.field_accessor self, :keyspace, :key, :column_path, :timestamp, :consistency_level
746
579
  FIELDS = {
747
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
580
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
748
581
  KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
749
- COLUMN_PATH_OR_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_path_or_parent', :class => CassandraThrift::ColumnPathOrParent},
582
+ COLUMN_PATH => {:type => ::Thrift::Types::STRUCT, :name => 'column_path', :class => CassandraThrift::ColumnPath},
750
583
  TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
751
584
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 0, :enum_class => CassandraThrift::ConsistencyLevel}
752
585
  }
@@ -779,156 +612,15 @@ require 'cassandra_types'
779
612
 
780
613
  end
781
614
 
782
- class Get_slice_super_args
783
- include ::Thrift::Struct
784
- TABLE = 1
785
- KEY = 2
786
- COLUMN_FAMILY = 3
787
- START = 4
788
- FINISH = 5
789
- IS_ASCENDING = 6
790
- COUNT = 7
791
- CONSISTENCY_LEVEL = 8
792
-
793
- ::Thrift::Struct.field_accessor self, :table, :key, :column_family, :start, :finish, :is_ascending, :count, :consistency_level
794
- FIELDS = {
795
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
796
- KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
797
- COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
798
- START => {:type => ::Thrift::Types::STRING, :name => 'start'},
799
- FINISH => {:type => ::Thrift::Types::STRING, :name => 'finish'},
800
- IS_ASCENDING => {:type => ::Thrift::Types::BOOL, :name => 'is_ascending'},
801
- COUNT => {:type => ::Thrift::Types::I32, :name => 'count', :default => 100},
802
- CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
803
- }
804
-
805
- def struct_fields; FIELDS; end
806
-
807
- def validate
808
- unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
809
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
810
- end
811
- end
812
-
813
- end
814
-
815
- class Get_slice_super_result
816
- include ::Thrift::Struct
817
- SUCCESS = 0
818
- IRE = 1
819
-
820
- ::Thrift::Struct.field_accessor self, :success, :ire
821
- FIELDS = {
822
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::SuperColumn}},
823
- IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}
824
- }
825
-
826
- def struct_fields; FIELDS; end
827
-
828
- def validate
829
- end
830
-
831
- end
832
-
833
- class Get_slice_super_by_names_args
834
- include ::Thrift::Struct
835
- TABLE = 1
836
- KEY = 2
837
- COLUMN_FAMILY = 3
838
- SUPER_COLUMN_NAMES = 4
839
- CONSISTENCY_LEVEL = 5
840
-
841
- ::Thrift::Struct.field_accessor self, :table, :key, :column_family, :super_column_names, :consistency_level
842
- FIELDS = {
843
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
844
- KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
845
- COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
846
- SUPER_COLUMN_NAMES => {:type => ::Thrift::Types::LIST, :name => 'super_column_names', :element => {:type => ::Thrift::Types::STRING}},
847
- CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
848
- }
849
-
850
- def struct_fields; FIELDS; end
851
-
852
- def validate
853
- unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
854
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
855
- end
856
- end
857
-
858
- end
859
-
860
- class Get_slice_super_by_names_result
861
- include ::Thrift::Struct
862
- SUCCESS = 0
863
- IRE = 1
864
-
865
- ::Thrift::Struct.field_accessor self, :success, :ire
866
- FIELDS = {
867
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::SuperColumn}},
868
- IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}
869
- }
870
-
871
- def struct_fields; FIELDS; end
872
-
873
- def validate
874
- end
875
-
876
- end
877
-
878
- class Get_super_column_args
879
- include ::Thrift::Struct
880
- TABLE = 1
881
- KEY = 2
882
- SUPER_COLUMN_PATH = 3
883
- CONSISTENCY_LEVEL = 4
884
-
885
- ::Thrift::Struct.field_accessor self, :table, :key, :super_column_path, :consistency_level
886
- FIELDS = {
887
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
888
- KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
889
- SUPER_COLUMN_PATH => {:type => ::Thrift::Types::STRUCT, :name => 'super_column_path', :class => CassandraThrift::SuperColumnPath},
890
- CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
891
- }
892
-
893
- def struct_fields; FIELDS; end
894
-
895
- def validate
896
- unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
897
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
898
- end
899
- end
900
-
901
- end
902
-
903
- class Get_super_column_result
904
- include ::Thrift::Struct
905
- SUCCESS = 0
906
- IRE = 1
907
- NFE = 2
908
-
909
- ::Thrift::Struct.field_accessor self, :success, :ire, :nfe
910
- FIELDS = {
911
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CassandraThrift::SuperColumn},
912
- IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
913
- NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}
914
- }
915
-
916
- def struct_fields; FIELDS; end
917
-
918
- def validate
919
- end
920
-
921
- end
922
-
923
615
  class Batch_insert_super_column_args
924
616
  include ::Thrift::Struct
925
- TABLE = 1
617
+ KEYSPACE = 1
926
618
  BATCH_MUTATION_SUPER = 2
927
619
  CONSISTENCY_LEVEL = 3
928
620
 
929
- ::Thrift::Struct.field_accessor self, :table, :batch_mutation_super, :consistency_level
621
+ ::Thrift::Struct.field_accessor self, :keyspace, :batch_mutation_super, :consistency_level
930
622
  FIELDS = {
931
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
623
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
932
624
  BATCH_MUTATION_SUPER => {:type => ::Thrift::Types::STRUCT, :name => 'batch_mutation_super', :class => CassandraThrift::BatchMutationSuper},
933
625
  CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 0, :enum_class => CassandraThrift::ConsistencyLevel}
934
626
  }
@@ -963,15 +655,15 @@ require 'cassandra_types'
963
655
 
964
656
  class Get_key_range_args
965
657
  include ::Thrift::Struct
966
- TABLE = 1
658
+ KEYSPACE = 1
967
659
  COLUMN_FAMILY = 2
968
660
  START = 3
969
661
  FINISH = 4
970
662
  COUNT = 5
971
663
 
972
- ::Thrift::Struct.field_accessor self, :table, :column_family, :start, :finish, :count
664
+ ::Thrift::Struct.field_accessor self, :keyspace, :column_family, :start, :finish, :count
973
665
  FIELDS = {
974
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
666
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
975
667
  COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
976
668
  START => {:type => ::Thrift::Types::STRING, :name => 'start', :default => %q""},
977
669
  FINISH => {:type => ::Thrift::Types::STRING, :name => 'finish', :default => %q""},
@@ -1067,13 +759,13 @@ require 'cassandra_types'
1067
759
 
1068
760
  end
1069
761
 
1070
- class Describe_table_args
762
+ class Describe_keyspace_args
1071
763
  include ::Thrift::Struct
1072
- TABLE = 1
764
+ KEYSPACE = 1
1073
765
 
1074
- ::Thrift::Struct.field_accessor self, :table
766
+ ::Thrift::Struct.field_accessor self, :keyspace
1075
767
  FIELDS = {
1076
- TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'}
768
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'}
1077
769
  }
1078
770
 
1079
771
  def struct_fields; FIELDS; end
@@ -1083,7 +775,7 @@ require 'cassandra_types'
1083
775
 
1084
776
  end
1085
777
 
1086
- class Describe_table_result
778
+ class Describe_keyspace_result
1087
779
  include ::Thrift::Struct
1088
780
  SUCCESS = 0
1089
781
  NFE = 1