cassandra-driver 3.0.0.beta.1 → 3.0.0.rc.1

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.
Files changed (131) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +90 -38
  3. data/ext/cassandra_murmur3/cassandra_murmur3.c +1 -1
  4. data/lib/cassandra.rb +327 -130
  5. data/lib/cassandra/address_resolution.rb +1 -1
  6. data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
  7. data/lib/cassandra/address_resolution/policies/none.rb +1 -1
  8. data/lib/cassandra/aggregate.rb +21 -7
  9. data/lib/cassandra/argument.rb +2 -2
  10. data/lib/cassandra/auth.rb +4 -4
  11. data/lib/cassandra/auth/providers.rb +1 -1
  12. data/lib/cassandra/auth/providers/password.rb +9 -5
  13. data/lib/cassandra/cassandra_logger.rb +80 -0
  14. data/lib/cassandra/cluster.rb +38 -9
  15. data/lib/cassandra/cluster/client.rb +801 -205
  16. data/lib/cassandra/cluster/connection_pool.rb +2 -2
  17. data/lib/cassandra/cluster/connector.rb +74 -25
  18. data/lib/cassandra/cluster/control_connection.rb +217 -82
  19. data/lib/cassandra/cluster/failed_connection.rb +1 -1
  20. data/lib/cassandra/cluster/metadata.rb +12 -4
  21. data/lib/cassandra/cluster/options.rb +60 -11
  22. data/lib/cassandra/cluster/registry.rb +69 -16
  23. data/lib/cassandra/cluster/schema.rb +25 -7
  24. data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
  25. data/lib/cassandra/cluster/schema/fetchers.rb +263 -106
  26. data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +41 -36
  27. data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
  28. data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +3 -3
  29. data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
  30. data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
  31. data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
  32. data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +19 -18
  33. data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
  34. data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
  35. data/lib/cassandra/column.rb +3 -3
  36. data/lib/cassandra/compression.rb +1 -1
  37. data/lib/cassandra/compression/compressors/lz4.rb +4 -3
  38. data/lib/cassandra/compression/compressors/snappy.rb +4 -3
  39. data/lib/cassandra/driver.rb +103 -41
  40. data/lib/cassandra/errors.rb +265 -30
  41. data/lib/cassandra/execution/info.rb +16 -5
  42. data/lib/cassandra/execution/options.rb +99 -54
  43. data/lib/cassandra/execution/trace.rb +16 -9
  44. data/lib/cassandra/executors.rb +1 -1
  45. data/lib/cassandra/function.rb +19 -13
  46. data/lib/cassandra/function_collection.rb +85 -0
  47. data/lib/cassandra/future.rb +106 -48
  48. data/lib/cassandra/host.rb +10 -4
  49. data/lib/cassandra/keyspace.rb +90 -33
  50. data/lib/cassandra/listener.rb +1 -1
  51. data/lib/cassandra/load_balancing.rb +2 -2
  52. data/lib/cassandra/load_balancing/policies.rb +1 -1
  53. data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +18 -18
  54. data/lib/cassandra/load_balancing/policies/round_robin.rb +1 -1
  55. data/lib/cassandra/load_balancing/policies/token_aware.rb +15 -13
  56. data/lib/cassandra/load_balancing/policies/white_list.rb +11 -5
  57. data/lib/cassandra/null_logger.rb +27 -6
  58. data/lib/cassandra/protocol.rb +1 -1
  59. data/lib/cassandra/protocol/coder.rb +78 -39
  60. data/lib/cassandra/protocol/cql_byte_buffer.rb +50 -33
  61. data/lib/cassandra/protocol/cql_protocol_handler.rb +44 -45
  62. data/lib/cassandra/protocol/request.rb +2 -2
  63. data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
  64. data/lib/cassandra/protocol/requests/batch_request.rb +16 -7
  65. data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
  66. data/lib/cassandra/protocol/requests/execute_request.rb +41 -20
  67. data/lib/cassandra/protocol/requests/options_request.rb +1 -1
  68. data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
  69. data/lib/cassandra/protocol/requests/query_request.rb +27 -22
  70. data/lib/cassandra/protocol/requests/register_request.rb +2 -2
  71. data/lib/cassandra/protocol/requests/startup_request.rb +6 -4
  72. data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
  73. data/lib/cassandra/protocol/response.rb +2 -2
  74. data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
  75. data/lib/cassandra/protocol/responses/auth_challenge_response.rb +1 -1
  76. data/lib/cassandra/protocol/responses/auth_success_response.rb +1 -1
  77. data/lib/cassandra/protocol/responses/authenticate_response.rb +1 -1
  78. data/lib/cassandra/protocol/responses/error_response.rb +101 -13
  79. data/lib/cassandra/protocol/responses/event_response.rb +1 -1
  80. data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
  81. data/lib/cassandra/protocol/responses/prepared_result_response.rb +11 -5
  82. data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
  83. data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
  84. data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
  85. data/lib/cassandra/protocol/responses/ready_response.rb +3 -3
  86. data/lib/cassandra/protocol/responses/result_response.rb +4 -2
  87. data/lib/cassandra/protocol/responses/rows_result_response.rb +5 -3
  88. data/lib/cassandra/protocol/responses/schema_change_event_response.rb +5 -4
  89. data/lib/cassandra/protocol/responses/schema_change_result_response.rb +16 -9
  90. data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +2 -2
  91. data/lib/cassandra/protocol/responses/status_change_event_response.rb +2 -2
  92. data/lib/cassandra/protocol/responses/supported_response.rb +1 -1
  93. data/lib/cassandra/protocol/responses/topology_change_event_response.rb +1 -1
  94. data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
  95. data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
  96. data/lib/cassandra/protocol/responses/void_result_response.rb +1 -1
  97. data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
  98. data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
  99. data/lib/cassandra/protocol/v1.rb +101 -36
  100. data/lib/cassandra/protocol/v3.rb +124 -51
  101. data/lib/cassandra/protocol/v4.rb +172 -68
  102. data/lib/cassandra/reconnection.rb +1 -1
  103. data/lib/cassandra/reconnection/policies.rb +1 -1
  104. data/lib/cassandra/reconnection/policies/constant.rb +2 -4
  105. data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
  106. data/lib/cassandra/result.rb +53 -19
  107. data/lib/cassandra/retry.rb +8 -8
  108. data/lib/cassandra/retry/policies.rb +1 -1
  109. data/lib/cassandra/retry/policies/default.rb +1 -1
  110. data/lib/cassandra/retry/policies/downgrading_consistency.rb +7 -3
  111. data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
  112. data/lib/cassandra/session.rb +22 -16
  113. data/lib/cassandra/statement.rb +1 -1
  114. data/lib/cassandra/statements.rb +1 -1
  115. data/lib/cassandra/statements/batch.rb +16 -10
  116. data/lib/cassandra/statements/bound.rb +10 -3
  117. data/lib/cassandra/statements/prepared.rb +59 -15
  118. data/lib/cassandra/statements/simple.rb +23 -10
  119. data/lib/cassandra/statements/void.rb +1 -1
  120. data/lib/cassandra/table.rb +79 -30
  121. data/lib/cassandra/time.rb +11 -6
  122. data/lib/cassandra/time_uuid.rb +7 -7
  123. data/lib/cassandra/tuple.rb +16 -8
  124. data/lib/cassandra/types.rb +20 -9
  125. data/lib/cassandra/udt.rb +32 -36
  126. data/lib/cassandra/util.rb +20 -13
  127. data/lib/cassandra/uuid.rb +22 -15
  128. data/lib/cassandra/uuid/generator.rb +7 -5
  129. data/lib/cassandra/version.rb +2 -2
  130. data/lib/datastax/cassandra.rb +1 -1
  131. metadata +5 -3
