cassandra 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +1 -0
- data/Rakefile +15 -11
- data/cassandra.gemspec +10 -10
- data/conf/cassandra.in.sh +7 -11
- data/conf/storage-conf.xml +319 -218
- data/lib/cassandra.rb +1 -1
- data/lib/cassandra/cassandra.rb +44 -31
- data/lib/cassandra/columns.rb +26 -28
- data/lib/cassandra/helpers.rb +5 -3
- data/lib/cassandra/mock.rb +3 -0
- data/lib/cassandra/protocol.rb +26 -12
- data/test/cassandra_client_test.rb +20 -0
- data/test/cassandra_test.rb +15 -9
- data/vendor/gen-rb/cassandra.rb +515 -49
- data/vendor/gen-rb/cassandra_constants.rb +1 -1
- data/vendor/gen-rb/cassandra_types.rb +167 -2
- metadata +4 -8
- metadata.gz.sig +1 -3
data/lib/cassandra.rb
CHANGED
data/lib/cassandra/cassandra.rb
CHANGED
@@ -69,19 +69,9 @@ class Cassandra
|
|
69
69
|
@servers = Array(servers)
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
73
|
-
return @client if defined?(@client)
|
74
|
-
client!
|
75
|
-
end
|
76
|
-
|
77
|
-
def client!
|
78
|
-
@client = raw_client
|
79
|
-
unless (keyspaces = client.get_string_list_property("keyspaces")).include?(@keyspace)
|
80
|
-
raise AccessError, "Keyspace #{@keyspace.inspect} not found. Available: #{keyspaces.inspect}"
|
81
|
-
end
|
82
|
-
@servers = all_nodes
|
72
|
+
def disconnect!
|
83
73
|
@client.disconnect!
|
84
|
-
@client =
|
74
|
+
@client = nil
|
85
75
|
end
|
86
76
|
|
87
77
|
def keyspaces
|
@@ -103,12 +93,24 @@ class Cassandra
|
|
103
93
|
column_family, _, _, options = extract_and_validate_params(column_family, key, [options], WRITE_DEFAULTS)
|
104
94
|
|
105
95
|
timestamp = options[:timestamp] || Time.stamp
|
106
|
-
|
107
|
-
|
96
|
+
mutation_map = if is_super(column_family)
|
97
|
+
{
|
98
|
+
key => {
|
99
|
+
column_family => hash.collect{|k,v| _super_insert_mutation(column_family, k, v, timestamp) }
|
100
|
+
}
|
101
|
+
}
|
102
|
+
else
|
103
|
+
{
|
104
|
+
key => {
|
105
|
+
column_family => hash.collect{|k,v| _standard_insert_mutation(column_family, k, v, timestamp)}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
end
|
108
109
|
|
109
|
-
@batch ? @batch <<
|
110
|
+
@batch ? @batch << [mutation_map, options[:consistency]] : _mutate(mutation_map, options[:consistency])
|
110
111
|
end
|
111
112
|
|
113
|
+
|
112
114
|
## Delete
|
113
115
|
|
114
116
|
# _mutate the element at the column_family:key:[column]:[sub_column]
|
@@ -131,8 +133,8 @@ class Cassandra
|
|
131
133
|
# FIXME May not currently delete all records without multiple calls. Waiting
|
132
134
|
# for ranged remove support in Cassandra.
|
133
135
|
def clear_column_family!(column_family, options = {})
|
134
|
-
|
135
|
-
|
136
|
+
each_key(column_family) do |key|
|
137
|
+
remove(column_family, key, options)
|
136
138
|
end
|
137
139
|
end
|
138
140
|
|
@@ -220,14 +222,7 @@ class Cassandra
|
|
220
222
|
# to be partitioned with OrderPreservingHash. Supports the <tt>:start</tt>,
|
221
223
|
# <tt>:finish</tt>, and <tt>:consistency</tt> options.
|
222
224
|
def count_range(column_family, options = {})
|
223
|
-
|
224
|
-
l = []
|
225
|
-
start_key = options[:start]
|
226
|
-
while (l = get_range(column_family, options.merge(:count => 1000, :start => start_key))).size > 0
|
227
|
-
count += l.size
|
228
|
-
start_key = l.last.succ
|
229
|
-
end
|
230
|
-
count
|
225
|
+
get_range(column_family, options).select{|r| r.columns.length > 0}.compact.length
|
231
226
|
end
|
232
227
|
|
233
228
|
# Open a batch operation and yield. Inserts and deletes will be queued until
|
@@ -244,20 +239,20 @@ class Cassandra
|
|
244
239
|
|
245
240
|
@batch.each do |mutation|
|
246
241
|
case mutation.first
|
247
|
-
when :insert
|
248
|
-
_insert(*mutation[1])
|
249
242
|
when :remove
|
250
243
|
_remove(*mutation[1])
|
244
|
+
else
|
245
|
+
_mutate(*mutation)
|
251
246
|
end
|
252
247
|
end
|
253
248
|
ensure
|
254
249
|
@batch = nil
|
255
250
|
end
|
256
251
|
|
257
|
-
|
252
|
+
protected
|
258
253
|
|
259
254
|
def calling_method
|
260
|
-
|
255
|
+
"#{self.class}##{caller[0].split('`').last[0..-3]}"
|
261
256
|
end
|
262
257
|
|
263
258
|
# Roll up queued mutations, to improve atomicity.
|
@@ -273,13 +268,31 @@ class Cassandra
|
|
273
268
|
end
|
274
269
|
end
|
275
270
|
|
276
|
-
def
|
271
|
+
def client
|
272
|
+
reconnect! if @client.nil?
|
273
|
+
@client
|
274
|
+
end
|
275
|
+
|
276
|
+
def reconnect!
|
277
|
+
@servers = all_nodes
|
278
|
+
@client = new_client
|
279
|
+
check_keyspace
|
280
|
+
end
|
281
|
+
|
282
|
+
def check_keyspace
|
283
|
+
unless (keyspaces = client.get_string_list_property("keyspaces")).include?(@keyspace)
|
284
|
+
raise AccessError, "Keyspace #{@keyspace.inspect} not found. Available: #{keyspaces.inspect}"
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
def new_client
|
277
289
|
ThriftClient.new(CassandraThrift::Cassandra::Client, @servers, @thrift_client_options)
|
278
290
|
end
|
279
291
|
|
280
292
|
def all_nodes
|
281
|
-
ips = ::JSON.parse(
|
293
|
+
ips = ::JSON.parse(new_client.get_string_property('token map')).values
|
282
294
|
port = @servers.first.split(':').last
|
283
295
|
ips.map{|ip| "#{ip}:#{port}" }
|
284
296
|
end
|
297
|
+
|
285
298
|
end
|
data/lib/cassandra/columns.rb
CHANGED
@@ -71,38 +71,36 @@ class Cassandra
|
|
71
71
|
c.value
|
72
72
|
end
|
73
73
|
end
|
74
|
-
hash
|
74
|
+
hash
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
:
|
83
|
-
|
84
|
-
:columns => sub_columns.collect { |sub_column_name, sub_column_value|
|
85
|
-
CassandraThrift::Column.new(
|
86
|
-
:name => sub_column_name_class(column_family).new(sub_column_name).to_s,
|
87
|
-
:value => sub_column_value.to_s,
|
88
|
-
:timestamp => timestamp
|
89
|
-
)
|
90
|
-
}
|
91
|
-
)
|
77
|
+
def _standard_insert_mutation(column_family, column_name, value, timestamp)
|
78
|
+
CassandraThrift::Mutation.new(
|
79
|
+
:column_or_supercolumn => CassandraThrift::ColumnOrSuperColumn.new(
|
80
|
+
:column => CassandraThrift::Column.new(
|
81
|
+
:name => column_name_class(column_family).new(column_name).to_s,
|
82
|
+
:value => value,
|
83
|
+
:timestamp => timestamp
|
92
84
|
)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
)
|
85
|
+
)
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
def _super_insert_mutation(column_family, super_column_name, sub_columns, timestamp)
|
90
|
+
CassandraThrift::Mutation.new(:column_or_supercolumn =>
|
91
|
+
CassandraThrift::ColumnOrSuperColumn.new(
|
92
|
+
:super_column => CassandraThrift::SuperColumn.new(
|
93
|
+
:name => column_name_class(column_family).new(super_column_name).to_s,
|
94
|
+
:columns => sub_columns.collect { |sub_column_name, sub_column_value|
|
95
|
+
CassandraThrift::Column.new(
|
96
|
+
:name => sub_column_name_class(column_family).new(sub_column_name).to_s,
|
97
|
+
:value => sub_column_value.to_s,
|
98
|
+
:timestamp => timestamp
|
99
|
+
)
|
100
|
+
}
|
102
101
|
)
|
103
|
-
|
104
|
-
|
105
|
-
h
|
102
|
+
)
|
103
|
+
)
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
data/lib/cassandra/helpers.rb
CHANGED
@@ -19,8 +19,10 @@ class Cassandra
|
|
19
19
|
column, sub_column = args[0], args[1]
|
20
20
|
klass, sub_klass = column_name_class(column_family), sub_column_name_class(column_family)
|
21
21
|
range_class = column ? sub_klass : klass
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
[:start, :finish].each do |opt|
|
24
|
+
options[opt] = options[opt] ? range_class.new(options[opt]).to_s : ''
|
25
|
+
end
|
24
26
|
|
25
27
|
[column_family, s_map(column, klass), s_map(sub_column, sub_klass), options]
|
26
28
|
end
|
@@ -35,4 +37,4 @@ class Cassandra
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
38
|
-
end
|
40
|
+
end
|
data/lib/cassandra/mock.rb
CHANGED
data/lib/cassandra/protocol.rb
CHANGED
@@ -4,16 +4,16 @@ class Cassandra
|
|
4
4
|
module Protocol #:nodoc:
|
5
5
|
private
|
6
6
|
|
7
|
-
def
|
8
|
-
|
7
|
+
def _mutate(mutation_map, consistency_level)
|
8
|
+
client.batch_mutate(@keyspace, mutation_map, consistency_level)
|
9
9
|
end
|
10
10
|
|
11
11
|
def _remove(key, column_path, timestamp, consistency_level)
|
12
|
-
|
12
|
+
client.remove(@keyspace, key, column_path, timestamp, consistency_level)
|
13
13
|
end
|
14
14
|
|
15
15
|
def _count_columns(column_family, key, super_column, consistency)
|
16
|
-
|
16
|
+
client.get_count(@keyspace, key,
|
17
17
|
CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => super_column),
|
18
18
|
consistency
|
19
19
|
)
|
@@ -22,18 +22,18 @@ class Cassandra
|
|
22
22
|
def _get_columns(column_family, key, columns, sub_columns, consistency)
|
23
23
|
result = if is_super(column_family)
|
24
24
|
if sub_columns
|
25
|
-
columns_to_hash(column_family,
|
25
|
+
columns_to_hash(column_family, client.get_slice(@keyspace, key,
|
26
26
|
CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => columns),
|
27
27
|
CassandraThrift::SlicePredicate.new(:column_names => sub_columns),
|
28
28
|
consistency))
|
29
29
|
else
|
30
|
-
columns_to_hash(column_family,
|
30
|
+
columns_to_hash(column_family, client.get_slice(@keyspace, key,
|
31
31
|
CassandraThrift::ColumnParent.new(:column_family => column_family),
|
32
32
|
CassandraThrift::SlicePredicate.new(:column_names => columns),
|
33
33
|
consistency))
|
34
34
|
end
|
35
35
|
else
|
36
|
-
columns_to_hash(column_family,
|
36
|
+
columns_to_hash(column_family, client.get_slice(@keyspace, key,
|
37
37
|
CassandraThrift::ColumnParent.new(:column_family => column_family),
|
38
38
|
CassandraThrift::SlicePredicate.new(:column_names => columns),
|
39
39
|
consistency))
|
@@ -47,10 +47,10 @@ class Cassandra
|
|
47
47
|
# Single values; count and range parameters have no effect
|
48
48
|
if is_super(column_family) and sub_column
|
49
49
|
column_path = CassandraThrift::ColumnPath.new(:column_family => column_family, :super_column => column, :column => sub_column)
|
50
|
-
multi_column_to_hash!(
|
50
|
+
multi_column_to_hash!(client.multiget(@keyspace, keys, column_path, consistency))
|
51
51
|
elsif !is_super(column_family) and column
|
52
52
|
column_path = CassandraThrift::ColumnPath.new(:column_family => column_family, :column => column)
|
53
|
-
multi_column_to_hash!(
|
53
|
+
multi_column_to_hash!(client.multiget(@keyspace, keys, column_path, consistency))
|
54
54
|
|
55
55
|
# Slices
|
56
56
|
else
|
@@ -63,16 +63,30 @@ class Cassandra
|
|
63
63
|
|
64
64
|
if is_super(column_family) and column
|
65
65
|
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => column)
|
66
|
-
multi_sub_columns_to_hash!(column_family,
|
66
|
+
multi_sub_columns_to_hash!(column_family, client.multiget_slice(@keyspace, keys, column_parent, predicate, consistency))
|
67
67
|
else
|
68
68
|
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
|
69
|
-
multi_columns_to_hash!(column_family,
|
69
|
+
multi_columns_to_hash!(column_family, client.multiget_slice(@keyspace, keys, column_parent, predicate, consistency))
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
def _get_range(column_family, start, finish, count, consistency)
|
75
|
-
|
75
|
+
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
|
76
|
+
predicate = CassandraThrift::SlicePredicate.new(:slice_range => CassandraThrift::SliceRange.new(:start => '', :finish => ''))
|
77
|
+
range = CassandraThrift::KeyRange.new(:start_key => start, :end_key => finish)
|
78
|
+
client.get_range_slices(@keyspace, column_parent, predicate, range, 1)
|
79
|
+
end
|
80
|
+
|
81
|
+
def _get_range_keys(column_family, start, finish, count, consistency)
|
82
|
+
_get_range(column_family, start, finish, count, consistency).collect{|i| i.key }
|
83
|
+
end
|
84
|
+
|
85
|
+
def each_key(column_family)
|
86
|
+
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family.to_s)
|
87
|
+
predicate = CassandraThrift::SlicePredicate.new(:column_names => [])
|
88
|
+
range = CassandraThrift::KeyRange.new(:start_key => '', :end_key => '')
|
89
|
+
client.get_range_slices(@keyspace, column_parent, predicate, range, 1).each{|i| yield i.key }
|
76
90
|
end
|
77
91
|
end
|
78
92
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
2
|
+
|
3
|
+
class CassandraClientTest < Test::Unit::TestCase
|
4
|
+
include Cassandra::Constants
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@twitter = Cassandra.new('Twitter', "127.0.0.1:9160", :retries => 2, :exception_classes => [])
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_client_method_is_called
|
11
|
+
assert_nil @twitter.instance_variable_get(:@client)
|
12
|
+
@twitter.insert(:Statuses, key, {'1' => 'v', '2' => 'v', '3' => 'v'})
|
13
|
+
assert_not_nil @twitter.instance_variable_get(:@client)
|
14
|
+
end
|
15
|
+
|
16
|
+
def key
|
17
|
+
caller.first[/`(.*?)'/, 1]
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/test/cassandra_test.rb
CHANGED
@@ -152,14 +152,16 @@ class CassandraTest < Test::Unit::TestCase
|
|
152
152
|
assert_nil @twitter.get(:StatusRelationships, 'bogus', 'user_timelines', columns.keys.first)
|
153
153
|
end
|
154
154
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
155
|
+
|
156
|
+
#TODO: add a OPP keyspace for this
|
157
|
+
# def test_get_range
|
158
|
+
# @twitter.insert(:Statuses, '2', {'body' => '1'})
|
159
|
+
# @twitter.insert(:Statuses, '3', {'body' => '1'})
|
160
|
+
# @twitter.insert(:Statuses, '4', {'body' => '1'})
|
161
|
+
# @twitter.insert(:Statuses, '5', {'body' => '1'})
|
162
|
+
# @twitter.insert(:Statuses, '6', {'body' => '1'})
|
163
|
+
# assert_equal(['3', '4', '5'], @twitter.get_range(:Statuses, :start => '3', :finish => '5'))
|
164
|
+
# end
|
163
165
|
|
164
166
|
def test_multi_get
|
165
167
|
@twitter.insert(:Users, key + '1', {'body' => 'v1', 'user' => 'v1'})
|
@@ -182,7 +184,6 @@ class CassandraTest < Test::Unit::TestCase
|
|
182
184
|
|
183
185
|
@twitter.remove(:Statuses, key)
|
184
186
|
assert_equal({}, @twitter.get(:Statuses, key))
|
185
|
-
assert_equal 0, @twitter.count_range(:Statuses)
|
186
187
|
end
|
187
188
|
|
188
189
|
def test_remove_value
|
@@ -342,6 +343,11 @@ class CassandraTest < Test::Unit::TestCase
|
|
342
343
|
@twitter.insert(:Index, 'asdf', {"thing" => {'jkl' => nil} })
|
343
344
|
end
|
344
345
|
|
346
|
+
def test_disconnect!
|
347
|
+
@twitter.disconnect!
|
348
|
+
assert_nil @twitter.instance_variable_get(:@client)
|
349
|
+
end
|
350
|
+
|
345
351
|
private
|
346
352
|
|
347
353
|
def key
|
data/vendor/gen-rb/cassandra.rb
CHANGED
@@ -12,6 +12,22 @@ require 'cassandra_types'
|
|
12
12
|
class Client
|
13
13
|
include ::Thrift::Client
|
14
14
|
|
15
|
+
def login(keyspace, auth_request)
|
16
|
+
send_login(keyspace, auth_request)
|
17
|
+
recv_login()
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_login(keyspace, auth_request)
|
21
|
+
send_message('login', Login_args, :keyspace => keyspace, :auth_request => auth_request)
|
22
|
+
end
|
23
|
+
|
24
|
+
def recv_login()
|
25
|
+
result = receive_message(Login_result)
|
26
|
+
raise result.authnx unless result.authnx.nil?
|
27
|
+
raise result.authzx unless result.authzx.nil?
|
28
|
+
return
|
29
|
+
end
|
30
|
+
|
15
31
|
def get(keyspace, key, column_path, consistency_level)
|
16
32
|
send_get(keyspace, key, column_path, consistency_level)
|
17
33
|
return recv_get()
|
@@ -103,40 +119,40 @@ require 'cassandra_types'
|
|
103
119
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_count failed: unknown result')
|
104
120
|
end
|
105
121
|
|
106
|
-
def
|
107
|
-
|
108
|
-
return
|
122
|
+
def get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level)
|
123
|
+
send_get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level)
|
124
|
+
return recv_get_range_slice()
|
109
125
|
end
|
110
126
|
|
111
|
-
def
|
112
|
-
send_message('
|
127
|
+
def send_get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level)
|
128
|
+
send_message('get_range_slice', Get_range_slice_args, :keyspace => keyspace, :column_parent => column_parent, :predicate => predicate, :start_key => start_key, :finish_key => finish_key, :row_count => row_count, :consistency_level => consistency_level)
|
113
129
|
end
|
114
130
|
|
115
|
-
def
|
116
|
-
result = receive_message(
|
131
|
+
def recv_get_range_slice()
|
132
|
+
result = receive_message(Get_range_slice_result)
|
117
133
|
return result.success unless result.success.nil?
|
118
134
|
raise result.ire unless result.ire.nil?
|
119
135
|
raise result.ue unless result.ue.nil?
|
120
136
|
raise result.te unless result.te.nil?
|
121
|
-
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, '
|
137
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_range_slice failed: unknown result')
|
122
138
|
end
|
123
139
|
|
124
|
-
def
|
125
|
-
|
126
|
-
return
|
140
|
+
def get_range_slices(keyspace, column_parent, predicate, range, consistency_level)
|
141
|
+
send_get_range_slices(keyspace, column_parent, predicate, range, consistency_level)
|
142
|
+
return recv_get_range_slices()
|
127
143
|
end
|
128
144
|
|
129
|
-
def
|
130
|
-
send_message('
|
145
|
+
def send_get_range_slices(keyspace, column_parent, predicate, range, consistency_level)
|
146
|
+
send_message('get_range_slices', Get_range_slices_args, :keyspace => keyspace, :column_parent => column_parent, :predicate => predicate, :range => range, :consistency_level => consistency_level)
|
131
147
|
end
|
132
148
|
|
133
|
-
def
|
134
|
-
result = receive_message(
|
149
|
+
def recv_get_range_slices()
|
150
|
+
result = receive_message(Get_range_slices_result)
|
135
151
|
return result.success unless result.success.nil?
|
136
152
|
raise result.ire unless result.ire.nil?
|
137
153
|
raise result.ue unless result.ue.nil?
|
138
154
|
raise result.te unless result.te.nil?
|
139
|
-
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, '
|
155
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_range_slices failed: unknown result')
|
140
156
|
end
|
141
157
|
|
142
158
|
def insert(keyspace, key, column_path, value, timestamp, consistency_level)
|
@@ -190,6 +206,23 @@ require 'cassandra_types'
|
|
190
206
|
return
|
191
207
|
end
|
192
208
|
|
209
|
+
def batch_mutate(keyspace, mutation_map, consistency_level)
|
210
|
+
send_batch_mutate(keyspace, mutation_map, consistency_level)
|
211
|
+
recv_batch_mutate()
|
212
|
+
end
|
213
|
+
|
214
|
+
def send_batch_mutate(keyspace, mutation_map, consistency_level)
|
215
|
+
send_message('batch_mutate', Batch_mutate_args, :keyspace => keyspace, :mutation_map => mutation_map, :consistency_level => consistency_level)
|
216
|
+
end
|
217
|
+
|
218
|
+
def recv_batch_mutate()
|
219
|
+
result = receive_message(Batch_mutate_result)
|
220
|
+
raise result.ire unless result.ire.nil?
|
221
|
+
raise result.ue unless result.ue.nil?
|
222
|
+
raise result.te unless result.te.nil?
|
223
|
+
return
|
224
|
+
end
|
225
|
+
|
193
226
|
def get_string_property(property)
|
194
227
|
send_get_string_property(property)
|
195
228
|
return recv_get_string_property()
|
@@ -220,6 +253,66 @@ require 'cassandra_types'
|
|
220
253
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_string_list_property failed: unknown result')
|
221
254
|
end
|
222
255
|
|
256
|
+
def describe_keyspaces()
|
257
|
+
send_describe_keyspaces()
|
258
|
+
return recv_describe_keyspaces()
|
259
|
+
end
|
260
|
+
|
261
|
+
def send_describe_keyspaces()
|
262
|
+
send_message('describe_keyspaces', Describe_keyspaces_args)
|
263
|
+
end
|
264
|
+
|
265
|
+
def recv_describe_keyspaces()
|
266
|
+
result = receive_message(Describe_keyspaces_result)
|
267
|
+
return result.success unless result.success.nil?
|
268
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_keyspaces failed: unknown result')
|
269
|
+
end
|
270
|
+
|
271
|
+
def describe_cluster_name()
|
272
|
+
send_describe_cluster_name()
|
273
|
+
return recv_describe_cluster_name()
|
274
|
+
end
|
275
|
+
|
276
|
+
def send_describe_cluster_name()
|
277
|
+
send_message('describe_cluster_name', Describe_cluster_name_args)
|
278
|
+
end
|
279
|
+
|
280
|
+
def recv_describe_cluster_name()
|
281
|
+
result = receive_message(Describe_cluster_name_result)
|
282
|
+
return result.success unless result.success.nil?
|
283
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_cluster_name failed: unknown result')
|
284
|
+
end
|
285
|
+
|
286
|
+
def describe_version()
|
287
|
+
send_describe_version()
|
288
|
+
return recv_describe_version()
|
289
|
+
end
|
290
|
+
|
291
|
+
def send_describe_version()
|
292
|
+
send_message('describe_version', Describe_version_args)
|
293
|
+
end
|
294
|
+
|
295
|
+
def recv_describe_version()
|
296
|
+
result = receive_message(Describe_version_result)
|
297
|
+
return result.success unless result.success.nil?
|
298
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_version failed: unknown result')
|
299
|
+
end
|
300
|
+
|
301
|
+
def describe_ring(keyspace)
|
302
|
+
send_describe_ring(keyspace)
|
303
|
+
return recv_describe_ring()
|
304
|
+
end
|
305
|
+
|
306
|
+
def send_describe_ring(keyspace)
|
307
|
+
send_message('describe_ring', Describe_ring_args, :keyspace => keyspace)
|
308
|
+
end
|
309
|
+
|
310
|
+
def recv_describe_ring()
|
311
|
+
result = receive_message(Describe_ring_result)
|
312
|
+
return result.success unless result.success.nil?
|
313
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_ring failed: unknown result')
|
314
|
+
end
|
315
|
+
|
223
316
|
def describe_keyspace(keyspace)
|
224
317
|
send_describe_keyspace(keyspace)
|
225
318
|
return recv_describe_keyspace()
|
@@ -236,11 +329,39 @@ require 'cassandra_types'
|
|
236
329
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_keyspace failed: unknown result')
|
237
330
|
end
|
238
331
|
|
332
|
+
def describe_splits(start_token, end_token, keys_per_split)
|
333
|
+
send_describe_splits(start_token, end_token, keys_per_split)
|
334
|
+
return recv_describe_splits()
|
335
|
+
end
|
336
|
+
|
337
|
+
def send_describe_splits(start_token, end_token, keys_per_split)
|
338
|
+
send_message('describe_splits', Describe_splits_args, :start_token => start_token, :end_token => end_token, :keys_per_split => keys_per_split)
|
339
|
+
end
|
340
|
+
|
341
|
+
def recv_describe_splits()
|
342
|
+
result = receive_message(Describe_splits_result)
|
343
|
+
return result.success unless result.success.nil?
|
344
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_splits failed: unknown result')
|
345
|
+
end
|
346
|
+
|
239
347
|
end
|
240
348
|
|
241
349
|
class Processor
|
242
350
|
include ::Thrift::Processor
|
243
351
|
|
352
|
+
def process_login(seqid, iprot, oprot)
|
353
|
+
args = read_args(iprot, Login_args)
|
354
|
+
result = Login_result.new()
|
355
|
+
begin
|
356
|
+
@handler.login(args.keyspace, args.auth_request)
|
357
|
+
rescue CassandraThrift::AuthenticationException => authnx
|
358
|
+
result.authnx = authnx
|
359
|
+
rescue CassandraThrift::AuthorizationException => authzx
|
360
|
+
result.authzx = authzx
|
361
|
+
end
|
362
|
+
write_result(result, oprot, 'login', seqid)
|
363
|
+
end
|
364
|
+
|
244
365
|
def process_get(seqid, iprot, oprot)
|
245
366
|
args = read_args(iprot, Get_args)
|
246
367
|
result = Get_result.new()
|
@@ -318,11 +439,11 @@ require 'cassandra_types'
|
|
318
439
|
write_result(result, oprot, 'get_count', seqid)
|
319
440
|
end
|
320
441
|
|
321
|
-
def
|
322
|
-
args = read_args(iprot,
|
323
|
-
result =
|
442
|
+
def process_get_range_slice(seqid, iprot, oprot)
|
443
|
+
args = read_args(iprot, Get_range_slice_args)
|
444
|
+
result = Get_range_slice_result.new()
|
324
445
|
begin
|
325
|
-
result.success = @handler.
|
446
|
+
result.success = @handler.get_range_slice(args.keyspace, args.column_parent, args.predicate, args.start_key, args.finish_key, args.row_count, args.consistency_level)
|
326
447
|
rescue CassandraThrift::InvalidRequestException => ire
|
327
448
|
result.ire = ire
|
328
449
|
rescue CassandraThrift::UnavailableException => ue
|
@@ -330,14 +451,14 @@ require 'cassandra_types'
|
|
330
451
|
rescue CassandraThrift::TimedOutException => te
|
331
452
|
result.te = te
|
332
453
|
end
|
333
|
-
write_result(result, oprot, '
|
454
|
+
write_result(result, oprot, 'get_range_slice', seqid)
|
334
455
|
end
|
335
456
|
|
336
|
-
def
|
337
|
-
args = read_args(iprot,
|
338
|
-
result =
|
457
|
+
def process_get_range_slices(seqid, iprot, oprot)
|
458
|
+
args = read_args(iprot, Get_range_slices_args)
|
459
|
+
result = Get_range_slices_result.new()
|
339
460
|
begin
|
340
|
-
result.success = @handler.
|
461
|
+
result.success = @handler.get_range_slices(args.keyspace, args.column_parent, args.predicate, args.range, args.consistency_level)
|
341
462
|
rescue CassandraThrift::InvalidRequestException => ire
|
342
463
|
result.ire = ire
|
343
464
|
rescue CassandraThrift::UnavailableException => ue
|
@@ -345,7 +466,7 @@ require 'cassandra_types'
|
|
345
466
|
rescue CassandraThrift::TimedOutException => te
|
346
467
|
result.te = te
|
347
468
|
end
|
348
|
-
write_result(result, oprot, '
|
469
|
+
write_result(result, oprot, 'get_range_slices', seqid)
|
349
470
|
end
|
350
471
|
|
351
472
|
def process_insert(seqid, iprot, oprot)
|
@@ -393,6 +514,21 @@ require 'cassandra_types'
|
|
393
514
|
write_result(result, oprot, 'remove', seqid)
|
394
515
|
end
|
395
516
|
|
517
|
+
def process_batch_mutate(seqid, iprot, oprot)
|
518
|
+
args = read_args(iprot, Batch_mutate_args)
|
519
|
+
result = Batch_mutate_result.new()
|
520
|
+
begin
|
521
|
+
@handler.batch_mutate(args.keyspace, args.mutation_map, args.consistency_level)
|
522
|
+
rescue CassandraThrift::InvalidRequestException => ire
|
523
|
+
result.ire = ire
|
524
|
+
rescue CassandraThrift::UnavailableException => ue
|
525
|
+
result.ue = ue
|
526
|
+
rescue CassandraThrift::TimedOutException => te
|
527
|
+
result.te = te
|
528
|
+
end
|
529
|
+
write_result(result, oprot, 'batch_mutate', seqid)
|
530
|
+
end
|
531
|
+
|
396
532
|
def process_get_string_property(seqid, iprot, oprot)
|
397
533
|
args = read_args(iprot, Get_string_property_args)
|
398
534
|
result = Get_string_property_result.new()
|
@@ -407,6 +543,34 @@ require 'cassandra_types'
|
|
407
543
|
write_result(result, oprot, 'get_string_list_property', seqid)
|
408
544
|
end
|
409
545
|
|
546
|
+
def process_describe_keyspaces(seqid, iprot, oprot)
|
547
|
+
args = read_args(iprot, Describe_keyspaces_args)
|
548
|
+
result = Describe_keyspaces_result.new()
|
549
|
+
result.success = @handler.describe_keyspaces()
|
550
|
+
write_result(result, oprot, 'describe_keyspaces', seqid)
|
551
|
+
end
|
552
|
+
|
553
|
+
def process_describe_cluster_name(seqid, iprot, oprot)
|
554
|
+
args = read_args(iprot, Describe_cluster_name_args)
|
555
|
+
result = Describe_cluster_name_result.new()
|
556
|
+
result.success = @handler.describe_cluster_name()
|
557
|
+
write_result(result, oprot, 'describe_cluster_name', seqid)
|
558
|
+
end
|
559
|
+
|
560
|
+
def process_describe_version(seqid, iprot, oprot)
|
561
|
+
args = read_args(iprot, Describe_version_args)
|
562
|
+
result = Describe_version_result.new()
|
563
|
+
result.success = @handler.describe_version()
|
564
|
+
write_result(result, oprot, 'describe_version', seqid)
|
565
|
+
end
|
566
|
+
|
567
|
+
def process_describe_ring(seqid, iprot, oprot)
|
568
|
+
args = read_args(iprot, Describe_ring_args)
|
569
|
+
result = Describe_ring_result.new()
|
570
|
+
result.success = @handler.describe_ring(args.keyspace)
|
571
|
+
write_result(result, oprot, 'describe_ring', seqid)
|
572
|
+
end
|
573
|
+
|
410
574
|
def process_describe_keyspace(seqid, iprot, oprot)
|
411
575
|
args = read_args(iprot, Describe_keyspace_args)
|
412
576
|
result = Describe_keyspace_result.new()
|
@@ -418,10 +582,55 @@ require 'cassandra_types'
|
|
418
582
|
write_result(result, oprot, 'describe_keyspace', seqid)
|
419
583
|
end
|
420
584
|
|
585
|
+
def process_describe_splits(seqid, iprot, oprot)
|
586
|
+
args = read_args(iprot, Describe_splits_args)
|
587
|
+
result = Describe_splits_result.new()
|
588
|
+
result.success = @handler.describe_splits(args.start_token, args.end_token, args.keys_per_split)
|
589
|
+
write_result(result, oprot, 'describe_splits', seqid)
|
590
|
+
end
|
591
|
+
|
421
592
|
end
|
422
593
|
|
423
594
|
# HELPER FUNCTIONS AND STRUCTURES
|
424
595
|
|
596
|
+
class Login_args
|
597
|
+
include ::Thrift::Struct
|
598
|
+
KEYSPACE = 1
|
599
|
+
AUTH_REQUEST = 2
|
600
|
+
|
601
|
+
::Thrift::Struct.field_accessor self, :keyspace, :auth_request
|
602
|
+
FIELDS = {
|
603
|
+
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
|
604
|
+
AUTH_REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'auth_request', :class => CassandraThrift::AuthenticationRequest}
|
605
|
+
}
|
606
|
+
|
607
|
+
def struct_fields; FIELDS; end
|
608
|
+
|
609
|
+
def validate
|
610
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
611
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field auth_request is unset!') unless @auth_request
|
612
|
+
end
|
613
|
+
|
614
|
+
end
|
615
|
+
|
616
|
+
class Login_result
|
617
|
+
include ::Thrift::Struct
|
618
|
+
AUTHNX = 1
|
619
|
+
AUTHZX = 2
|
620
|
+
|
621
|
+
::Thrift::Struct.field_accessor self, :authnx, :authzx
|
622
|
+
FIELDS = {
|
623
|
+
AUTHNX => {:type => ::Thrift::Types::STRUCT, :name => 'authnx', :class => CassandraThrift::AuthenticationException},
|
624
|
+
AUTHZX => {:type => ::Thrift::Types::STRUCT, :name => 'authzx', :class => CassandraThrift::AuthorizationException}
|
625
|
+
}
|
626
|
+
|
627
|
+
def struct_fields; FIELDS; end
|
628
|
+
|
629
|
+
def validate
|
630
|
+
end
|
631
|
+
|
632
|
+
end
|
633
|
+
|
425
634
|
class Get_args
|
426
635
|
include ::Thrift::Struct
|
427
636
|
KEYSPACE = 1
|
@@ -440,6 +649,10 @@ require 'cassandra_types'
|
|
440
649
|
def struct_fields; FIELDS; end
|
441
650
|
|
442
651
|
def validate
|
652
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
653
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
654
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_path is unset!') unless @column_path
|
655
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
443
656
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
444
657
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
445
658
|
end
|
@@ -491,6 +704,11 @@ require 'cassandra_types'
|
|
491
704
|
def struct_fields; FIELDS; end
|
492
705
|
|
493
706
|
def validate
|
707
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
708
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
709
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
|
710
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field predicate is unset!') unless @predicate
|
711
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
494
712
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
495
713
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
496
714
|
end
|
@@ -538,6 +756,10 @@ require 'cassandra_types'
|
|
538
756
|
def struct_fields; FIELDS; end
|
539
757
|
|
540
758
|
def validate
|
759
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
760
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keys is unset!') unless @keys
|
761
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_path is unset!') unless @column_path
|
762
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
541
763
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
542
764
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
543
765
|
end
|
@@ -587,6 +809,11 @@ require 'cassandra_types'
|
|
587
809
|
def struct_fields; FIELDS; end
|
588
810
|
|
589
811
|
def validate
|
812
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
813
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keys is unset!') unless @keys
|
814
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
|
815
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field predicate is unset!') unless @predicate
|
816
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
590
817
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
591
818
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
592
819
|
end
|
@@ -634,6 +861,10 @@ require 'cassandra_types'
|
|
634
861
|
def struct_fields; FIELDS; end
|
635
862
|
|
636
863
|
def validate
|
864
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
865
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
866
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
|
867
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
637
868
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
638
869
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
639
870
|
end
|
@@ -663,28 +894,37 @@ require 'cassandra_types'
|
|
663
894
|
|
664
895
|
end
|
665
896
|
|
666
|
-
class
|
897
|
+
class Get_range_slice_args
|
667
898
|
include ::Thrift::Struct
|
668
899
|
KEYSPACE = 1
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
900
|
+
COLUMN_PARENT = 2
|
901
|
+
PREDICATE = 3
|
902
|
+
START_KEY = 4
|
903
|
+
FINISH_KEY = 5
|
904
|
+
ROW_COUNT = 6
|
905
|
+
CONSISTENCY_LEVEL = 7
|
674
906
|
|
675
|
-
::Thrift::Struct.field_accessor self, :keyspace, :
|
907
|
+
::Thrift::Struct.field_accessor self, :keyspace, :column_parent, :predicate, :start_key, :finish_key, :row_count, :consistency_level
|
676
908
|
FIELDS = {
|
677
909
|
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
910
|
+
COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
|
911
|
+
PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate},
|
912
|
+
START_KEY => {:type => ::Thrift::Types::STRING, :name => 'start_key', :default => %q""},
|
913
|
+
FINISH_KEY => {:type => ::Thrift::Types::STRING, :name => 'finish_key', :default => %q""},
|
914
|
+
ROW_COUNT => {:type => ::Thrift::Types::I32, :name => 'row_count', :default => 100},
|
682
915
|
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
|
683
916
|
}
|
684
917
|
|
685
918
|
def struct_fields; FIELDS; end
|
686
919
|
|
687
920
|
def validate
|
921
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
922
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
|
923
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field predicate is unset!') unless @predicate
|
924
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start_key is unset!') unless @start_key
|
925
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field finish_key is unset!') unless @finish_key
|
926
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field row_count is unset!') unless @row_count
|
927
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
688
928
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
689
929
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
690
930
|
end
|
@@ -692,7 +932,7 @@ require 'cassandra_types'
|
|
692
932
|
|
693
933
|
end
|
694
934
|
|
695
|
-
class
|
935
|
+
class Get_range_slice_result
|
696
936
|
include ::Thrift::Struct
|
697
937
|
SUCCESS = 0
|
698
938
|
IRE = 1
|
@@ -701,7 +941,7 @@ require 'cassandra_types'
|
|
701
941
|
|
702
942
|
::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te
|
703
943
|
FIELDS = {
|
704
|
-
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::
|
944
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::KeySlice}},
|
705
945
|
IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
|
706
946
|
UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException},
|
707
947
|
TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException}
|
@@ -714,30 +954,31 @@ require 'cassandra_types'
|
|
714
954
|
|
715
955
|
end
|
716
956
|
|
717
|
-
class
|
957
|
+
class Get_range_slices_args
|
718
958
|
include ::Thrift::Struct
|
719
959
|
KEYSPACE = 1
|
720
960
|
COLUMN_PARENT = 2
|
721
961
|
PREDICATE = 3
|
722
|
-
|
723
|
-
|
724
|
-
ROW_COUNT = 6
|
725
|
-
CONSISTENCY_LEVEL = 7
|
962
|
+
RANGE = 4
|
963
|
+
CONSISTENCY_LEVEL = 5
|
726
964
|
|
727
|
-
::Thrift::Struct.field_accessor self, :keyspace, :column_parent, :predicate, :
|
965
|
+
::Thrift::Struct.field_accessor self, :keyspace, :column_parent, :predicate, :range, :consistency_level
|
728
966
|
FIELDS = {
|
729
967
|
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
|
730
968
|
COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
|
731
969
|
PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate},
|
732
|
-
|
733
|
-
FINISH_KEY => {:type => ::Thrift::Types::STRING, :name => 'finish_key', :default => %q""},
|
734
|
-
ROW_COUNT => {:type => ::Thrift::Types::I32, :name => 'row_count', :default => 100},
|
970
|
+
RANGE => {:type => ::Thrift::Types::STRUCT, :name => 'range', :class => CassandraThrift::KeyRange},
|
735
971
|
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
|
736
972
|
}
|
737
973
|
|
738
974
|
def struct_fields; FIELDS; end
|
739
975
|
|
740
976
|
def validate
|
977
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
978
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
|
979
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field predicate is unset!') unless @predicate
|
980
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field range is unset!') unless @range
|
981
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
741
982
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
742
983
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
743
984
|
end
|
@@ -745,7 +986,7 @@ require 'cassandra_types'
|
|
745
986
|
|
746
987
|
end
|
747
988
|
|
748
|
-
class
|
989
|
+
class Get_range_slices_result
|
749
990
|
include ::Thrift::Struct
|
750
991
|
SUCCESS = 0
|
751
992
|
IRE = 1
|
@@ -789,6 +1030,12 @@ require 'cassandra_types'
|
|
789
1030
|
def struct_fields; FIELDS; end
|
790
1031
|
|
791
1032
|
def validate
|
1033
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
1034
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
1035
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_path is unset!') unless @column_path
|
1036
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value is unset!') unless @value
|
1037
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
|
1038
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
792
1039
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
793
1040
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
794
1041
|
end
|
@@ -834,6 +1081,10 @@ require 'cassandra_types'
|
|
834
1081
|
def struct_fields; FIELDS; end
|
835
1082
|
|
836
1083
|
def validate
|
1084
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
1085
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
1086
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field cfmap is unset!') unless @cfmap
|
1087
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
837
1088
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
838
1089
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
839
1090
|
end
|
@@ -881,6 +1132,10 @@ require 'cassandra_types'
|
|
881
1132
|
def struct_fields; FIELDS; end
|
882
1133
|
|
883
1134
|
def validate
|
1135
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
1136
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
|
1137
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_path is unset!') unless @column_path
|
1138
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
|
884
1139
|
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
885
1140
|
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
886
1141
|
end
|
@@ -908,6 +1163,52 @@ require 'cassandra_types'
|
|
908
1163
|
|
909
1164
|
end
|
910
1165
|
|
1166
|
+
class Batch_mutate_args
|
1167
|
+
include ::Thrift::Struct
|
1168
|
+
KEYSPACE = 1
|
1169
|
+
MUTATION_MAP = 2
|
1170
|
+
CONSISTENCY_LEVEL = 3
|
1171
|
+
|
1172
|
+
::Thrift::Struct.field_accessor self, :keyspace, :mutation_map, :consistency_level
|
1173
|
+
FIELDS = {
|
1174
|
+
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
|
1175
|
+
MUTATION_MAP => {:type => ::Thrift::Types::MAP, :name => 'mutation_map', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::Mutation}}}},
|
1176
|
+
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 0, :enum_class => CassandraThrift::ConsistencyLevel}
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
def struct_fields; FIELDS; end
|
1180
|
+
|
1181
|
+
def validate
|
1182
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
1183
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field mutation_map is unset!') unless @mutation_map
|
1184
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field consistency_level is unset!') unless @consistency_level
|
1185
|
+
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
|
1186
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
|
1187
|
+
end
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
class Batch_mutate_result
|
1193
|
+
include ::Thrift::Struct
|
1194
|
+
IRE = 1
|
1195
|
+
UE = 2
|
1196
|
+
TE = 3
|
1197
|
+
|
1198
|
+
::Thrift::Struct.field_accessor self, :ire, :ue, :te
|
1199
|
+
FIELDS = {
|
1200
|
+
IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException},
|
1201
|
+
UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException},
|
1202
|
+
TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException}
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
def struct_fields; FIELDS; end
|
1206
|
+
|
1207
|
+
def validate
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
end
|
1211
|
+
|
911
1212
|
class Get_string_property_args
|
912
1213
|
include ::Thrift::Struct
|
913
1214
|
PROPERTY = 1
|
@@ -920,6 +1221,7 @@ require 'cassandra_types'
|
|
920
1221
|
def struct_fields; FIELDS; end
|
921
1222
|
|
922
1223
|
def validate
|
1224
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field property is unset!') unless @property
|
923
1225
|
end
|
924
1226
|
|
925
1227
|
end
|
@@ -952,6 +1254,7 @@ require 'cassandra_types'
|
|
952
1254
|
def struct_fields; FIELDS; end
|
953
1255
|
|
954
1256
|
def validate
|
1257
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field property is unset!') unless @property
|
955
1258
|
end
|
956
1259
|
|
957
1260
|
end
|
@@ -972,6 +1275,129 @@ require 'cassandra_types'
|
|
972
1275
|
|
973
1276
|
end
|
974
1277
|
|
1278
|
+
class Describe_keyspaces_args
|
1279
|
+
include ::Thrift::Struct
|
1280
|
+
|
1281
|
+
FIELDS = {
|
1282
|
+
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
def struct_fields; FIELDS; end
|
1286
|
+
|
1287
|
+
def validate
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
class Describe_keyspaces_result
|
1293
|
+
include ::Thrift::Struct
|
1294
|
+
SUCCESS = 0
|
1295
|
+
|
1296
|
+
::Thrift::Struct.field_accessor self, :success
|
1297
|
+
FIELDS = {
|
1298
|
+
SUCCESS => {:type => ::Thrift::Types::SET, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
def struct_fields; FIELDS; end
|
1302
|
+
|
1303
|
+
def validate
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
end
|
1307
|
+
|
1308
|
+
class Describe_cluster_name_args
|
1309
|
+
include ::Thrift::Struct
|
1310
|
+
|
1311
|
+
FIELDS = {
|
1312
|
+
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
def struct_fields; FIELDS; end
|
1316
|
+
|
1317
|
+
def validate
|
1318
|
+
end
|
1319
|
+
|
1320
|
+
end
|
1321
|
+
|
1322
|
+
class Describe_cluster_name_result
|
1323
|
+
include ::Thrift::Struct
|
1324
|
+
SUCCESS = 0
|
1325
|
+
|
1326
|
+
::Thrift::Struct.field_accessor self, :success
|
1327
|
+
FIELDS = {
|
1328
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
def struct_fields; FIELDS; end
|
1332
|
+
|
1333
|
+
def validate
|
1334
|
+
end
|
1335
|
+
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
class Describe_version_args
|
1339
|
+
include ::Thrift::Struct
|
1340
|
+
|
1341
|
+
FIELDS = {
|
1342
|
+
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
def struct_fields; FIELDS; end
|
1346
|
+
|
1347
|
+
def validate
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
class Describe_version_result
|
1353
|
+
include ::Thrift::Struct
|
1354
|
+
SUCCESS = 0
|
1355
|
+
|
1356
|
+
::Thrift::Struct.field_accessor self, :success
|
1357
|
+
FIELDS = {
|
1358
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
def struct_fields; FIELDS; end
|
1362
|
+
|
1363
|
+
def validate
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
class Describe_ring_args
|
1369
|
+
include ::Thrift::Struct
|
1370
|
+
KEYSPACE = 1
|
1371
|
+
|
1372
|
+
::Thrift::Struct.field_accessor self, :keyspace
|
1373
|
+
FIELDS = {
|
1374
|
+
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'}
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
def struct_fields; FIELDS; end
|
1378
|
+
|
1379
|
+
def validate
|
1380
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
end
|
1384
|
+
|
1385
|
+
class Describe_ring_result
|
1386
|
+
include ::Thrift::Struct
|
1387
|
+
SUCCESS = 0
|
1388
|
+
|
1389
|
+
::Thrift::Struct.field_accessor self, :success
|
1390
|
+
FIELDS = {
|
1391
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::TokenRange}}
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
def struct_fields; FIELDS; end
|
1395
|
+
|
1396
|
+
def validate
|
1397
|
+
end
|
1398
|
+
|
1399
|
+
end
|
1400
|
+
|
975
1401
|
class Describe_keyspace_args
|
976
1402
|
include ::Thrift::Struct
|
977
1403
|
KEYSPACE = 1
|
@@ -984,6 +1410,7 @@ require 'cassandra_types'
|
|
984
1410
|
def struct_fields; FIELDS; end
|
985
1411
|
|
986
1412
|
def validate
|
1413
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
|
987
1414
|
end
|
988
1415
|
|
989
1416
|
end
|
@@ -1006,6 +1433,45 @@ require 'cassandra_types'
|
|
1006
1433
|
|
1007
1434
|
end
|
1008
1435
|
|
1436
|
+
class Describe_splits_args
|
1437
|
+
include ::Thrift::Struct
|
1438
|
+
START_TOKEN = 1
|
1439
|
+
END_TOKEN = 2
|
1440
|
+
KEYS_PER_SPLIT = 3
|
1441
|
+
|
1442
|
+
::Thrift::Struct.field_accessor self, :start_token, :end_token, :keys_per_split
|
1443
|
+
FIELDS = {
|
1444
|
+
START_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'start_token'},
|
1445
|
+
END_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'end_token'},
|
1446
|
+
KEYS_PER_SPLIT => {:type => ::Thrift::Types::I32, :name => 'keys_per_split'}
|
1447
|
+
}
|
1448
|
+
|
1449
|
+
def struct_fields; FIELDS; end
|
1450
|
+
|
1451
|
+
def validate
|
1452
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start_token is unset!') unless @start_token
|
1453
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field end_token is unset!') unless @end_token
|
1454
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keys_per_split is unset!') unless @keys_per_split
|
1455
|
+
end
|
1456
|
+
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
class Describe_splits_result
|
1460
|
+
include ::Thrift::Struct
|
1461
|
+
SUCCESS = 0
|
1462
|
+
|
1463
|
+
::Thrift::Struct.field_accessor self, :success
|
1464
|
+
FIELDS = {
|
1465
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
def struct_fields; FIELDS; end
|
1469
|
+
|
1470
|
+
def validate
|
1471
|
+
end
|
1472
|
+
|
1473
|
+
end
|
1474
|
+
|
1009
1475
|
end
|
1010
1476
|
|
1011
1477
|
end
|