cassandra-driver 3.2.0 → 3.2.5.rc.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cassandra-driver might be problematic. Click here for more details.

Files changed (143) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +30 -30
  3. data/ext/cassandra_murmur3/cassandra_murmur3.c +1 -1
  4. data/lib/cassandra.rb +3 -2
  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 +1 -1
  9. data/lib/cassandra/argument.rb +1 -1
  10. data/lib/cassandra/attr_boolean.rb +1 -1
  11. data/lib/cassandra/auth.rb +1 -1
  12. data/lib/cassandra/auth/providers.rb +1 -1
  13. data/lib/cassandra/auth/providers/password.rb +1 -1
  14. data/lib/cassandra/cassandra_logger.rb +1 -1
  15. data/lib/cassandra/cluster.rb +1 -1
  16. data/lib/cassandra/cluster/client.rb +1 -1
  17. data/lib/cassandra/cluster/connection_pool.rb +1 -1
  18. data/lib/cassandra/cluster/connector.rb +1 -1
  19. data/lib/cassandra/cluster/control_connection.rb +1 -1
  20. data/lib/cassandra/cluster/failed_connection.rb +1 -1
  21. data/lib/cassandra/cluster/metadata.rb +1 -1
  22. data/lib/cassandra/cluster/options.rb +1 -1
  23. data/lib/cassandra/cluster/registry.rb +5 -5
  24. data/lib/cassandra/cluster/schema.rb +1 -1
  25. data/lib/cassandra/cluster/schema/cql_type_parser.rb +4 -3
  26. data/lib/cassandra/cluster/schema/fetchers.rb +2 -2
  27. data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +4 -5
  28. data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
  29. data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +1 -1
  30. data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
  31. data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
  32. data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
  33. data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +1 -1
  34. data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
  35. data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
  36. data/lib/cassandra/column.rb +1 -1
  37. data/lib/cassandra/column_container.rb +2 -2
  38. data/lib/cassandra/compression.rb +1 -1
  39. data/lib/cassandra/compression/compressors/lz4.rb +1 -1
  40. data/lib/cassandra/compression/compressors/snappy.rb +1 -1
  41. data/lib/cassandra/custom_data.rb +1 -1
  42. data/lib/cassandra/driver.rb +1 -1
  43. data/lib/cassandra/duration.rb +100 -0
  44. data/lib/cassandra/errors.rb +1 -1
  45. data/lib/cassandra/execution/info.rb +1 -1
  46. data/lib/cassandra/execution/options.rb +1 -1
  47. data/lib/cassandra/execution/profile.rb +5 -2
  48. data/lib/cassandra/execution/profile_manager.rb +1 -1
  49. data/lib/cassandra/execution/trace.rb +1 -1
  50. data/lib/cassandra/executors.rb +1 -1
  51. data/lib/cassandra/function.rb +1 -1
  52. data/lib/cassandra/function_collection.rb +1 -1
  53. data/lib/cassandra/future.rb +9 -3
  54. data/lib/cassandra/host.rb +1 -1
  55. data/lib/cassandra/index.rb +1 -1
  56. data/lib/cassandra/keyspace.rb +1 -1
  57. data/lib/cassandra/listener.rb +1 -1
  58. data/lib/cassandra/load_balancing.rb +1 -1
  59. data/lib/cassandra/load_balancing/policies.rb +1 -1
  60. data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +1 -1
  61. data/lib/cassandra/load_balancing/policies/round_robin.rb +1 -1
  62. data/lib/cassandra/load_balancing/policies/token_aware.rb +1 -1
  63. data/lib/cassandra/load_balancing/policies/white_list.rb +1 -1
  64. data/lib/cassandra/materialized_view.rb +1 -1
  65. data/lib/cassandra/null_logger.rb +1 -1
  66. data/lib/cassandra/protocol.rb +1 -1
  67. data/lib/cassandra/protocol/coder.rb +1 -1
  68. data/lib/cassandra/protocol/cql_byte_buffer.rb +63 -15
  69. data/lib/cassandra/protocol/cql_protocol_handler.rb +58 -10
  70. data/lib/cassandra/protocol/request.rb +1 -1
  71. data/lib/cassandra/protocol/requests/auth_response_request.rb +1 -1
  72. data/lib/cassandra/protocol/requests/batch_request.rb +1 -1
  73. data/lib/cassandra/protocol/requests/credentials_request.rb +1 -1
  74. data/lib/cassandra/protocol/requests/execute_request.rb +1 -1
  75. data/lib/cassandra/protocol/requests/options_request.rb +1 -1
  76. data/lib/cassandra/protocol/requests/prepare_request.rb +1 -1
  77. data/lib/cassandra/protocol/requests/query_request.rb +1 -1
  78. data/lib/cassandra/protocol/requests/register_request.rb +1 -1
  79. data/lib/cassandra/protocol/requests/startup_request.rb +1 -1
  80. data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
  81. data/lib/cassandra/protocol/response.rb +1 -1
  82. data/lib/cassandra/protocol/responses/already_exists_error_response.rb +1 -1
  83. data/lib/cassandra/protocol/responses/auth_challenge_response.rb +1 -1
  84. data/lib/cassandra/protocol/responses/auth_success_response.rb +1 -1
  85. data/lib/cassandra/protocol/responses/authenticate_response.rb +1 -1
  86. data/lib/cassandra/protocol/responses/error_response.rb +1 -1
  87. data/lib/cassandra/protocol/responses/event_response.rb +1 -1
  88. data/lib/cassandra/protocol/responses/function_failure_error_response.rb +1 -1
  89. data/lib/cassandra/protocol/responses/prepared_result_response.rb +1 -1
  90. data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +1 -1
  91. data/lib/cassandra/protocol/responses/read_failure_error_response.rb +1 -1
  92. data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +1 -1
  93. data/lib/cassandra/protocol/responses/ready_response.rb +1 -1
  94. data/lib/cassandra/protocol/responses/result_response.rb +1 -1
  95. data/lib/cassandra/protocol/responses/rows_result_response.rb +1 -1
  96. data/lib/cassandra/protocol/responses/schema_change_event_response.rb +1 -1
  97. data/lib/cassandra/protocol/responses/schema_change_result_response.rb +1 -1
  98. data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +1 -1
  99. data/lib/cassandra/protocol/responses/status_change_event_response.rb +1 -1
  100. data/lib/cassandra/protocol/responses/supported_response.rb +1 -1
  101. data/lib/cassandra/protocol/responses/topology_change_event_response.rb +1 -1
  102. data/lib/cassandra/protocol/responses/unavailable_error_response.rb +1 -1
  103. data/lib/cassandra/protocol/responses/unprepared_error_response.rb +1 -1
  104. data/lib/cassandra/protocol/responses/void_result_response.rb +1 -1
  105. data/lib/cassandra/protocol/responses/write_failure_error_response.rb +1 -1
  106. data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +1 -1
  107. data/lib/cassandra/protocol/v1.rb +1 -1
  108. data/lib/cassandra/protocol/v3.rb +1 -1
  109. data/lib/cassandra/protocol/v4.rb +4 -1
  110. data/lib/cassandra/reconnection.rb +1 -1
  111. data/lib/cassandra/reconnection/policies.rb +1 -1
  112. data/lib/cassandra/reconnection/policies/constant.rb +1 -1
  113. data/lib/cassandra/reconnection/policies/exponential.rb +1 -1
  114. data/lib/cassandra/result.rb +1 -1
  115. data/lib/cassandra/retry.rb +1 -1
  116. data/lib/cassandra/retry/policies.rb +1 -1
  117. data/lib/cassandra/retry/policies/default.rb +1 -1
  118. data/lib/cassandra/retry/policies/downgrading_consistency.rb +1 -1
  119. data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
  120. data/lib/cassandra/session.rb +8 -4
  121. data/lib/cassandra/statement.rb +1 -1
  122. data/lib/cassandra/statements.rb +1 -1
  123. data/lib/cassandra/statements/batch.rb +1 -1
  124. data/lib/cassandra/statements/bound.rb +1 -1
  125. data/lib/cassandra/statements/prepared.rb +1 -1
  126. data/lib/cassandra/statements/simple.rb +1 -1
  127. data/lib/cassandra/statements/void.rb +1 -1
  128. data/lib/cassandra/table.rb +2 -2
  129. data/lib/cassandra/time.rb +1 -1
  130. data/lib/cassandra/time_uuid.rb +1 -1
  131. data/lib/cassandra/timestamp_generator.rb +1 -1
  132. data/lib/cassandra/timestamp_generator/simple.rb +1 -1
  133. data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +1 -1
  134. data/lib/cassandra/trigger.rb +1 -1
  135. data/lib/cassandra/tuple.rb +1 -1
  136. data/lib/cassandra/types.rb +73 -2
  137. data/lib/cassandra/udt.rb +1 -1
  138. data/lib/cassandra/util.rb +21 -1
  139. data/lib/cassandra/uuid.rb +1 -1
  140. data/lib/cassandra/uuid/generator.rb +1 -1
  141. data/lib/cassandra/version.rb +2 -2
  142. data/lib/datastax/cassandra.rb +1 -1
  143. metadata +20 -20
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -293,7 +293,7 @@ module Cassandra
293
293
 