data/lib/cassandra/udt.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ module Cassandra
38
38
  assign = !field.chomp!('=').nil?
39
39
 
40
40
  return super if assign && args.empty?
41
- return super unless @name_to_type.has_key?(field)
41
+ return super unless @name_to_type.key?(field)
42
42
 
43
43
  if assign
44
44
  value = args.first
@@ -58,7 +58,7 @@ module Cassandra
58
58
  field = method.to_s
59
59
  field.chomp!('=')
60
60
 
61
- return true if @name_to_type.has_key?(field)
61
+ return true if @name_to_type.key?(field)
62
62
  super
63
63
  end
64
64
 
@@ -94,15 +94,15 @@ module Cassandra
94
94
  when ::Integer
95
95
  if field < 0 || field >= @fields.size
96
96
  raise ::IndexError,
97
- "field index #{field} is not present in UDT: " \
98
- "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
97
+ "field index #{field} is not present in UDT: " \
98
+ "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
99
99
  end
100
100
  @values[@fields[field][0]]
101
101
  when ::String
102
- unless @name_to_type.has_key?(field)
102
+ unless @name_to_type.key?(field)
103
103
  raise ::KeyError,
104
- "field #{field} is not defined in UDT: " \
105
- "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
104
+ "field #{field} is not defined in UDT: " \
105
+ "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
106
106
  end
