cassandra-cql 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +203 -0
  4. data/README.rdoc +78 -0
  5. data/Rakefile +150 -0
  6. data/cassandra-cql.gemspec +29 -0
  7. data/lib/cassandra-cql.rb +39 -0
  8. data/lib/cassandra-cql/database.rb +107 -0
  9. data/lib/cassandra-cql/result.rb +133 -0
  10. data/lib/cassandra-cql/row.rb +59 -0
  11. data/lib/cassandra-cql/schema.rb +108 -0
  12. data/lib/cassandra-cql/statement.rb +111 -0
  13. data/lib/cassandra-cql/types/abstract_type.rb +47 -0
  14. data/lib/cassandra-cql/types/ascii_type.rb +25 -0
  15. data/lib/cassandra-cql/types/boolean_type.rb +25 -0
  16. data/lib/cassandra-cql/types/bytes_type.rb +21 -0
  17. data/lib/cassandra-cql/types/decimal_type.rb +25 -0
  18. data/lib/cassandra-cql/types/double_type.rb +25 -0
  19. data/lib/cassandra-cql/types/float_type.rb +25 -0
  20. data/lib/cassandra-cql/types/integer_type.rb +27 -0
  21. data/lib/cassandra-cql/types/long_type.rb +27 -0
  22. data/lib/cassandra-cql/types/utf8_type.rb +25 -0
  23. data/lib/cassandra-cql/types/uuid_type.rb +27 -0
  24. data/lib/cassandra-cql/utility.rb +37 -0
  25. data/lib/cassandra-cql/uuid.rb +21 -0
  26. data/lib/cassandra-cql/version.rb +19 -0
  27. data/spec/column_family_spec.rb +105 -0
  28. data/spec/comparator_spec.rb +225 -0
  29. data/spec/conf/0.8/cassandra.in.sh +41 -0
  30. data/spec/conf/0.8/cassandra.yaml +61 -0
  31. data/spec/conf/0.8/log4j-server.properties +40 -0
  32. data/spec/conf/0.8/schema.txt +10 -0
  33. data/spec/conf/1.0/cassandra.in.sh +41 -0
  34. data/spec/conf/1.0/cassandra.yaml +416 -0
  35. data/spec/conf/1.0/log4j-server.properties +40 -0
  36. data/spec/conf/1.0/schema.txt +10 -0
  37. data/spec/result_spec.rb +173 -0
  38. data/spec/row_spec.rb +55 -0
  39. data/spec/rowkey_spec.rb +223 -0
  40. data/spec/schema_spec.rb +51 -0
  41. data/spec/spec_helper.rb +23 -0
  42. data/spec/statement_spec.rb +224 -0
  43. data/spec/utility_spec.rb +26 -0
  44. data/spec/uuid_spec.rb +26 -0
  45. data/spec/validation_spec.rb +250 -0
  46. data/vendor/gen-rb/cassandra.rb +2212 -0
  47. data/vendor/gen-rb/cassandra_constants.rb +10 -0
  48. data/vendor/gen-rb/cassandra_types.rb +854 -0
  49. metadata +171 -0
