cassandra-driver 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 950f81b3248939bd7178b7e6c05144ed7da77cb6
4
- data.tar.gz: efc50ee4050ea234d8e63e509d4f298ca671a876
3
+ metadata.gz: c5546b5f0956cd7d4d1c769c455e78e48ac5961a
4
+ data.tar.gz: 7c24862b085ac804ff8c8dd338a2dd7826a93caa
5
5
  SHA512:
6
- metadata.gz: d85304895d5b91d7774c08a146889c07919fccd8c0841cf7596a53f499a70cd8bae02781e03ccbf7f3592fe3eb4d19fbaaef98f88f8143f7636566071812dcba
7
- data.tar.gz: 9bd76f5c388c000c572a85905febeedc6c37e67a60441842c25970ce9df54a91dbd66d2de858b7db245d05402c00488d7422a35cddaa11ed77394faaba08b42d
6
+ metadata.gz: 5164d4dd457d57592cbdc0e523c471bbeba2f7afeebb89811d103267795ee3ce335a617b82291dd4b5fd96971f960740c65da80d3346d7250234cf61f8bd80e4
7
+ data.tar.gz: 99ee34fe7142a194b3a9c78c9493f7d82a31081dba46efa396f96cfecd411e77be523414a823f68e2967fa38496aa116697348f50789861f6f91a805077739dd
data/README.md CHANGED
@@ -101,7 +101,7 @@ __Note__: if you want to use compression you should also install [snappy](http:/
101
101
 
102
102
  Some of the new features added to the driver have unfortunately led to changes in the original cql-rb API.
103
103
  In the examples directory, you can find [an example of how to wrap the ruby driver to achieve almost complete
104
- interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.2.2/examples/cql-rb-wrapper.rb)
104
+ interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.2.3/examples/cql-rb-wrapper.rb)
105
105
  to assist you with gradual upgrade.
106
106
 
107
107
  If you are upgrading to DataStax Enterprise, use the [Ruby DSE driver](https://github.com/datastax/ruby-dse-driver.git)
@@ -112,7 +112,7 @@ This minor release adds support for MRI 2.4.x and also contains a few miscellane
112
112
  support for Ruby versions prior to 2.2. This was already officially the case, but the minimum version limit is
113
113
  now enforced.
114
114
 
115
- See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.2.2/CHANGELOG.md) for more information on all
115
+ See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.2.3/CHANGELOG.md) for more information on all
116
116
  changes in this version and past versions.
117
117
 
118
118
  ## What's new in v3.1
@@ -180,7 +180,7 @@ examples in the `features/` directory.
180
180
  ## Running tests
181
181
 
182
182
  If you don't feel like reading through the following instructions on how to run
183
- ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.2.2/.travis.yml).
183
+ ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.2.3/.travis.yml).
184
184
 
185
185
  * Check out the driver codebase and install test dependencies:
186
186
 
@@ -204,7 +204,7 @@ CASSANDRA_VERSION=2.1.12 bundle exec rake test # run both as well as integration
204
204
  ## Changelog & versioning
205
205
 