294
294
  # @private
295
295
  module Fetchers
296
- # rubocop:disable Style/ClassAndModuleCamelCase
296
+ # rubocop:disable Naming/ClassAndModuleCamelCase
297
297
  class V1_2_x
298
298
  SELECT_KEYSPACES = 'SELECT * FROM system.schema_keyspaces'.freeze
299
299
  SELECT_TABLES = 'SELECT * FROM system.schema_columnfamilies'.freeze
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -50,7 +50,8 @@ module Cassandra
50
50
  'org.apache.cassandra.db.marshal.ShortType' => :smallint,
51
51
  'org.apache.cassandra.db.marshal.ByteType' => :tinyint,
52
52
  'org.apache.cassandra.db.marshal.TimeType' => :time,
53
- 'org.apache.cassandra.db.marshal.SimpleDateType' => :date
53
+ 'org.apache.cassandra.db.marshal.SimpleDateType' => :date,
54
+ 'org.apache.cassandra.db.marshal.FrozenType' => :frozen
54
55
  }.freeze
55
56
 
56
57
  def parse(string)
@@ -109,14 +110,12 @@ module Cassandra
109
110
  end
110
111
 
111
112
  def lookup_type(node)
112
- return lookup_type(node.children.first) if node.name == 'org.apache.cassandra.db.marshal.FrozenType'
113
-
114
113
  type = @@types.fetch(node.name) do
