cassandra-driver 2.1.7-java → 3.0.0.beta.1-java
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.
- checksums.yaml +4 -4
- data/README.md +31 -53
- data/lib/cassandra.rb +22 -3
- data/lib/cassandra/aggregate.rb +109 -0
- data/lib/cassandra/argument.rb +51 -0
- data/lib/cassandra/auth/providers/password.rb +7 -4
- data/lib/cassandra/cluster.rb +14 -3
- data/lib/cassandra/cluster/client.rb +56 -34
- data/lib/cassandra/cluster/connector.rb +6 -6
- data/lib/cassandra/cluster/control_connection.rb +204 -251
- data/lib/cassandra/cluster/metadata.rb +2 -0
- data/lib/cassandra/cluster/schema.rb +131 -209
- data/lib/cassandra/cluster/schema/cql_type_parser.rb +104 -0
- data/lib/cassandra/cluster/schema/fetchers.rb +1174 -0
- data/lib/cassandra/cluster/schema/{type_parser.rb → fqcn_type_parser.rb} +7 -3
- data/lib/cassandra/column.rb +2 -2
- data/lib/cassandra/driver.rb +27 -9
- data/lib/cassandra/errors.rb +179 -25
- data/lib/cassandra/execution/info.rb +8 -1
- data/lib/cassandra/execution/options.rb +34 -0
- data/lib/cassandra/execution/trace.rb +42 -10
- data/lib/cassandra/function.rb +150 -0
- data/lib/cassandra/future.rb +66 -35
- data/lib/cassandra/host.rb +7 -4
- data/lib/cassandra/keyspace.rb +112 -13
- data/lib/cassandra/load_balancing.rb +1 -1
- data/lib/cassandra/protocol.rb +9 -3
- data/lib/cassandra/protocol/coder.rb +434 -155
- data/lib/cassandra/protocol/cql_byte_buffer.rb +43 -0
- data/lib/cassandra/protocol/cql_protocol_handler.rb +4 -1
- data/lib/cassandra/protocol/request.rb +4 -0
- data/lib/cassandra/protocol/requests/auth_response_request.rb +5 -1
- data/lib/cassandra/protocol/requests/batch_request.rb +7 -2
- data/lib/cassandra/protocol/requests/credentials_request.rb +5 -1
- data/lib/cassandra/protocol/requests/execute_request.rb +16 -10
- data/lib/cassandra/protocol/requests/prepare_request.rb +12 -3
- data/lib/cassandra/protocol/requests/query_request.rb +20 -11
- data/lib/cassandra/protocol/responses/already_exists_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/error_response.rb +14 -14
- data/lib/cassandra/protocol/responses/function_failure_error_response.rb +41 -0
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +12 -9
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +5 -3
- data/lib/cassandra/protocol/responses/read_failure_error_response.rb +43 -0
- data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/ready_response.rb +5 -1
- data/lib/cassandra/protocol/responses/result_response.rb +3 -3
- data/lib/cassandra/protocol/responses/rows_result_response.rb +2 -2
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +25 -24
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +20 -23
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +2 -2
- data/lib/cassandra/protocol/responses/unavailable_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/unprepared_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/write_failure_error_response.rb +45 -0
- data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +4 -4
- data/lib/cassandra/protocol/v1.rb +38 -13
- data/lib/cassandra/protocol/v3.rb +34 -29
- data/lib/cassandra/protocol/v4.rb +334 -0
- data/lib/cassandra/result.rb +10 -9
- data/lib/cassandra/retry.rb +17 -3
- data/lib/cassandra/retry/policies/default.rb +9 -3
- data/lib/cassandra/session.rb +15 -7
- data/lib/cassandra/statement.rb +5 -0
- data/lib/cassandra/statements/batch.rb +36 -12
- data/lib/cassandra/statements/bound.rb +2 -1
- data/lib/cassandra/statements/prepared.rb +106 -35
- data/lib/cassandra/statements/simple.rb +4 -2
- data/lib/cassandra/table.rb +70 -105
- data/lib/cassandra/time.rb +98 -0
- data/lib/cassandra/time_uuid.rb +1 -1
- data/lib/cassandra/tuple.rb +7 -0
- data/lib/cassandra/types.rb +472 -272
- data/lib/cassandra/udt.rb +10 -0
- data/lib/cassandra/util.rb +32 -1
- data/lib/cassandra/uuid.rb +6 -1
- data/lib/cassandra/uuid/generator.rb +7 -7
- data/lib/cassandra/version.rb +1 -1
- data/lib/cassandra_murmur3.jar +0 -0
- data/lib/datastax/cassandra.rb +5 -2
- metadata +27 -17
data/lib/cassandra/udt.rb
CHANGED
@@ -408,13 +408,23 @@ module Cassandra
|
|
408
408
|
'{ ' + @values.map {|(n, v)| "#{n}: #{v.inspect}"}.join(', ') + ' }'
|
409
409
|
end
|
410
410
|
|
411
|
+
# @private
|
411
412
|
def inspect
|
412
413
|
"#<Cassandra::UDT:0x#{self.object_id.to_s(16)} #{to_s}>"
|
413
414
|
end
|
414
415
|
|
416
|
+
# @private
|
415
417
|
def eql?(other)
|
416
418
|
other.is_a?(UDT) && @values.all? {|(n, v)| v == other[n]}
|
417
419
|
end
|
418
420
|
alias :== :eql?
|
421
|
+
|
422
|
+
# @private
|
423
|
+
def hash
|
424
|
+
@values.inject(17) do |h, (n, v)|
|
425
|
+
h = 31 * h + n.hash
|
426
|
+
h = 31 * h + v.hash
|
427
|
+
end
|
428
|
+
end
|
419
429
|
end
|
420
430
|
end
|
data/lib/cassandra/util.rb
CHANGED
@@ -99,6 +99,9 @@ module Cassandra
|
|
99
99
|
when ::Numeric then encode_number(object, io)
|
100
100
|
when ::IPAddr then encode_inet(object, io)
|
101
101
|
when Uuid then encode_uuid(object, io)
|
102
|
+
when Tuple then encode_tuple(object, io)
|
103
|
+
when Time then encode_time(object, io)
|
104
|
+
when UDT then encode_udt(object, io)
|
102
105
|
when nil then io.print(NULL_STR)
|
103
106
|
when false then io.print(FALSE_STR)
|
104
107
|
when true then io.print(TRUE_STR)
|
@@ -110,6 +113,14 @@ module Cassandra
|
|
110
113
|
end
|
111
114
|
alias :encode :encode_object
|
112
115
|
|
116
|
+
def encode_time(time, io = StringIO.new)
|
117
|
+
encode_string(time.to_s, io)
|
118
|
+
end
|
119
|
+
|
120
|
+
def encode_udt(udt, io = StringIO.new)
|
121
|
+
encode_hash(udt.to_h, io)
|
122
|
+
end
|
123
|
+
|
113
124
|
def encode_timestamp(time, io = StringIO.new)
|
114
125
|
io.print(time.to_i)
|
115
126
|
io.string
|
@@ -132,6 +143,22 @@ module Cassandra
|
|
132
143
|
io.string
|
133
144
|
end
|
134
145
|
|
146
|
+
def encode_tuple(tuple, io = StringIO.new)
|
147
|
+
first = true
|
148
|
+
|
149
|
+
io.putc(PRN_OPN)
|
150
|
+
tuple.each do |object|
|
151
|
+
if first
|
152
|
+
first = false
|
153
|
+
else
|
154
|
+
io.print(COMMA)
|
155
|
+
end
|
156
|
+
|
157
|
+
encode_object(object, io)
|
158
|
+
end
|
159
|
+
io.putc(PRN_CLS)
|
160
|
+
end
|
161
|
+
|
135
162
|
def escape_name(name)
|
136
163
|
return name if name[LOWERCASE_REGEXP] == name
|
137
164
|
DBL_QUOT + name + DBL_QUOT
|
@@ -282,12 +309,16 @@ module Cassandra
|
|
282
309
|
# @private
|
283
310
|
COMMA = ', '.freeze
|
284
311
|
# @private
|
285
|
-
COLON = '
|
312
|
+
COLON = ': '.freeze
|
286
313
|
# @private
|
287
314
|
QUOT = ?'.freeze
|
288
315
|
# @private
|
289
316
|
ESC_QUOT = "''".freeze
|
290
317
|
# @private
|
291
318
|
DBL_QUOT = ?".freeze
|
319
|
+
# @private
|
320
|
+
PRN_OPN = '('.freeze
|
321
|
+
# @private
|
322
|
+
PRN_CLS = ')'.freeze
|
292
323
|
end
|
293
324
|
end
|
data/lib/cassandra/uuid.rb
CHANGED
@@ -44,7 +44,7 @@ module Cassandra
|
|
44
44
|
# @param [Object<#now>] clock used to generate timeuuid from current time
|
45
45
|
#
|
46
46
|
# @raise [ArgumentError] if clock doesn't respond to `now`
|
47
|
-
def initialize(node_id = (SecureRandom.random_number(2**47) | 0x010000000000), clock_id = SecureRandom.random_number(65536), clock = Time)
|
47
|
+
def initialize(node_id = (::SecureRandom.random_number(2**47) | 0x010000000000), clock_id = ::SecureRandom.random_number(65536), clock = ::Time)
|
48
48
|
raise ::ArgumentError, "invalid clock" unless clock.respond_to?(:now)
|
49
49
|
|
50
50
|
@node_id = Integer(node_id)
|
@@ -84,7 +84,7 @@ module Cassandra
|
|
84
84
|
@sequence += 1
|
85
85
|
elsif @last_usecs && @last_usecs > usecs
|
86
86
|
@sequence = 0
|
87
|
-
@clock_id = SecureRandom.random_number(65536)
|
87
|
+
@clock_id = ::SecureRandom.random_number(65536)
|
88
88
|
else
|
89
89
|
@sequence = 0
|
90
90
|
end
|
@@ -153,12 +153,12 @@ module Cassandra
|
|
153
153
|
raise ::ArgumentError, "not enough arguments" if args.empty?
|
154
154
|
raise ::ArgumentError, "too many arguments" if args.size > 3
|
155
155
|
|
156
|
-
if args.first.is_a?(Time)
|
156
|
+
if args.first.is_a?(::Time)
|
157
157
|
time = args.shift
|
158
|
-
jitter = args.empty? ? SecureRandom.random_number(65536) : Integer(args.shift)
|
158
|
+
jitter = args.empty? ? ::SecureRandom.random_number(65536) : Integer(args.shift)
|
159
159
|
else
|
160
|
-
jitter = args.size > 2 ? Integer(args.pop) : SecureRandom.random_number(65536)
|
161
|
-
time = Time.at(*args)
|
160
|
+
jitter = args.size > 2 ? Integer(args.pop) : ::SecureRandom.random_number(65536)
|
161
|
+
time = ::Time.at(*args)
|
162
162
|
end
|
163
163
|
|
164
164
|
from_usecs(time.to_i * 1_000_000 + time.usec + jitter)
|
@@ -179,7 +179,7 @@ module Cassandra
|
|
179
179
|
#
|
180
180
|
# @return [Cassandra::Uuid] a new UUID
|
181
181
|
def uuid
|
182
|
-
Uuid.new(SecureRandom.uuid)
|
182
|
+
Uuid.new(::SecureRandom.uuid)
|
183
183
|
end
|
184
184
|
|
185
185
|
private
|
data/lib/cassandra/version.rb
CHANGED
data/lib/cassandra_murmur3.jar
CHANGED
Binary file
|
data/lib/datastax/cassandra.rb
CHANGED
@@ -33,12 +33,15 @@ module DataStax
|
|
33
33
|
end
|
34
34
|
|
35
35
|
previous = nil
|
36
|
+
murmur3 = nil
|
36
37
|
if defined?(::Cassandra)
|
37
38
|
previous = ::Cassandra
|
39
|
+
murmur3 = ::Cassandra::Murmur3
|
38
40
|
Object.send(:remove_const, :Cassandra)
|
39
41
|
end
|
40
42
|
include 'cassandra'
|
41
|
-
|
42
|
-
|
43
|
+
murmur3 ||= ::Cassandra::Murmur3
|
44
|
+
DataStax::Cassandra::Murmur3 = murmur3
|
45
|
+
Object.send(:remove_const, :Cassandra) if defined?(::Cassandra)
|
43
46
|
::Cassandra = previous if previous
|
44
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandra-driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.2'
|
20
20
|
name: ione
|
@@ -22,13 +22,13 @@ dependencies:
|
|
22
22
|
type: :runtime
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
name: bundler
|
@@ -36,13 +36,13 @@ dependencies:
|
|
36
36
|
type: :development
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.6'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
name: rake
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
type: :development
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '10.0'
|
56
56
|
description: A pure Ruby driver for Apache Cassandra
|
@@ -62,13 +62,15 @@ extensions: []
|
|
62
62
|
extra_rdoc_files:
|
63
63
|
- README.md
|
64
64
|
files:
|
65
|
-
-
|
65
|
+
- .yardopts
|
66
66
|
- README.md
|
67
67
|
- lib/cassandra.rb
|
68
68
|
- lib/cassandra/address_resolution.rb
|
69
69
|
- lib/cassandra/address_resolution/policies.rb
|
70
70
|
- lib/cassandra/address_resolution/policies/ec2_multi_region.rb
|
71
71
|
- lib/cassandra/address_resolution/policies/none.rb
|
72
|
+
- lib/cassandra/aggregate.rb
|
73
|
+
- lib/cassandra/argument.rb
|
72
74
|
- lib/cassandra/auth.rb
|
73
75
|
- lib/cassandra/auth/providers.rb
|
74
76
|
- lib/cassandra/auth/providers/password.rb
|
@@ -82,6 +84,9 @@ files:
|
|
82
84
|
- lib/cassandra/cluster/options.rb
|
83
85
|
- lib/cassandra/cluster/registry.rb
|
84
86
|
- lib/cassandra/cluster/schema.rb
|
87
|
+
- lib/cassandra/cluster/schema/cql_type_parser.rb
|
88
|
+
- lib/cassandra/cluster/schema/fetchers.rb
|
89
|
+
- lib/cassandra/cluster/schema/fqcn_type_parser.rb
|
85
90
|
- lib/cassandra/cluster/schema/partitioners.rb
|
86
91
|
- lib/cassandra/cluster/schema/partitioners/murmur3.rb
|
87
92
|
- lib/cassandra/cluster/schema/partitioners/ordered.rb
|
@@ -90,7 +95,6 @@ files:
|
|
90
95
|
- lib/cassandra/cluster/schema/replication_strategies/network_topology.rb
|
91
96
|
- lib/cassandra/cluster/schema/replication_strategies/none.rb
|
92
97
|
- lib/cassandra/cluster/schema/replication_strategies/simple.rb
|
93
|
-
- lib/cassandra/cluster/schema/type_parser.rb
|
94
98
|
- lib/cassandra/column.rb
|
95
99
|
- lib/cassandra/compression.rb
|
96
100
|
- lib/cassandra/compression/compressors/lz4.rb
|
@@ -101,6 +105,7 @@ files:
|
|
101
105
|
- lib/cassandra/execution/options.rb
|
102
106
|
- lib/cassandra/execution/trace.rb
|
103
107
|
- lib/cassandra/executors.rb
|
108
|
+
- lib/cassandra/function.rb
|
104
109
|
- lib/cassandra/future.rb
|
105
110
|
- lib/cassandra/host.rb
|
106
111
|
- lib/cassandra/keyspace.rb
|
@@ -134,8 +139,10 @@ files:
|
|
134
139
|
- lib/cassandra/protocol/responses/authenticate_response.rb
|
135
140
|
- lib/cassandra/protocol/responses/error_response.rb
|
136
141
|
- lib/cassandra/protocol/responses/event_response.rb
|
142
|
+
- lib/cassandra/protocol/responses/function_failure_error_response.rb
|
137
143
|
- lib/cassandra/protocol/responses/prepared_result_response.rb
|
138
144
|
- lib/cassandra/protocol/responses/raw_rows_result_response.rb
|
145
|
+
- lib/cassandra/protocol/responses/read_failure_error_response.rb
|
139
146
|
- lib/cassandra/protocol/responses/read_timeout_error_response.rb
|
140
147
|
- lib/cassandra/protocol/responses/ready_response.rb
|
141
148
|
- lib/cassandra/protocol/responses/result_response.rb
|
@@ -149,9 +156,11 @@ files:
|
|
149
156
|
- lib/cassandra/protocol/responses/unavailable_error_response.rb
|
150
157
|
- lib/cassandra/protocol/responses/unprepared_error_response.rb
|
151
158
|
- lib/cassandra/protocol/responses/void_result_response.rb
|
159
|
+
- lib/cassandra/protocol/responses/write_failure_error_response.rb
|
152
160
|
- lib/cassandra/protocol/responses/write_timeout_error_response.rb
|
153
161
|
- lib/cassandra/protocol/v1.rb
|
154
162
|
- lib/cassandra/protocol/v3.rb
|
163
|
+
- lib/cassandra/protocol/v4.rb
|
155
164
|
- lib/cassandra/reconnection.rb
|
156
165
|
- lib/cassandra/reconnection/policies.rb
|
157
166
|
- lib/cassandra/reconnection/policies/constant.rb
|
@@ -171,6 +180,7 @@ files:
|
|
171
180
|
- lib/cassandra/statements/simple.rb
|
172
181
|
- lib/cassandra/statements/void.rb
|
173
182
|
- lib/cassandra/table.rb
|
183
|
+
- lib/cassandra/time.rb
|
174
184
|
- lib/cassandra/time_uuid.rb
|
175
185
|
- lib/cassandra/tuple.rb
|
176
186
|
- lib/cassandra/types.rb
|
@@ -187,26 +197,26 @@ licenses:
|
|
187
197
|
metadata: {}
|
188
198
|
post_install_message:
|
189
199
|
rdoc_options:
|
190
|
-
-
|
200
|
+
- --title
|
191
201
|
- Datastax Ruby Driver
|
192
|
-
-
|
202
|
+
- --main
|
193
203
|
- README.md
|
194
|
-
-
|
204
|
+
- --line-numbers
|
195
205
|
require_paths:
|
196
206
|
- lib
|
197
207
|
required_ruby_version: !ruby/object:Gem::Requirement
|
198
208
|
requirements:
|
199
|
-
- -
|
209
|
+
- - '>='
|
200
210
|
- !ruby/object:Gem::Version
|
201
211
|
version: 1.9.3
|
202
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
213
|
requirements:
|
204
|
-
- -
|
214
|
+
- - '>'
|
205
215
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
216
|
+
version: 1.3.1
|
207
217
|
requirements: []
|
208
218
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.4.
|
219
|
+
rubygems_version: 2.4.5
|
210
220
|
signing_key:
|
211
221
|
specification_version: 4
|
212
222
|
summary: Datastax Ruby Driver for Apache Cassandra
|