107
107
  @values[field]
108
108
  else
@@ -127,16 +127,16 @@ module Cassandra
127
127
  when ::Integer
128
128
  if field < 0 || field >= @fields.size
129
129
  raise ::IndexError,
130
- "field index #{field} is not present in UDT: " \
131
- "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
130
+ "field index #{field} is not present in UDT: " \
131
+ "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
132
132
  end
133
133
  Util.assert_type(@fields[field][1], value)
134
134
  @values[@fields[field][0]] = value
135
135
  when ::String
136
- unless @name_to_type.has_key?(field)
136
+ unless @name_to_type.key?(field)
137
137
  raise ::KeyError,
138
- "field #{field} is not defined in UDT: " \
139
- "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
138
+ "field #{field} is not defined in UDT: " \
139
+ "#{Util.escape_name(@keyspace)}.#{Util.escape_name(@name)}"
140
140
  end
141
141
  Util.assert_type(@name_to_type[field], value)
142
142
  @values[field] = value
@@ -165,14 +165,14 @@ module Cassandra
165
165
  end
166
166
 
167
167
  def inspect
168
- "#<Cassandra::UDT:0x#{self.object_id.to_s(16)} #{to_s}>"
168
+ "#<Cassandra::UDT:0x#{object_id.to_s(16)} #{self}>"
169
169
  end
170
170
 
171
171
  def eql?(other)
172
172
  (other.is_a?(Strict) && @values.all? {|n, v| v == other[n]}) ||
173
- (other.is_a?(UDT) && other == self)
173
+ (other.is_a?(UDT) && other == self)
174
174
  end
175
- alias :== :eql?
175
+ alias == eql?
176
176
  end
177
177
 
178
178
  include Enumerable
@@ -200,24 +200,24 @@ module Cassandra
200
200
  values = Array(values.first) if values.one?
201
201
 
202
202
  Util.assert_not_empty(values,
203
- "user-defined type must contain at least one value"
204
- )
203
+ 'user-defined type must contain at least one value'
204
+ )
205
205
 
206
206
  if values.first.is_a?(::Array)
207
207
  @values = values.map do |pair|
208
208
  Util.assert(pair.size == 2,
209
- "values of a user-defined type must be an Array of name and " \
210
- "value pairs, #{pair.inspect} given"
211
- )
209
+ 'values of a user-defined type must be an Array of name and ' \
210
+ "value pairs, #{pair.inspect} given"
211
+ )
212
212
  name, value = pair
213
213
 
214
214
  [String(name), value]
215
215
  end
216
216
  else
217
- Util.assert((values.size % 2) == 0,
218
- "values of a user-defined type must be an Array of alternating " \
219
- "names and values pairs, #{values.inspect} given"
220
- )
217
+ Util.assert(values.size.even?,
218
+ 'values of a user-defined type must be an Array of alternating ' \
219
+ "names and values pairs, #{values.inspect} given"
220
+ )
221
221
  @values = values.each_slice(2).map do |(name, value)|
222
222
  [String(name), value]
223
223
  end
