hallelujah-cassandra 0.12.3

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