115
114
  return Cassandra::Types.custom(dump_node(node))
116
115
  end
117
116
 
118
117
  case type
119
- when :set, :list
118
+ when :set, :list, :frozen
120
119
  Cassandra::Types.send(type, lookup_type(node.children.first))
121
120
  when :map
122
121
  Cassandra::Types.map(*node.children.map(&method(:lookup_type)))
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -294,7 +294,7 @@ module Cassandra
294
294
  # its keyspace constructed yet. So allow updating @keyspace, thus
295
295
  # allowing fetchers to create keyspace, table/view, and hook them together without
296
296
  # worrying about chickens and eggs.
297
- # rubocop:disable Style/AccessorMethodName
297
+ # rubocop:disable Naming/AccessorMethodName
298
298
  def set_keyspace(keyspace)
299
299
  @keyspace = keyspace
300
300
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -0,0 +1,100 @@
1
+ # encoding: utf-8
2
+
3
+ #--
4
+ # Copyright DataStax, Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #++
18
+ module Cassandra
19
+ module Types
20
+
21
+ class Duration < Type
22
+ include CustomData
23
+
24
+ @@four_byte_max = 2 ** 32
25
+ @@eight_byte_max = 2 ** 64
26
+
27
+ # @private
28
+ attr_reader :months, :days, :nanos
29
+
30
+ # @private
31
+ def initialize(months, days, nanos)
32
+ super(:duration)
33
+ @months = months
34
+ @days = days
35
+ @nanos = nanos
36
+ end
37
+
38
+ def new(*values)
39
+ Util.assert_size(3, values, "Duration type expects three values, #{values.size} were provided")
40
+ values.each { |v| Util.assert_type(Int, v) }
41
+ Util.assert (Util.encode_zigzag32(values[0]) < @@four_byte_max), "Months value must be a valid 32-bit integer"
42
+ Util.assert (Util.encode_zigzag32(values[1]) < @@four_byte_max), "Days value must be a valid 32-bit integer"
43
+ Util.assert (Util.encode_zigzag64(values[2]) < @@eight_byte_max), "Nanos value must be a valid 64-bit integer"
44
+ all_positive = values.all? {|i| i >= 0 }
45
+ all_negative = values.all? {|i| i <= 0 }
46
+ Util.assert (all_positive or all_negative), "Values in a duration must be uniformly positive or negative"
47
+ Duration.new *values
48
+ end
49
+
50
+ def assert(value, message = nil, &block)
51
+ Util.assert_instance_of(Duration, value, message, &block)
52
+ end
53
+
54
+ def to_s
55
+ "Duration: months => #{@months}, days => #{@days}, nanos => #{@nanos}"
56
+ end
57
+
58
+ def hash
59
+ @hash ||= begin
60
+ h = 17
61
+ h = 31 * h + @months.hash
62
+ h = 31 * h + @days.hash
63
+ h = 31 * h + @nanos.hash
64
+ h
65
+ end
66
+ end
67
+
68
+ def eql?(other)
69
+ other.is_a?(Duration) &&
70
+ @months == other.months &&
71
+ @days == other.days &&
72
+ @nanos == other.nanos
73
+ end
74
+
75
+ alias == eql?
76
+
77
+ def self.cql_type
78
+ Type.new(@kind)
79
+ end
80
+
81
+ # Requirements for CustomData module
82
+ def self.deserialize(bytestr)
83
+ buffer = Cassandra::Protocol::CqlByteBuffer.new.append(bytestr)
84
+ Cassandra::Types::Duration.new(buffer.read_signed_vint,buffer.read_signed_vint,buffer.read_signed_vint)
85
+ end
86
+
87
+ def self.type
88
+ Cassandra::Types::Custom.new('org.apache.cassandra.db.marshal.DurationType')
89
+ end
90
+
91
+ def serialize
92
+ rv = Cassandra::Protocol::CqlByteBuffer.new
93
+ rv.append_signed_vint32(@months)
94
+ rv.append_signed_vint32(@days)
95
+ rv.append_signed_vint64(@nanos)
96
+ rv
97
+ end
98
+ end
99
+ end
100
+ end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -114,7 +114,10 @@ module Cassandra
114
114
  timeout = options[:timeout]