@@ -0,0 +1,10 @@
1
+ # These were auto-generated by thrift and then modified to prevent namespace collision
2
+ # with other projects using the same bindings
3
+
4
+ require File.join(File.dirname(__FILE__), 'cassandra_types')
5
+
6
+ module CassandraCQL
7
+ module Thrift
8
+ VERSION = %q"19.17.0"
9
+ end
10
+ end
@@ -0,0 +1,854 @@
1
+ # These were auto-generated by thrift and then modified to prevent namespace collision
2
+ # with other projects using the same bindings
3
+
4
+ module CassandraCQL
5
+ module Thrift
6
+ module ConsistencyLevel
7
+ ONE = 1
8
+ QUORUM = 2
9
+ LOCAL_QUORUM = 3
10
+ EACH_QUORUM = 4
11
+ ALL = 5
12
+ ANY = 6
13
+ TWO = 7
14
+ THREE = 8
15
+ VALUE_MAP = {1 => "ONE", 2 => "QUORUM", 3 => "LOCAL_QUORUM", 4 => "EACH_QUORUM", 5 => "ALL", 6 => "ANY", 7 => "TWO", 8 => "THREE"}
16
+ VALID_VALUES = Set.new([ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL, ANY, TWO, THREE]).freeze
17
+ end
18
+
19
+ module IndexOperator
20
+ EQ = 0
21
+ GTE = 1
22
+ GT = 2
23
+ LTE = 3
24
+ LT = 4
25
+ VALUE_MAP = {0 => "EQ", 1 => "GTE", 2 => "GT", 3 => "LTE", 4 => "LT"}
26
+ VALID_VALUES = Set.new([EQ, GTE, GT, LTE, LT]).freeze
27
+ end
28
+
29
+ module IndexType
30
+ KEYS = 0
31
+ CUSTOM = 1
32
+ VALUE_MAP = {0 => "KEYS", 1 => "CUSTOM"}
33
+ VALID_VALUES = Set.new([KEYS, CUSTOM]).freeze
34
+ end
35
+
36
+ module Compression
37
+ GZIP = 1
38
+ NONE = 2
39
+ VALUE_MAP = {1 => "GZIP", 2 => "NONE"}
40
+ VALID_VALUES = Set.new([GZIP, NONE]).freeze
41
+ end
42
+
43
+ module CqlResultType
44
+ ROWS = 1
45
+ VOID = 2
46
+ INT = 3
47
+ VALUE_MAP = {1 => "ROWS", 2 => "VOID", 3 => "INT"}
48
+ VALID_VALUES = Set.new([ROWS, VOID, INT]).freeze
49
+ end
50
+
51
+ # Basic unit of data within a ColumnFamily.
52
+ # @param name, the name by which this column is set and retrieved. Maximum 64KB long.
53
+ # @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it).
54
+ # @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared.
55
+ # @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted.
56
+ class Column
57
+ include ::Thrift::Struct, ::Thrift::Struct_Union
58
+ NAME = 1
59
+ VALUE = 2
60
+ TIMESTAMP = 3
61
+ TTL = 4
62
+
63
+ FIELDS = {
64
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
65
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true, :optional => true},
66
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
67
+ TTL => {:type => ::Thrift::Types::I32, :name => 'ttl', :optional => true}
68
+ }
69
+
70
+ def struct_fields; FIELDS; end
71
+
72
+ def validate
73
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
74
+ end
75
+
76
+ ::Thrift::Struct.generate_accessors self
77
+ end
78
+
79
+ # A named list of columns.
80
+ # @param name. see Column.name.
81
+ # @param columns. A collection of standard Columns. The columns within a super column are defined in an adhoc manner.
82
+ # Columns within a super column do not have to have matching structures (similarly named child columns).
83
+ class SuperColumn
84
+ include ::Thrift::Struct, ::Thrift::Struct_Union
85
+ NAME = 1
86
+ COLUMNS = 2
87
+
88
+ FIELDS = {
89
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
90
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::Column}}
91
+ }
92
+
93
+ def struct_fields; FIELDS; end
94
+
95
+ def validate
96
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
97
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field columns is unset!') unless @columns
98
+ end
99
+
100
+ ::Thrift::Struct.generate_accessors self
101
+ end
102
+
103
+ class CounterColumn
104
+ include ::Thrift::Struct, ::Thrift::Struct_Union
105
+ NAME = 1
106
+ VALUE = 2
107
+
108
+ FIELDS = {
109
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
110
+ VALUE => {:type => ::Thrift::Types::I64, :name => 'value'}
111
+ }
112
+
113
+ def struct_fields; FIELDS; end
114
+
115
+ def validate
116
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
117
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value is unset!') unless @value
118
+ end
119
+
120
+ ::Thrift::Struct.generate_accessors self
121
+ end
122
+
123
+ class CounterSuperColumn
124
+ include ::Thrift::Struct, ::Thrift::Struct_Union
125
+ NAME = 1
126
+ COLUMNS = 2
127
+
128
+ FIELDS = {
129
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
130
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::CounterColumn}}
131
+ }
132
+
133
+ def struct_fields; FIELDS; end
134
+
135
+ def validate
136
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
137
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field columns is unset!') unless @columns
138
+ end
139
+
140
+ ::Thrift::Struct.generate_accessors self
141
+ end
142
+
143
+ # Methods for fetching rows/records from Cassandra will return either a single instance of ColumnOrSuperColumn or a list
144
+ # of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn (or list of SuperColumns) then the resulting
145
+ # instances of ColumnOrSuperColumn will have the requested SuperColumn in the attribute super_column. For queries resulting
146
+ # in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize on
147
+ # single query methods that may return either a SuperColumn or Column.
148
+ #
149
+ # If the query was on a counter column family, you will either get a counter_column (instead of a column) or a
150
+ # counter_super_column (instead of a super_column)
151
+ #
152
+ # @param column. The Column returned by get() or get_slice().
153
+ # @param super_column. The SuperColumn returned by get() or get_slice().
154
+ # @param counter_column. The Counterolumn returned by get() or get_slice().
155
+ # @param counter_super_column. The CounterSuperColumn returned by get() or get_slice().
156
+ class ColumnOrSuperColumn
157
+ include ::Thrift::Struct, ::Thrift::Struct_Union
158
+ COLUMN = 1
159
+ SUPER_COLUMN = 2
160
+ COUNTER_COLUMN = 3
161
+ COUNTER_SUPER_COLUMN = 4
162
+
163
+ FIELDS = {
164
+ COLUMN => {:type => ::Thrift::Types::STRUCT, :name => 'column', :class => CassandraCQL::Thrift::Column, :optional => true},
165
+ SUPER_COLUMN => {:type => ::Thrift::Types::STRUCT, :name => 'super_column', :class => CassandraCQL::Thrift::SuperColumn, :optional => true},
166
+ COUNTER_COLUMN => {:type => ::Thrift::Types::STRUCT, :name => 'counter_column', :class => CassandraCQL::Thrift::CounterColumn, :optional => true},
167
+ COUNTER_SUPER_COLUMN => {:type => ::Thrift::Types::STRUCT, :name => 'counter_super_column', :class => CassandraCQL::Thrift::CounterSuperColumn, :optional => true}
168
+ }
169
+
170
+ def struct_fields; FIELDS; end
171
+
172
+ def validate
173
+ end
174
+
175
+ ::Thrift::Struct.generate_accessors self
176
+ end
177
+
178
+ # A specific column was requested that does not exist.
179
+ class NotFoundException < ::Thrift::Exception
180
+ include ::Thrift::Struct, ::Thrift::Struct_Union
181
+
182
+ FIELDS = {
183
+
184
+ }
185
+
186
+ def struct_fields; FIELDS; end
187
+
188
+ def validate
189
+ end
190
+
191
+ ::Thrift::Struct.generate_accessors self
192
+ end
193
+
194
+ # Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a parameter is malformed.
195
+ # why contains an associated error message.
196
+ class InvalidRequestException < ::Thrift::Exception
197
+ include ::Thrift::Struct, ::Thrift::Struct_Union
198
+ def initialize(message=nil)
199
+ super()
200
+ self.why = message
201
+ end
202
+
203
+ def message; why end
204
+
205
+ WHY = 1
206
+
207
+ FIELDS = {
208
+ WHY => {:type => ::Thrift::Types::STRING, :name => 'why'}
209
+ }
210
+
211
+ def struct_fields; FIELDS; end
212
+
213
+ def validate
214
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field why is unset!') unless @why
215
+ end
216
+
217
+ ::Thrift::Struct.generate_accessors self
218
+ end
219
+
220
+ # Not all the replicas required could be created and/or read.
221
+ class UnavailableException < ::Thrift::Exception
222
+ include ::Thrift::Struct, ::Thrift::Struct_Union
223
+
224
+ FIELDS = {
225
+
226
+ }
227
+
228
+ def struct_fields; FIELDS; end
229
+
230
+ def validate
231
+ end
232
+
233
+ ::Thrift::Struct.generate_accessors self
234
+ end
235
+
236
+ # RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too large.
237
+ class TimedOutException < ::Thrift::Exception
238
+ include ::Thrift::Struct, ::Thrift::Struct_Union
239
+
240
+ FIELDS = {
241
+
242
+ }
243
+
244
+ def struct_fields; FIELDS; end
245
+
246
+ def validate
247
+ end
248
+
249
+ ::Thrift::Struct.generate_accessors self
250
+ end
251
+
252
+ # invalid authentication request (invalid keyspace, user does not exist, or credentials invalid)
253
+ class AuthenticationException < ::Thrift::Exception
254
+ include ::Thrift::Struct, ::Thrift::Struct_Union
255
+ def initialize(message=nil)
256
+ super()
257
+ self.why = message
258
+ end
259
+
260
+ def message; why end
261
+
262
+ WHY = 1
263
+
264
+ FIELDS = {
265
+ WHY => {:type => ::Thrift::Types::STRING, :name => 'why'}
266
+ }
267
+
268
+ def struct_fields; FIELDS; end
269
+
270
+ def validate
271
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field why is unset!') unless @why
272
+ end
273
+
274
+ ::Thrift::Struct.generate_accessors self
275
+ end
276
+
277
+ # invalid authorization request (user does not have access to keyspace)
278
+ class AuthorizationException < ::Thrift::Exception
279
+ include ::Thrift::Struct, ::Thrift::Struct_Union
280
+ def initialize(message=nil)
281
+ super()
282
+ self.why = message
283
+ end
284
+
285
+ def message; why end
286
+
287
+ WHY = 1
288
+
289
+ FIELDS = {
290
+ WHY => {:type => ::Thrift::Types::STRING, :name => 'why'}
291
+ }
292
+
293
+ def struct_fields; FIELDS; end
294
+
295
+ def validate
296
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field why is unset!') unless @why
297
+ end
298
+
299
+ ::Thrift::Struct.generate_accessors self
300
+ end
301
+
302
+ # schemas are not in agreement across all nodes
303
+ class SchemaDisagreementException < ::Thrift::Exception
304
+ include ::Thrift::Struct, ::Thrift::Struct_Union
305
+
306
+ FIELDS = {
307
+
308
+ }
309
+
310
+ def struct_fields; FIELDS; end
311
+
312
+ def validate
313
+ end
314
+
315
+ ::Thrift::Struct.generate_accessors self
316
+ end
317
+
318
+ # ColumnParent is used when selecting groups of columns from the same ColumnFamily. In directory structure terms, imagine
319
+ # ColumnParent as ColumnPath + '/../'.
320
+ #
321
+ # See also <a href="cassandra.html#Struct_ColumnPath">ColumnPath</a>
322
+ class ColumnParent
323
+ include ::Thrift::Struct, ::Thrift::Struct_Union
324
+ COLUMN_FAMILY = 3
325
+ SUPER_COLUMN = 4
326
+
327
+ FIELDS = {
328
+ COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
329
+ SUPER_COLUMN => {:type => ::Thrift::Types::STRING, :name => 'super_column', :binary => true, :optional => true}
330
+ }
331
+
332
+ def struct_fields; FIELDS; end
333
+
334
+ def validate
335
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_family is unset!') unless @column_family
336
+ end
337
+
338
+ ::Thrift::Struct.generate_accessors self
339
+ end
340
+
341
+ # The ColumnPath is the path to a single column in Cassandra. It might make sense to think of ColumnPath and
342
+ # ColumnParent in terms of a directory structure.
343
+ #
344
+ # ColumnPath is used to looking up a single column.
345
+ #
346
+ # @param column_family. The name of the CF of the column being looked up.
347
+ # @param super_column. The super column name.
348
+ # @param column. The column name.
349
+ class ColumnPath
350
+ include ::Thrift::Struct, ::Thrift::Struct_Union
351
+ COLUMN_FAMILY = 3
352
+ SUPER_COLUMN = 4
353
+ COLUMN = 5
354
+
355
+ FIELDS = {
356
+ COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
357
+ SUPER_COLUMN => {:type => ::Thrift::Types::STRING, :name => 'super_column', :binary => true, :optional => true},
358
+ COLUMN => {:type => ::Thrift::Types::STRING, :name => 'column', :binary => true, :optional => true}
359
+ }
360
+
361
+ def struct_fields; FIELDS; end
362
+
363
+ def validate
364
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_family is unset!') unless @column_family
365
+ end
366
+
367
+ ::Thrift::Struct.generate_accessors self
368
+ end
369
+
370
+ # A slice range is a structure that stores basic range, ordering and limit information for a query that will return
371
+ # multiple columns. It could be thought of as Cassandra's version of LIMIT and ORDER BY
372
+ #
373
+ # @param start. The column name to start the slice with. This attribute is not required, though there is no default value,
374
+ # and can be safely set to '', i.e., an empty byte array, to start with the first column name. Otherwise, it
375
+ # must a valid value under the rules of the Comparator defined for the given ColumnFamily.
376
+ # @param finish. The column name to stop the slice at. This attribute is not required, though there is no default value,
377
+ # and can be safely set to an empty byte array to not stop until 'count' results are seen. Otherwise, it
378
+ # must also be a valid value to the ColumnFamily Comparator.
379
+ # @param reversed. Whether the results should be ordered in reversed order. Similar to ORDER BY blah DESC in SQL.
380
+ # @param count. How many columns to return. Similar to LIMIT in SQL. May be arbitrarily large, but Thrift will
381
+ # materialize the whole result into memory before returning it to the client, so be aware that you may
382
+ # be better served by iterating through slices by passing the last value of one call in as the 'start'
383
+ # of the next instead of increasing 'count' arbitrarily large.
384
+ class SliceRange
385
+ include ::Thrift::Struct, ::Thrift::Struct_Union
386
+ START = 1
387
+ FINISH = 2
388
+ REVERSED = 3
389
+ COUNT = 4
390
+
391
+ FIELDS = {
392
+ START => {:type => ::Thrift::Types::STRING, :name => 'start', :binary => true},
393
+ FINISH => {:type => ::Thrift::Types::STRING, :name => 'finish', :binary => true},
394
+ REVERSED => {:type => ::Thrift::Types::BOOL, :name => 'reversed', :default => false},
395
+ COUNT => {:type => ::Thrift::Types::I32, :name => 'count', :default => 100}
396
+ }
397
+
398
+ def struct_fields; FIELDS; end
399
+
400
+ def validate
401
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start is unset!') unless @start
402
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field finish is unset!') unless @finish
403
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reversed is unset!') if @reversed.nil?
404
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field count is unset!') unless @count
405
+ end
406
+
407
+ ::Thrift::Struct.generate_accessors self
408
+ end
409
+
410
+ # A SlicePredicate is similar to a mathematic predicate (see http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)),
411
+ # which is described as "a property that the elements of a set have in common."
412
+ #
413
+ # SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange. If column_names is
414
+ # specified, slice_range is ignored.
415
+ #
416
+ # @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature
417
+ # to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack',
418
+ # and 'Jim' you can pass those column names as a list to fetch all three at once.
419
+ # @param slice_range. A SliceRange describing how to range, order, and/or limit the slice.
420
+ class SlicePredicate
421
+ include ::Thrift::Struct, ::Thrift::Struct_Union
422
+ COLUMN_NAMES = 1
423
+ SLICE_RANGE = 2
424
+
425
+ FIELDS = {
426
+ COLUMN_NAMES => {:type => ::Thrift::Types::LIST, :name => 'column_names', :element => {:type => ::Thrift::Types::STRING, :binary => true}, :optional => true},
427
+ SLICE_RANGE => {:type => ::Thrift::Types::STRUCT, :name => 'slice_range', :class => CassandraCQL::Thrift::SliceRange, :optional => true}
428
+ }
429
+
430
+ def struct_fields; FIELDS; end
431
+
432
+ def validate
433
+ end
434
+
435
+ ::Thrift::Struct.generate_accessors self
436
+ end
437
+
438
+ class IndexExpression
439
+ include ::Thrift::Struct, ::Thrift::Struct_Union
440
+ COLUMN_NAME = 1
441
+ OP = 2
442
+ VALUE = 3
443
+
444
+ FIELDS = {
445
+ COLUMN_NAME => {:type => ::Thrift::Types::STRING, :name => 'column_name', :binary => true},
446
+ OP => {:type => ::Thrift::Types::I32, :name => 'op', :enum_class => CassandraCQL::Thrift::IndexOperator},
447
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true}
448
+ }
449
+
450
+ def struct_fields; FIELDS; end
451
+
452
+ def validate
453
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_name is unset!') unless @column_name
454
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field op is unset!') unless @op
455
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value is unset!') unless @value
456
+ unless @op.nil? || CassandraCQL::Thrift::IndexOperator::VALID_VALUES.include?(@op)
457
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field op!')
458
+ end
459
+ end
460
+
461
+ ::Thrift::Struct.generate_accessors self
462
+ end
463
+
464
+ class IndexClause
465
+ include ::Thrift::Struct, ::Thrift::Struct_Union
466
+ EXPRESSIONS = 1
467
+ START_KEY = 2
468
+ COUNT = 3
469
+
470
+ FIELDS = {
471
+ EXPRESSIONS => {:type => ::Thrift::Types::LIST, :name => 'expressions', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::IndexExpression}},
472
+ START_KEY => {:type => ::Thrift::Types::STRING, :name => 'start_key', :binary => true},
473
+ COUNT => {:type => ::Thrift::Types::I32, :name => 'count', :default => 100}
474
+ }
475
+
476
+ def struct_fields; FIELDS; end
477
+
478
+ def validate
479
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field expressions is unset!') unless @expressions
480
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start_key is unset!') unless @start_key
481
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field count is unset!') unless @count
482
+ end
483
+
484
+ ::Thrift::Struct.generate_accessors self
485
+ end
486
+
487
+ # The semantics of start keys and tokens are slightly different.
488
+ # Keys are start-inclusive; tokens are start-exclusive. Token
489
+ # ranges may also wrap -- that is, the end token may be less
490
+ # than the start one. Thus, a range from keyX to keyX is a
491
+ # one-element range, but a range from tokenY to tokenY is the
492
+ # full ring.
493
+ class KeyRange
494
+ include ::Thrift::Struct, ::Thrift::Struct_Union
495
+ START_KEY = 1
496
+ END_KEY = 2
497
+ START_TOKEN = 3
498
+ END_TOKEN = 4
499
+ COUNT = 5
500
+
501
+ FIELDS = {
502
+ START_KEY => {:type => ::Thrift::Types::STRING, :name => 'start_key', :binary => true, :optional => true},
503
+ END_KEY => {:type => ::Thrift::Types::STRING, :name => 'end_key', :binary => true, :optional => true},
504
+ START_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'start_token', :optional => true},
505
+ END_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'end_token', :optional => true},
506
+ COUNT => {:type => ::Thrift::Types::I32, :name => 'count', :default => 100}
507
+ }
508
+
509
+ def struct_fields; FIELDS; end
510
+
511
+ def validate
512
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field count is unset!') unless @count
513
+ end
514
+
515
+ ::Thrift::Struct.generate_accessors self
516
+ end
517
+
518
+ # A KeySlice is key followed by the data it maps to. A collection of KeySlice is returned by the get_range_slice operation.
519
+ #
520
+ # @param key. a row key
521
+ # @param columns. List of data represented by the key. Typically, the list is pared down to only the columns specified by
522
+ # a SlicePredicate.
523
+ class KeySlice
524
+ include ::Thrift::Struct, ::Thrift::Struct_Union
525
+ KEY = 1
526
+ COLUMNS = 2
527
+
528
+ FIELDS = {
529
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key', :binary => true},
530
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::ColumnOrSuperColumn}}
531
+ }
532
+
533
+ def struct_fields; FIELDS; end
534
+
535
+ def validate
536
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
537
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field columns is unset!') unless @columns
538
+ end
539
+
540
+ ::Thrift::Struct.generate_accessors self
541
+ end
542
+
543
+ class KeyCount
544
+ include ::Thrift::Struct, ::Thrift::Struct_Union
545
+ KEY = 1
546
+ COUNT = 2
547
+
548
+ FIELDS = {
549
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key', :binary => true},
550
+ COUNT => {:type => ::Thrift::Types::I32, :name => 'count'}
551
+ }
552
+
553
+ def struct_fields; FIELDS; end
554
+
555
+ def validate
556
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
557
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field count is unset!') unless @count
558
+ end
559
+
560
+ ::Thrift::Struct.generate_accessors self
561
+ end
562
+
563
+ # Note that the timestamp is only optional in case of counter deletion.
564
+ class Deletion
565
+ include ::Thrift::Struct, ::Thrift::Struct_Union
566
+ TIMESTAMP = 1
567
+ SUPER_COLUMN = 2
568
+ PREDICATE = 3
569
+
570
+ FIELDS = {
571
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
572
+ SUPER_COLUMN => {:type => ::Thrift::Types::STRING, :name => 'super_column', :binary => true, :optional => true},
573
+ PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraCQL::Thrift::SlicePredicate, :optional => true}
574
+ }
575
+
576
+ def struct_fields; FIELDS; end
577
+
578
+ def validate
579
+ end
580
+
581
+ ::Thrift::Struct.generate_accessors self
582
+ end
583
+
584
+ # A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling the deletion attribute).
585
+ # @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn)
586
+ # @param deletion. A deletion of a column or supercolumn
587
+ class Mutation
588
+ include ::Thrift::Struct, ::Thrift::Struct_Union
589
+ COLUMN_OR_SUPERCOLUMN = 1
590
+ DELETION = 2
591
+
592
+ FIELDS = {
593
+ COLUMN_OR_SUPERCOLUMN => {:type => ::Thrift::Types::STRUCT, :name => 'column_or_supercolumn', :class => CassandraCQL::Thrift::ColumnOrSuperColumn, :optional => true},
594
+ DELETION => {:type => ::Thrift::Types::STRUCT, :name => 'deletion', :class => CassandraCQL::Thrift::Deletion, :optional => true}
595
+ }
596
+
597
+ def struct_fields; FIELDS; end
598
+
599
+ def validate
600
+ end
601
+
602
+ ::Thrift::Struct.generate_accessors self
603
+ end
604
+
605
+ # A TokenRange describes part of the Cassandra ring, it is a mapping from a range to
606
+ # endpoints responsible for that range.
607
+ # @param start_token The first token in the range
608
+ # @param end_token The last token in the range
609
+ # @param endpoints The endpoints responsible for the range (listed by their configured listen_address)
610
+ # @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address)
611
+ class TokenRange
612
+ include ::Thrift::Struct, ::Thrift::Struct_Union
613
+ START_TOKEN = 1
614
+ END_TOKEN = 2
615
+ ENDPOINTS = 3
616
+ RPC_ENDPOINTS = 4
617
+
618
+ FIELDS = {
619
+ START_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'start_token'},
620
+ END_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'end_token'},
621
+ ENDPOINTS => {:type => ::Thrift::Types::LIST, :name => 'endpoints', :element => {:type => ::Thrift::Types::STRING}},
622
+ RPC_ENDPOINTS => {:type => ::Thrift::Types::LIST, :name => 'rpc_endpoints', :element => {:type => ::Thrift::Types::STRING}, :optional => true}
623
+ }
624
+
625
+ def struct_fields; FIELDS; end
626
+
627
+ def validate
628
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start_token is unset!') unless @start_token
629
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field end_token is unset!') unless @end_token
630
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field endpoints is unset!') unless @endpoints
631
+ end
632
+
633
+ ::Thrift::Struct.generate_accessors self
634
+ end
635
+
636
+ # Authentication requests can contain any data, dependent on the IAuthenticator used
637
+ class AuthenticationRequest
638
+ include ::Thrift::Struct, ::Thrift::Struct_Union
639
+ CREDENTIALS = 1
640
+
641
+ FIELDS = {
642
+ CREDENTIALS => {:type => ::Thrift::Types::MAP, :name => 'credentials', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
643
+ }
644
+
645
+ def struct_fields; FIELDS; end
646
+
647
+ def validate
648
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field credentials is unset!') unless @credentials
649
+ end
650
+
651
+ ::Thrift::Struct.generate_accessors self
652
+ end
653
+
654
+ class ColumnDef
655
+ include ::Thrift::Struct, ::Thrift::Struct_Union
656
+ NAME = 1
657
+ VALIDATION_CLASS = 2
658
+ INDEX_TYPE = 3
659
+ INDEX_NAME = 4
660
+ INDEX_OPTIONS = 5
661
+
662
+ FIELDS = {
663
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
664
+ VALIDATION_CLASS => {:type => ::Thrift::Types::STRING, :name => 'validation_class'},
665
+ INDEX_TYPE => {:type => ::Thrift::Types::I32, :name => 'index_type', :optional => true, :enum_class => CassandraCQL::Thrift::IndexType},
666
+ INDEX_NAME => {:type => ::Thrift::Types::STRING, :name => 'index_name', :optional => true},
667
+ INDEX_OPTIONS => {:type => ::Thrift::Types::MAP, :name => 'index_options', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
668
+ }
669
+
670
+ def struct_fields; FIELDS; end
671
+
672
+ def validate
673
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
674
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field validation_class is unset!') unless @validation_class
675
+ unless @index_type.nil? || CassandraCQL::Thrift::IndexType::VALID_VALUES.include?(@index_type)
676
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field index_type!')
677
+ end
678
+ end
679
+
680
+ ::Thrift::Struct.generate_accessors self
681
+ end
682
+
683
+ class CfDef
684
+ include ::Thrift::Struct, ::Thrift::Struct_Union
685
+ KEYSPACE = 1
686
+ NAME = 2
687
+ COLUMN_TYPE = 3
688
+ COMPARATOR_TYPE = 5
689
+ SUBCOMPARATOR_TYPE = 6
690
+ COMMENT = 8
691
+ ROW_CACHE_SIZE = 9
692
+ KEY_CACHE_SIZE = 11
693
+ READ_REPAIR_CHANCE = 12
694
+ COLUMN_METADATA = 13
695
+ GC_GRACE_SECONDS = 14
696
+ DEFAULT_VALIDATION_CLASS = 15
697
+ ID = 16
698
+ MIN_COMPACTION_THRESHOLD = 17
699
+ MAX_COMPACTION_THRESHOLD = 18
700
+ ROW_CACHE_SAVE_PERIOD_IN_SECONDS = 19
701
+ KEY_CACHE_SAVE_PERIOD_IN_SECONDS = 20
702
+ REPLICATE_ON_WRITE = 24
703
+ MERGE_SHARDS_CHANCE = 25
704
+ KEY_VALIDATION_CLASS = 26
705
+ ROW_CACHE_PROVIDER = 27
706
+ KEY_ALIAS = 28
707
+ COMPACTION_STRATEGY = 29
708
+ COMPACTION_STRATEGY_OPTIONS = 30
709
+ ROW_CACHE_KEYS_TO_SAVE = 31
710
+ COMPRESSION_OPTIONS = 32
711
+
712
+ FIELDS = {
713
+ KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
714
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
715
+ COLUMN_TYPE => {:type => ::Thrift::Types::STRING, :name => 'column_type', :default => %q"Standard", :optional => true},
716
+ COMPARATOR_TYPE => {:type => ::Thrift::Types::STRING, :name => 'comparator_type', :default => %q"BytesType", :optional => true},
717
+ SUBCOMPARATOR_TYPE => {:type => ::Thrift::Types::STRING, :name => 'subcomparator_type', :optional => true},
718
+ COMMENT => {:type => ::Thrift::Types::STRING, :name => 'comment', :optional => true},
719
+ ROW_CACHE_SIZE => {:type => ::Thrift::Types::DOUBLE, :name => 'row_cache_size', :default => 0, :optional => true},
720
+ KEY_CACHE_SIZE => {:type => ::Thrift::Types::DOUBLE, :name => 'key_cache_size', :default => 200000, :optional => true},
721
+ READ_REPAIR_CHANCE => {:type => ::Thrift::Types::DOUBLE, :name => 'read_repair_chance', :default => 1, :optional => true},
722
+ COLUMN_METADATA => {:type => ::Thrift::Types::LIST, :name => 'column_metadata', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::ColumnDef}, :optional => true},
723
+ GC_GRACE_SECONDS => {:type => ::Thrift::Types::I32, :name => 'gc_grace_seconds', :optional => true},
724
+ DEFAULT_VALIDATION_CLASS => {:type => ::Thrift::Types::STRING, :name => 'default_validation_class', :optional => true},
725
+ ID => {:type => ::Thrift::Types::I32, :name => 'id', :optional => true},
726
+ MIN_COMPACTION_THRESHOLD => {:type => ::Thrift::Types::I32, :name => 'min_compaction_threshold', :optional => true},
727
+ MAX_COMPACTION_THRESHOLD => {:type => ::Thrift::Types::I32, :name => 'max_compaction_threshold', :optional => true},
728
+ ROW_CACHE_SAVE_PERIOD_IN_SECONDS => {:type => ::Thrift::Types::I32, :name => 'row_cache_save_period_in_seconds', :optional => true},
729
+ KEY_CACHE_SAVE_PERIOD_IN_SECONDS => {:type => ::Thrift::Types::I32, :name => 'key_cache_save_period_in_seconds', :optional => true},
730
+ REPLICATE_ON_WRITE => {:type => ::Thrift::Types::BOOL, :name => 'replicate_on_write', :optional => true},
731
+ MERGE_SHARDS_CHANCE => {:type => ::Thrift::Types::DOUBLE, :name => 'merge_shards_chance', :optional => true},
732
+ KEY_VALIDATION_CLASS => {:type => ::Thrift::Types::STRING, :name => 'key_validation_class', :optional => true},
733
+ ROW_CACHE_PROVIDER => {:type => ::Thrift::Types::STRING, :name => 'row_cache_provider', :optional => true},
734
+ KEY_ALIAS => {:type => ::Thrift::Types::STRING, :name => 'key_alias', :binary => true, :optional => true},
735
+ COMPACTION_STRATEGY => {:type => ::Thrift::Types::STRING, :name => 'compaction_strategy', :optional => true},
736
+ COMPACTION_STRATEGY_OPTIONS => {:type => ::Thrift::Types::MAP, :name => 'compaction_strategy_options', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
737
+ ROW_CACHE_KEYS_TO_SAVE => {:type => ::Thrift::Types::I32, :name => 'row_cache_keys_to_save', :optional => true},
738
+ COMPRESSION_OPTIONS => {:type => ::Thrift::Types::MAP, :name => 'compression_options', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
739
+ }
740
+
741
+ def struct_fields; FIELDS; end
742
+
743
+ def validate
744
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
745
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
746
+ end
747
+
748
+ ::Thrift::Struct.generate_accessors self
749
+ end
750
+
751
+ class KsDef
752
+ include ::Thrift::Struct, ::Thrift::Struct_Union
753
+ NAME = 1
754
+ STRATEGY_CLASS = 2
755
+ STRATEGY_OPTIONS = 3
756
+ REPLICATION_FACTOR = 4
757
+ CF_DEFS = 5
758
+ DURABLE_WRITES = 6
759
+
760
+ FIELDS = {
761
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
762
+ STRATEGY_CLASS => {:type => ::Thrift::Types::STRING, :name => 'strategy_class'},
763
+ STRATEGY_OPTIONS => {:type => ::Thrift::Types::MAP, :name => 'strategy_options', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
764
+ # @deprecated
765
+ REPLICATION_FACTOR => {:type => ::Thrift::Types::I32, :name => 'replication_factor', :optional => true},
766
+ CF_DEFS => {:type => ::Thrift::Types::LIST, :name => 'cf_defs', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::CfDef}},
767
+ DURABLE_WRITES => {:type => ::Thrift::Types::BOOL, :name => 'durable_writes', :default => true, :optional => true}
768
+ }
769
+
770
+ def struct_fields; FIELDS; end
771
+
772
+ def validate
773
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
774
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field strategy_class is unset!') unless @strategy_class
775
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field cf_defs is unset!') unless @cf_defs
776
+ end
777
+
778
+ ::Thrift::Struct.generate_accessors self
779
+ end
780
+
781
+ # Row returned from a CQL query
782
+ class CqlRow
783
+ include ::Thrift::Struct, ::Thrift::Struct_Union
784
+ KEY = 1
785
+ COLUMNS = 2
786
+
787
+ FIELDS = {
788
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key', :binary => true},
789
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::Column}}
790
+ }
791
+
792
+ def struct_fields; FIELDS; end
793
+
794
+ def validate
795
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
796
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field columns is unset!') unless @columns
797
+ end
798
+
799
+ ::Thrift::Struct.generate_accessors self
800
+ end
801
+
802
+ class CqlMetadata
803
+ include ::Thrift::Struct, ::Thrift::Struct_Union
804
+ NAME_TYPES = 1
805
+ VALUE_TYPES = 2
806
+ DEFAULT_NAME_TYPE = 3
807
+ DEFAULT_VALUE_TYPE = 4
808
+
809
+ FIELDS = {
810
+ NAME_TYPES => {:type => ::Thrift::Types::MAP, :name => 'name_types', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::STRING}},
811
+ VALUE_TYPES => {:type => ::Thrift::Types::MAP, :name => 'value_types', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::STRING}},
812
+ DEFAULT_NAME_TYPE => {:type => ::Thrift::Types::STRING, :name => 'default_name_type'},
813
+ DEFAULT_VALUE_TYPE => {:type => ::Thrift::Types::STRING, :name => 'default_value_type'}
814
+ }
815
+
816
+ def struct_fields; FIELDS; end
817
+
818
+ def validate
819
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name_types is unset!') unless @name_types
820
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value_types is unset!') unless @value_types
821
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field default_name_type is unset!') unless @default_name_type
822
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field default_value_type is unset!') unless @default_value_type
823
+ end
824
+
825
+ ::Thrift::Struct.generate_accessors self
826
+ end
827
+
828
+ class CqlResult
829
+ include ::Thrift::Struct, ::Thrift::Struct_Union
830
+ TYPE = 1
831
+ ROWS = 2
832
+ NUM = 3
833
+ SCHEMA = 4
834
+
835
+ FIELDS = {
836
+ TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :enum_class => CassandraCQL::Thrift::CqlResultType},
837
+ ROWS => {:type => ::Thrift::Types::LIST, :name => 'rows', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraCQL::Thrift::CqlRow}, :optional => true},
838
+ NUM => {:type => ::Thrift::Types::I32, :name => 'num', :optional => true},
839
+ SCHEMA => {:type => ::Thrift::Types::STRUCT, :name => 'schema', :class => CassandraCQL::Thrift::CqlMetadata, :optional => true}
840
+ }
841
+
842
+ def struct_fields; FIELDS; end
843
+
844
+ def validate
845
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field type is unset!') unless @type
846
+ unless @type.nil? || CassandraCQL::Thrift::CqlResultType::VALID_VALUES.include?(@type)
847
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
848
+ end
849
+ end
850
+
851
+ ::Thrift::Struct.generate_accessors self
852
+ end
853
+ end
854
+ end