206
206
  Check out the [releases on GitHub](https://github.com/datastax/ruby-driver/releases) and
207
- [changelog](https://github.com/datastax/ruby-driver/blob/v3.2.2/CHANGELOG.md). Version
207
+ [changelog](https://github.com/datastax/ruby-driver/blob/v3.2.3/CHANGELOG.md). Version
208
208
  numbering follows the [semantic versioning](http://semver.org/) scheme.
209
209
 
210
210
  Private and experimental APIs, defined as whatever is not in the
@@ -40,8 +40,6 @@ module Cassandra
40
40
  private
41
41
 
42
42
  def lookup_type(node, types)
43
- return lookup_type(node.children.first, types) if node.name == 'frozen'
44
-
45
43
  case node.name
46
44
  when 'text' then Cassandra::Types.text
47
45
  when 'blob' then Cassandra::Types.blob
@@ -70,6 +68,8 @@ module Cassandra
70
68
  Cassandra::Types.list(lookup_type(node.children.first, types))
71
69
  when 'tuple' then
72
70
  Cassandra::Types.tuple(*node.children.map { |t| lookup_type(t, types)})
71
+ when 'frozen' then
72
+ Cassandra::Types.frozen(lookup_type(node.children.first, types))
73
73
  when 'empty' then
74
74
  Cassandra::Types.custom('org.apache.cassandra.db.marshal.EmptyType')
75
75
  when /\A'/ then
@@ -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)))
@@ -55,7 +55,7 @@ module Cassandra
55
55
  def read_decimal(len = bytesize)
56
56
  scale = read_signed_int
57
57
  number_string = read_varint(len - 4).to_s
58
- if scale < 0
58
+ if scale <= 0
59
59
  # Special case where the actual scale is positive; scale in the protocol is actually negative of
60
60
  # reality.
61
61
  BigDecimal.new(number_string + '0' * -scale)
@@ -264,6 +264,7 @@ module Cassandra
264
264
  @timed_out = false
265
265
  @scheduler = scheduler
266
266
  @lock = Mutex.new
267
+ @timer = nil
267
268
  super()
268
269
  end
269
270
 
@@ -169,7 +169,7 @@ module Cassandra
169
169
 
170
170
  cql << "\n)\nWITH "
171
171
 
172
- if @clustering_order.any? {|o| o != :asc}
172
+ if !@clustering_order.empty? && !@clustering_columns.empty?
173
173
  cql << 'CLUSTERING ORDER BY ('
174
174
  first = true
175
175
  @clustering_columns.zip(@clustering_order) do |column, order|
@@ -1414,6 +1414,73 @@ module Cassandra
1414
1414
  alias == eql?
1415
1415
  end
1416
1416
 
1417
+ class Frozen < Type
1418
+ # @private
1419
+ attr_reader :value_type
1420
+
1421
+ # @private
1422
+ def initialize(value_type)
1423
+ super(:frozen)
1424
+ @value_type = value_type
1425
+ end
1426
+
1427
+ # Coerces the value to Array
1428
+ # @param value [Object] original value
1429
+ # @return [Array] value
1430
+ # @see Cassandra::Type#new
1431
+ def new(*value)
1432
+ value = Array(value.first) if value.one?
1433
+
1434
+ value.each do |v|
1435
+ Util.assert_type(@value_type, v)
1436
+ end
1437
+ value
1438
+ end
1439
+
1440
+ # Asserts that a given value is an Array
1441
+ # @param value [Object] value to be validated
1442
+ # @param message [String] error message to use when assertion fails
1443
+ # @yieldreturn [String] error message to use when assertion fails
1444
+ # @raise [ArgumentError] if the value is not an Array
1445
+ # @return [void]
1446
+ # @see Cassandra::Type#assert
1447
+ def assert(value, message = nil, &block)
1448
+ Util.assert_instance_of(::Array, value, message, &block)
1449
+ value.each do |v|
1450
+ Util.assert_type(@value_type, v, message, &block)
1451
+ end
1452
+ nil
1453
+ end
1454
+
1455
+ # @return [String] `"list<type>"`
1456
+ # @see Cassandra::Type#to_s
1457
+ def to_s
1458
+ "frozen<#{@value_type}>"
1459
+ end
1460
+
1461
+ def hash
1462
+ @hash ||= begin
1463
+ h = 17
1464
+ h = 31 * h + @kind.hash
1465
+ h = 31 * h + @value_type.hash
1466
+ h
1467
+ end
1468
+ end
1469
+
1470
+ def eql?(other)
1471
+ other.is_a?(List) && @value_type == other.value_type
1472
+ end
1473
+
1474
+ alias == eql?
1475
+ end
1476
+
1477
+ def frozen(value_type)
1478
+ Util.assert_instance_of(Cassandra::Type, value_type,
1479
+ "frozen type must be a Cassandra::Type, #{value_type.inspect} given")
1480
+
1481
+ Frozen.new(value_type)
1482
+ end
1483
+
1417
1484
  # @return [Cassandra::Types::Text] text type since varchar is an alias for text
1418
1485
  def varchar
1419
1486
  Text
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Cassandra
20
- VERSION = '3.2.2'.freeze
20
+ VERSION = '3.2.3'.freeze
21
21
  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: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Hultberg
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-01-29 00:00:00.000000000 Z
13
+ date: 2018-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ione