115
115
 
116
116
  unless timeout.nil?
117
- Util.assert_instance_of(::Numeric, timeout, ":timeout must be a number of seconds, #{timeout.inspect} given")
117
+ Util.assert_instance_of(::Numeric,
118
+ timeout,
119
+ ":timeout must be a number of seconds,
120
+ #{timeout.inspect} given")
118
121
  Util.assert(timeout > 0, ":timeout must be greater than 0, #{timeout} given")
119
122
  end
120
123
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.
@@ -204,7 +204,13 @@ module Cassandra
204
204
  end
205
205
 
206
206
  def all(*futures)
207
- futures = Array(futures.first) if futures.one?
207
+ # May get called with varargs or an array of futures. In the latter case,
208
+ # the first element in futures is the array of futures. Promote it.
209
+ futures = Array(futures.first) if futures.one?
210
+
211
+ # Special case where there are no futures to aggregate.
212
+ return Value.new([]) if futures.empty?
213
+
208
214
  monitor = Monitor.new
209
215
  promise = Promise.new(@executor)
210
216
  remaining = futures.length
@@ -609,9 +615,9 @@ module Cassandra
609
615
  @waiting += 1
610
616
  while @state == :pending
611
617
  if deadline
618
+ break if now >= deadline
612
619
  @cond.wait(deadline - now)
613
620
  now = ::Time.now
614
- break if now >= deadline
615
621
  else
616
622
  @cond.wait
617
623
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2017 DataStax, Inc.
4
+ # Copyright 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.