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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +106 -39
  3. data/lib/cassandra.rb +396 -148
  4. data/lib/cassandra/address_resolution.rb +1 -1
  5. data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
  6. data/lib/cassandra/address_resolution/policies/none.rb +1 -1
  7. data/lib/cassandra/aggregate.rb +21 -7
  8. data/lib/cassandra/argument.rb +2 -2
  9. data/lib/cassandra/attr_boolean.rb +33 -0
  10. data/lib/cassandra/auth.rb +6 -5
  11. data/lib/cassandra/auth/providers.rb +1 -1
  12. data/lib/cassandra/auth/providers/password.rb +5 -13
  13. data/lib/cassandra/cassandra_logger.rb +80 -0
  14. data/lib/cassandra/cluster.rb +49 -9
  15. data/lib/cassandra/cluster/client.rb +835 -209
  16. data/lib/cassandra/cluster/connection_pool.rb +2 -2
  17. data/lib/cassandra/cluster/connector.rb +86 -27
  18. data/lib/cassandra/cluster/control_connection.rb +222 -95
  19. data/lib/cassandra/cluster/failed_connection.rb +1 -1
  20. data/lib/cassandra/cluster/metadata.rb +14 -8
  21. data/lib/cassandra/cluster/options.rb +68 -22
  22. data/lib/cassandra/cluster/registry.rb +81 -17
  23. data/lib/cassandra/cluster/schema.rb +70 -8
  24. data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
  25. data/lib/cassandra/cluster/schema/fetchers.rb +601 -241
  26. data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +39 -38
  27. data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
  28. data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +6 -8
  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 +4 -23
  36. data/lib/cassandra/column_container.rb +322 -0
  37. data/lib/cassandra/compression.rb +1 -1
  38. data/lib/cassandra/compression/compressors/lz4.rb +7 -8
  39. data/lib/cassandra/compression/compressors/snappy.rb +4 -3
  40. data/lib/cassandra/driver.rb +107 -46
  41. data/lib/cassandra/errors.rb +303 -52
  42. data/lib/cassandra/execution/info.rb +16 -5
  43. data/lib/cassandra/execution/options.rb +102 -55
  44. data/lib/cassandra/execution/trace.rb +16 -9
  45. data/lib/cassandra/executors.rb +1 -1
  46. data/lib/cassandra/function.rb +19 -13
  47. data/lib/cassandra/function_collection.rb +85 -0
  48. data/lib/cassandra/future.rb +101 -49
  49. data/lib/cassandra/host.rb +25 -5
  50. data/lib/cassandra/index.rb +118 -0
  51. data/lib/cassandra/keyspace.rb +169 -33
  52. data/lib/cassandra/listener.rb +1 -1
  53. data/lib/cassandra/load_balancing.rb +2 -2
  54. data/lib/cassandra/load_balancing/policies.rb +1 -1
  55. data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +39 -25
  56. data/lib/cassandra/load_balancing/policies/round_robin.rb +8 -1
  57. data/lib/cassandra/load_balancing/policies/token_aware.rb +22 -13
  58. data/lib/cassandra/load_balancing/policies/white_list.rb +18 -5
  59. data/lib/cassandra/materialized_view.rb +90 -0
  60. data/lib/cassandra/null_logger.rb +27 -6
  61. data/lib/cassandra/protocol.rb +1 -1
  62. data/lib/cassandra/protocol/coder.rb +81 -42
  63. data/lib/cassandra/protocol/cql_byte_buffer.rb +58 -44
  64. data/lib/cassandra/protocol/cql_protocol_handler.rb +57 -54
  65. data/lib/cassandra/protocol/request.rb +6 -7
  66. data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
  67. data/lib/cassandra/protocol/requests/batch_request.rb +17 -8
  68. data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
  69. data/lib/cassandra/protocol/requests/execute_request.rb +39 -20
  70. data/lib/cassandra/protocol/requests/options_request.rb +1 -1
  71. data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
  72. data/lib/cassandra/protocol/requests/query_request.rb +28 -23
  73. data/lib/cassandra/protocol/requests/register_request.rb +2 -2
  74. data/lib/cassandra/protocol/requests/startup_request.rb +8 -8
  75. data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
  76. data/lib/cassandra/protocol/response.rb +3 -4
  77. data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
  78. data/lib/cassandra/protocol/responses/auth_challenge_response.rb +4 -5
  79. data/lib/cassandra/protocol/responses/auth_success_response.rb +4 -5
  80. data/lib/cassandra/protocol/responses/authenticate_response.rb +4 -5
  81. data/lib/cassandra/protocol/responses/error_response.rb +104 -17
  82. data/lib/cassandra/protocol/responses/event_response.rb +3 -4
  83. data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
  84. data/lib/cassandra/protocol/responses/prepared_result_response.rb +14 -9
  85. data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
  86. data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
  87. data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
  88. data/lib/cassandra/protocol/responses/ready_response.rb +6 -7
  89. data/lib/cassandra/protocol/responses/result_response.rb +11 -10
  90. data/lib/cassandra/protocol/responses/rows_result_response.rb +8 -7
  91. data/lib/cassandra/protocol/responses/schema_change_event_response.rb +8 -8
  92. data/lib/cassandra/protocol/responses/schema_change_result_response.rb +19 -13
  93. data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +5 -6
  94. data/lib/cassandra/protocol/responses/status_change_event_response.rb +5 -6
  95. data/lib/cassandra/protocol/responses/supported_response.rb +4 -5
  96. data/lib/cassandra/protocol/responses/topology_change_event_response.rb +4 -5
  97. data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
  98. data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
  99. data/lib/cassandra/protocol/responses/void_result_response.rb +4 -5
  100. data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
  101. data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
  102. data/lib/cassandra/protocol/v1.rb +98 -37
  103. data/lib/cassandra/protocol/v3.rb +121 -50
  104. data/lib/cassandra/protocol/v4.rb +172 -68
  105. data/lib/cassandra/reconnection.rb +1 -1
  106. data/lib/cassandra/reconnection/policies.rb +1 -1
  107. data/lib/cassandra/reconnection/policies/constant.rb +2 -4
  108. data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
  109. data/lib/cassandra/result.rb +55 -20
  110. data/lib/cassandra/retry.rb +8 -8
  111. data/lib/cassandra/retry/policies.rb +1 -1
  112. data/lib/cassandra/retry/policies/default.rb +1 -1
  113. data/lib/cassandra/retry/policies/downgrading_consistency.rb +4 -2
  114. data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
  115. data/lib/cassandra/session.rb +24 -16
  116. data/lib/cassandra/statement.rb +1 -1
  117. data/lib/cassandra/statements.rb +1 -1
  118. data/lib/cassandra/statements/batch.rb +16 -10
  119. data/lib/cassandra/statements/bound.rb +10 -3
  120. data/lib/cassandra/statements/prepared.rb +62 -18
  121. data/lib/cassandra/statements/simple.rb +23 -10
  122. data/lib/cassandra/statements/void.rb +1 -1
  123. data/lib/cassandra/table.rb +53 -185
  124. data/lib/cassandra/time.rb +11 -6
  125. data/lib/cassandra/time_uuid.rb +12 -14
  126. data/lib/cassandra/timestamp_generator.rb +37 -0
  127. data/lib/cassandra/timestamp_generator/simple.rb +38 -0
  128. data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +58 -0
  129. data/lib/cassandra/tuple.rb +4 -4
  130. data/lib/cassandra/types.rb +109 -71
  131. data/lib/cassandra/udt.rb +66 -50
  132. data/lib/cassandra/util.rb +155 -15
  133. data/lib/cassandra/uuid.rb +20 -21
  134. data/lib/cassandra/uuid/generator.rb +7 -5
  135. data/lib/cassandra/version.rb +2 -2
  136. data/lib/cassandra_murmur3.jar +0 -0
  137. data/lib/datastax/cassandra.rb +1 -1
  138. metadata +27 -16