@@ -321,9 +321,7 @@ module Cassandra
321
321
  when ::String
322
322
  index = @values.index {|(n, _)| field == n}
323
323
 
324
- unless index
325
- raise ::KeyError, "Unsupported field #{field.inspect}"
326
- end
324
+ raise ::KeyError, "Unsupported field #{field.inspect}" unless index
327
325
 
328
326
  @values[index][1]
329
327
  else
@@ -348,7 +346,7 @@ module Cassandra
348
346
  true
349
347
  end
350
348
 
351
- alias :include? :has_field?
349
+ alias include? has_field?
352
350
 
353
351
  # Sets value of the field.
354
352
  #
@@ -371,9 +369,7 @@ module Cassandra
371
369
  when ::String
372
370
  index = @values.index {|(n, _)| field == n}
373
371
 
374
- unless index
375
- raise ::KeyError, "Unsupported field #{field.inspect}"
376
- end
372
+ raise ::KeyError, "Unsupported field #{field.inspect}" unless index
377
373
 
378
374
  @values[index][1] = value
379
375
  else
@@ -410,21 +406,21 @@ module Cassandra
410
406
 
411
407
  # @private
412
408
  def inspect
413
- "#<Cassandra::UDT:0x#{self.object_id.to_s(16)} #{to_s}>"
409
+ "#<Cassandra::UDT:0x#{object_id.to_s(16)} #{self}>"
414
410
  end
415
411
 
416
412
  # @private
417
413
  def eql?(other)
418
414
  other.is_a?(UDT) && @values.all? {|(n, v)| v == other[n]}
419
415
  end
420
- alias :== :eql?
416
+ alias == eql?
421
417
 
422
418
  # @private
423
419
  def hash
424
420
  @values.inject(17) do |h, (n, v)|
425
421
  h = 31 * h + n.hash
426
- h = 31 * h + v.hash
422
+ 31 * h + v.hash
427
423
  end
428
424
  end
429
425
  end
430
- end
426
+ end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -18,7 +18,9 @@
18
18
 
19
19
  module Cassandra
20
20
  # @private
21
- module Util extend self
21
+ module Util
22
+ module_function
23
+
22
24
  def encode_hash(hash, io = StringIO.new)
23
25
  first = true
24
26
 
@@ -111,7 +113,7 @@ module Cassandra
111
113
 
112
114
  io.string
113
115
  end
114
- alias :encode :encode_object
116
+ alias encode encode_object
115
117
 
116
118
  def encode_time(time, io = StringIO.new)
117
119
  encode_string(time.to_s, io)
@@ -190,7 +192,8 @@ module Cassandra
190
192
  when UDT
191
193
  Types.udt('unknown', 'unknown', object.map {|k, v| [k, guess_type(v)]})
192
194
  else
193
- raise ::ArgumentError, "Unable to guess the type of the argument: #{object.inspect}"
195
+ raise ::ArgumentError,
196
+ "Unable to guess the type of the argument: #{object.inspect}"
194
197
  end
195
198
  end
196
199
 
@@ -212,7 +215,8 @@ module Cassandra
212
215
  def assert_instance_of_one_of(kinds, value, message = nil, &block)
213
216
  unless kinds.any? {|kind| value.is_a?(kind)}
214
217
  message = yield if block_given?
215
- message ||= "value must be an instance of one of #{kinds.inspect}, #{value.inspect} given"
218
+ message ||= "value must be an instance of one of #{kinds.inspect}, " \
219
+ "#{value.inspect} given"
216
220
 
217
221
  raise ::ArgumentError, message
218
222
  end
@@ -221,7 +225,8 @@ module Cassandra
221
225
  def assert_responds_to(method, value, message = nil, &block)
222
226
  unless value.respond_to?(method)
223
227
  message = yield if block_given?
224
- message ||= "value #{value.inspect} must respond to #{method.inspect}, but doesn't"
228
+ message ||= "value #{value.inspect} must respond to #{method.inspect}, " \
229
+ "but doesn't"
225
230
 
226
231
  raise ::ArgumentError, message
227
232
  end