@@ -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,27 @@ 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
+ # @private
29
+ RAW_FORMAT = '%032x'.force_encoding(Encoding::ASCII).freeze
30
+ # @private
31
+ HYPHEN = '-'.force_encoding(Encoding::ASCII).freeze
32
+ # @private
33
+ EMPTY_STRING = ''.freeze
34
+
35
+ # Creates a new UUID either from a string (expected to be on the standard 8-4-4-4-12
36
+ # form, or just 32 characters without hyphens), or from a 128 bit number.
29
37
  #
30
38
  # @param uuid [String] a 32 char uuid
31
39
  #
32
40
  # @raise [ArgumentError] if the string does not conform to the expected format
33
41
  #
34
42
  def initialize(uuid)
35
- case uuid
36
- when String
37
- @n = from_s(uuid)
38
- else
39
- @n = uuid
40
- end
43
+ @n = case uuid
44
+ when String
45
+ from_s(uuid)
46
+ else
47
+ uuid
48
+ end
41
49
  end
42
50
 
43
51
  # Returns a string representation of this UUID in the standard 8-4-4-4-12 form.
@@ -48,7 +56,7 @@ module Cassandra
48
56
  s.insert(20, HYPHEN)
49
57
  s.insert(16, HYPHEN)
50
58
  s.insert(12, HYPHEN)
51
- s.insert( 8, HYPHEN)
59
+ s.insert(8, HYPHEN)
52
60
  s
53
61
  end
54
62
  end
@@ -69,22 +77,13 @@ module Cassandra
69
77
  def value
70
78
  @n
71
79
  end
72
- alias_method :to_i, :value
80
+ alias to_i value
73
81
 
74
82
  # @private
75
83
  def eql?(other)
76
- other.respond_to?(:value) && self.value == other.value
84
+ other.respond_to?(:value) && value == other.value
77
85
  end
78
- alias_method :==, :eql?
79
-
80
- private
81
-
82
- # @private
83
- RAW_FORMAT = '%032x'.force_encoding(Encoding::ASCII).freeze
84
- # @private
85
- HYPHEN = '-'.force_encoding(Encoding::ASCII).freeze
86
- # @private
87
- EMPTY_STRING = ''.freeze
86
+ alias == eql?
88
87
 
89
88
  if RUBY_ENGINE == 'jruby'
90
89
  # @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.
@@ -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'.freeze
21
21
  end
Binary file
@@ -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,20 +1,21 @@
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
5
5
  platform: java
6
6
  authors:
7
7
  - Theo Hultberg
8
8
  - Bulat Shakirzyanov
9
+ - Sandeep Tamhankar
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-12-21 00:00:00.000000000 Z
13
+ date: 2016-05-23 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - ~>
18
+ - - "~>"
18
19
  - !ruby/object:Gem::Version
19
20
  version: '1.2'
20
21
  name: ione
@@ -22,13 +23,13 @@ dependencies:
22
23
  type: :runtime
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - ~>
26
+ - - "~>"
26
27
  - !ruby/object:Gem::Version
27
28
  version: '1.2'
28
29
  - !ruby/object:Gem::Dependency
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ~>
32
+ - - "~>"
32
33
  - !ruby/object:Gem::Version
33
34
  version: '1.6'
34
35
  name: bundler
@@ -36,13 +37,13 @@ dependencies:
36
37
  type: :development
37
38
  version_requirements: !ruby/object:Gem::Requirement
38
39
  requirements:
39
- - - ~>
40
+ - - "~>"
40
41
  - !ruby/object:Gem::Version
41
42
  version: '1.6'
42
43
  - !ruby/object:Gem::Dependency
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - ~>
46
+ - - "~>"
46
47
  - !ruby/object:Gem::Version
47
48
  version: '10.0'
48
49
  name: rake
@@ -50,19 +51,20 @@ dependencies:
50
51
  type: :development
51
52
  version_requirements: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - ~>
54
+ - - "~>"
54
55
  - !ruby/object:Gem::Version
55
56
  version: '10.0'
56
57
  description: A pure Ruby driver for Apache Cassandra
57
58
  email:
58
59
  - theo@iconara.net
59
60
  - bulat.shakirzyanov@datastax.com
61
+ - sandeep.tamhankar@datastax.com
60
62
  executables: []
61
63
  extensions: []
62
64
  extra_rdoc_files:
63
65
  - README.md
64
66
  files:
65
- - .yardopts
67
+ - ".yardopts"
66
68
  - README.md