@@ -230,7 +235,8 @@ module Cassandra
230
235
  def assert_responds_to_all(methods, value, message = nil, &block)
231
236
  unless methods.all? {|method| value.respond_to?(method)}
232
237
  message = yield if block_given?
233
- message ||= "value #{value.inspect} must respond to all methods #{methods.inspect}, but doesn't"
238
+ message ||= "value #{value.inspect} must respond to all methods " \
239
+ "#{methods.inspect}, but doesn't"
234
240
 
235
241
  raise ::ArgumentError, message
236
242
  end
@@ -239,14 +245,14 @@ module Cassandra
239
245
  def assert_not_empty(value, message = nil, &block)
240
246
  if value.empty?
241
247
  message = yield if block_given?
242
- message ||= "value cannot be empty"
248
+ message ||= 'value cannot be empty'
243
249
 
244
250
  raise ::ArgumentError, message
245
251
  end
246
252
  end
247
253
 
248
254
  def assert_file_exists(path, message = nil, &block)
249
- unless ::File.exists?(path)
255
+ unless ::File.exist?(path)
250
256
  message = yield if block_given?
251
257
  message ||= "expected file at #{path.inspect} to exist, but it doesn't"
252
258
 
@@ -266,7 +272,8 @@ module Cassandra
266
272
  def assert_size(size, value, message = nil, &block)
267
273
  unless value.size == size
268
274
  message = yield if block_given?
269
- message ||= "value #{value.inspect} must have size equal to #{size.inspect}, but doesn't"
275
+ message ||= "value #{value.inspect} must have size equal to " \
276
+ "#{size.inspect}, but doesn't"
270
277
 
271
278
  raise ::ArgumentError, message
272
279
  end
@@ -275,7 +282,7 @@ module Cassandra
275
282
  def assert(condition, message = nil, &block)
276
283
  unless condition
277
284
  message = yield if block_given?
278
- message ||= "assertion failed"
285
+ message ||= 'assertion failed'
279
286
 
280
287
  raise ::ArgumentError, message
281
288
  end
@@ -311,11 +318,11 @@ module Cassandra
311
318
  # @private
312
319
  COLON = ': '.freeze
313
320
  # @private
314
- QUOT = ?'.freeze
321
+ QUOT = "'".freeze
315
322
  # @private
316
323
  ESC_QUOT = "''".freeze
317
324
  # @private
318
- DBL_QUOT = ?".freeze
325
+ DBL_QUOT = '"'.freeze
319
326
  # @private
320
327
  PRN_OPN = '('.freeze
321
328
  # @private
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -25,19 +25,20 @@ module Cassandra
25
25
  # If you want to generate UUIDs see {Cassandra::Uuid::Generator}.
26
26
  #
27
27
  class Uuid
28
- # Creates a new UUID either from a string (expected to be on the standard 8-4-4-4-12 form, or just 32 characters without hyphens), or from a 128 bit number.
28
+ # Creates a new UUID either from a string (expected to be on the standard 8-4-4-4-12
29
+ # form, or just 32 characters without hyphens), or from a 128 bit number.
29
30
  #
30
31
  # @param uuid [String] a 32 char uuid
31
32
  #
32
33
  # @raise [ArgumentError] if the string does not conform to the expected format
33
34
  #
34
35
  def initialize(uuid)
35
- case uuid
36
- when String
37
- @n = from_s(uuid)
38
- else
39
- @n = uuid
40
- end
36
+ @n = case uuid
37
+ when String
38
+ from_s(uuid)
39
+ else
40
+ uuid
41
+ end
41
42
  end
42
43
 
43
44
  # Returns a string representation of this UUID in the standard 8-4-4-4-12 form.
@@ -48,7 +49,7 @@ module Cassandra
48
49
  s.insert(20, HYPHEN)
49
50
  s.insert(16, HYPHEN)
50
51
  s.insert(12, HYPHEN)
51
- s.insert( 8, HYPHEN)
52
+ s.insert(8, HYPHEN)
52
53
  s
53
54
  end
54
55
  end
@@ -69,13 +70,13 @@ module Cassandra
69
70
  def value