67
69
  - lib/cassandra.rb
68
70
  - lib/cassandra/address_resolution.rb
@@ -71,9 +73,11 @@ files:
71
73
  - lib/cassandra/address_resolution/policies/none.rb
72
74
  - lib/cassandra/aggregate.rb
73
75
  - lib/cassandra/argument.rb
76
+ - lib/cassandra/attr_boolean.rb
74
77
  - lib/cassandra/auth.rb
75
78
  - lib/cassandra/auth/providers.rb
76
79
  - lib/cassandra/auth/providers/password.rb
80
+ - lib/cassandra/cassandra_logger.rb
77
81
  - lib/cassandra/cluster.rb
78
82
  - lib/cassandra/cluster/client.rb
79
83
  - lib/cassandra/cluster/connection_pool.rb
@@ -96,6 +100,7 @@ files:
96
100
  - lib/cassandra/cluster/schema/replication_strategies/none.rb
97
101
  - lib/cassandra/cluster/schema/replication_strategies/simple.rb
98
102
  - lib/cassandra/column.rb
103
+ - lib/cassandra/column_container.rb
99
104
  - lib/cassandra/compression.rb
100
105
  - lib/cassandra/compression/compressors/lz4.rb
101
106
  - lib/cassandra/compression/compressors/snappy.rb
@@ -106,8 +111,10 @@ files:
106
111
  - lib/cassandra/execution/trace.rb
107
112
  - lib/cassandra/executors.rb
108
113
  - lib/cassandra/function.rb
114
+ - lib/cassandra/function_collection.rb
109
115
  - lib/cassandra/future.rb
110
116
  - lib/cassandra/host.rb
117
+ - lib/cassandra/index.rb
111
118
  - lib/cassandra/keyspace.rb
112
119
  - lib/cassandra/listener.rb
113
120
  - lib/cassandra/load_balancing.rb
@@ -116,6 +123,7 @@ files:
116
123
  - lib/cassandra/load_balancing/policies/round_robin.rb
117
124
  - lib/cassandra/load_balancing/policies/token_aware.rb
118
125
  - lib/cassandra/load_balancing/policies/white_list.rb
126
+ - lib/cassandra/materialized_view.rb
119
127
  - lib/cassandra/null_logger.rb
120
128
  - lib/cassandra/protocol.rb
121
129
  - lib/cassandra/protocol/coder.rb
@@ -182,6 +190,9 @@ files:
182
190
  - lib/cassandra/table.rb
183
191
  - lib/cassandra/time.rb
184
192
  - lib/cassandra/time_uuid.rb
193
+ - lib/cassandra/timestamp_generator.rb
194
+ - lib/cassandra/timestamp_generator/simple.rb
195
+ - lib/cassandra/timestamp_generator/ticking_on_duplicate.rb
185
196
  - lib/cassandra/tuple.rb
186
197
  - lib/cassandra/types.rb
187
198
  - lib/cassandra/udt.rb
@@ -197,26 +208,26 @@ licenses:
197
208
  metadata: {}
198
209
  post_install_message:
199
210
  rdoc_options:
200
- - --title
211
+ - "--title"
201
212
  - Datastax Ruby Driver
202
- - --main
213
+ - "--main"
203
214
  - README.md
204
- - --line-numbers
215
+ - "--line-numbers"
205
216
  require_paths:
206
217
  - lib
207
218
  required_ruby_version: !ruby/object:Gem::Requirement
208
219
  requirements:
209
- - - '>='
220
+ - - ">="
210
221
  - !ruby/object:Gem::Version
211
222
  version: 1.9.3
212
223
  required_rubygems_version: !ruby/object:Gem::Requirement
213
224
  requirements:
214
- - - '>'
225
+ - - ">="
215
226
  - !ruby/object:Gem::Version
216
- version: 1.3.1
227
+ version: '0'
217
228
  requirements: []
218
229
  rubyforge_project:
219
- rubygems_version: 2.4.5
230
+ rubygems_version: 2.4.8
220
231
  signing_key:
221
232
  specification_version: 4
222
233
  summary: Datastax Ruby Driver for Apache Cassandra