70
71
  @n
71
72
  end
72
- alias_method :to_i, :value
73
+ alias to_i value
73
74
 
74
75
  # @private
75
76
  def eql?(other)
76
- other.respond_to?(:value) && self.value == other.value
77
+ other.respond_to?(:value) && value == other.value
77
78
  end
78
- alias_method :==, :eql?
79
+ alias == eql?
79
80
 
80
81
  private
81
82
 
@@ -93,15 +94,21 @@ module Cassandra
93
94
  # @private
94
95
  def from_s(str)
95
96
  str = str.gsub(HYPHEN, EMPTY_STRING)
96
- raise ::ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}" unless str.length == 32
97
- raise ::ArgumentError, "invalid value for Integer(): \"#{str}\"" unless str =~ HEX_RE
97
+ unless str.length == 32
98
+ raise ::ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}"
99
+ end
100
+ unless str =~ HEX_RE
101
+ raise ::ArgumentError, "invalid value for Integer(): \"#{str}\""
102
+ end
98
103
  Integer(str, 16)
99
104
  end
100
105
  else
101
106
  # @private
102
107
  def from_s(str)
103
108
  str = str.gsub(HYPHEN, EMPTY_STRING)
104
- raise ::ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}" unless str.length == 32
109
+ unless str.length == 32
110
+ raise ::ArgumentError, "Expected 32 hexadecimal digits but got #{str.length}"
111
+ end
105
112
  Integer(str, 16)
106
113
  end
107
114
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -44,8 +44,10 @@ 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)
48
- raise ::ArgumentError, "invalid clock" unless clock.respond_to?(:now)
47
+ def initialize(node_id = (::SecureRandom.random_number(2**47) | 0x010000000000),
48
+ clock_id = ::SecureRandom.random_number(65536),
49
+ clock = ::Time)
50
+ raise ::ArgumentError, 'invalid clock' unless clock.respond_to?(:now)
49
51
 
50
52
  @node_id = Integer(node_id)
51
53
  @clock_id = Integer(clock_id)
@@ -150,8 +152,8 @@ module Cassandra
150
152
  #
151
153
  # @see Time.at
152
154
  def at(*args)
153
- raise ::ArgumentError, "not enough arguments" if args.empty?
154
- raise ::ArgumentError, "too many arguments" if args.size > 3
155
+ raise ::ArgumentError, 'not enough arguments' if args.empty?
156
+ raise ::ArgumentError, 'too many arguments' if args.size > 3
155
157
 
156
158
  if args.first.is_a?(::Time)
157
159
  time = args.shift
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Cassandra
20
- VERSION = '3.0.0.beta.1'.freeze
20
+ VERSION = '3.0.0.rc.1'.freeze
21
21
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
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: 3.0.0.beta.1
4
+ version: 3.0.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Hultberg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-21 00:00:00.000000000 Z
12
+ date: 2016-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ione
@@ -77,6 +77,7 @@ files:
77
77
  - lib/cassandra/auth.rb
78
78
  - lib/cassandra/auth/providers.rb
79
79
  - lib/cassandra/auth/providers/password.rb
80
+ - lib/cassandra/cassandra_logger.rb
80
81
  - lib/cassandra/cluster.rb
81
82
  - lib/cassandra/cluster/client.rb
82
83
  - lib/cassandra/cluster/connection_pool.rb
@@ -109,6 +110,7 @@ files:
109
110
  - lib/cassandra/execution/trace.rb
110
111
  - lib/cassandra/executors.rb
111
112
  - lib/cassandra/function.rb
113
+ - lib/cassandra/function_collection.rb
112
114
  - lib/cassandra/future.rb
113
115
  - lib/cassandra/host.rb
114
116
  - lib/cassandra/keyspace.rb
@@ -218,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
220
  version: 1.3.1
219
221
  requirements: []
220
222
  rubyforge_project:
221
- rubygems_version: 2.4.6
223
+ rubygems_version: 2.5.0
222
224
  signing_key:
223
225
  specification_version: 4
224
226
  summary: Datastax Ruby Driver for Apache Cassandra