cassandra-driver 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjRlMWI4NGUyYzNjNzMzZTQ1MTNiNDE4NTIxODk3NGIwOTIwZjVkZg==
4
+ YjZmNzhmODM4ZDExNTc4YWY0MDEzMTcwMmRiYjJiYzhhMmIwNzBjOQ==
5
5
  data.tar.gz: !binary |-
6
- YWMwYmNlM2RmYzIzYWY5MGQ2MmIyNjU5NTU3NTkyNGMxYmY0NTAyNA==
6
+ OWY4MjRmNjhiMDQyMzQ0NmJiZGQ1N2JhYzM2MzkwYzc2NmEwNDZmMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTdhMWZiODYzYTViZGJiNTY5NDYzMjQ2ZDZiMDE2MTY4MTI3NTY3NjM0Y2Rl
10
- YmE0MjkxYmZhNDI0OTliMDcyZWUyMjM3M2E2OWIzNzg2MGJkODVlMjhmYmQ3
11
- N2NhYzQ5NmY2MmQxYzdkY2U3NTJmZDAyMjI2MWE4MTM3YTZkMmY=
9
+ ZGZhOTkxYmVlZDhmM2QzYjI0YjgxZjQzYzU5MTU2MTQwMzJmNzRmYmQ0MWE5
10
+ MTRkOGZmMzA5YjIzOTlkNWRlYTBlODdlYjM4NTRmYjNlN2MwNzM1ZGViNDMx
11
+ MTUwNWZlZGRiMDA1MWFhNjEzY2UzMTNlMGFiYWVhNzY0ZjNlZWI=
12
12
  data.tar.gz: !binary |-
13
- Y2IwOGMwOGQzYTlkZjUzYjQ1NzFlZjJhNTY3YWM2MmNjN2QxM2ExZmU0YWZh
14
- ODBjYjQ4ODUwZDAzMTZjMzRhMDEwYzhkZDA4Zjk3NjIzOWI1OWM2ZGViYjQ0
15
- ZjZkZjM0YTEzNTY0YTAxNzA0YWEwYjdlOWY2NjkyOWNkZDE4YjM=
13
+ YjJjMTZjYmUzMzlmMWM1MWQ1OGU4YWQ0ZDlhMmYwNDk3NzNlOTUxNGRmNGZh
14
+ ZmYwNDE1N2RmMTYyNDgwM2NkNzg1Njc0MTc5ZTJlOTM0ZDQyYjg4ZWNlZDUw
15
+ ODQyOWFiNjg3N2RkMTA3NjRiY2U0MDVkNDNhZWQ5YzMxZWQzZjA=
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Datastax Ruby Driver for Apache Cassandra
2
2
 
3
- *If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can [find the documentation for the latest version through ruby driver docs](http://docs.datastax.com/en/latest-ruby-driver/ruby-driver/whatsNew.html) or via the release tags, [e.g. v3.0.2](https://github.com/datastax/ruby-driver/tree/v3.0.2).*
3
+ *If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can [find the documentation for the latest version through ruby driver docs](http://docs.datastax.com/en/latest-ruby-driver/ruby-driver/whatsNew.html) or via the release tags, [e.g. v3.0.3](https://github.com/datastax/ruby-driver/tree/v3.0.3).*
4
4
 
5
5
  [![Build Status](https://travis-ci.org/datastax/ruby-driver.svg?branch=master)](https://travis-ci.org/datastax/ruby-driver)
6
6
 
@@ -90,11 +90,11 @@ __Note__: if you want to use compression you should also install [snappy](http:/
90
90
 
91
91
  ## Upgrading from cql-rb
92
92
 
93
- Some of the new features added to the driver have unfortunately led to changes in the original cql-rb API. In the examples directory, you can find [an example of how to wrap the ruby driver to achieve almost complete interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.0.2/examples/cql-rb-wrapper.rb) to assist you with gradual upgrade.
93
+ Some of the new features added to the driver have unfortunately led to changes in the original cql-rb API. In the examples directory, you can find [an example of how to wrap the ruby driver to achieve almost complete interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.0.3/examples/cql-rb-wrapper.rb) to assist you with gradual upgrade.
94
94
 
95
95
  ## What's new in v3.0
96
96
 
97
- See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.0.2/CHANGELOG.md) for details on patch versions.
97
+ See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.0.3/CHANGELOG.md) for details on patch versions.
98
98
 
99
99
  ### Features:
100
100
 
@@ -164,7 +164,7 @@ examples in the `features/` directory.
164
164
  ## Running tests
165
165
 
166
166
  If you don't feel like reading through the following instructions on how to run
167
- ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.0.2/.travis.yml).
167
+ ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.0.3/.travis.yml).
168
168
 
169
169
  * Check out the driver codebase and install test dependencies:
170
170
 
@@ -188,7 +188,7 @@ CASSANDRA_VERSION=2.0.17 bundle exec rake test # run both as well as integration
188
188
  ## Changelog & versioning
189
189
 
190
190
  Check out the [releases on GitHub](https://github.com/datastax/ruby-driver/releases) and
191
- [changelog](https://github.com/datastax/ruby-driver/blob/v3.0.2/CHANGELOG.md). Version
191
+ [changelog](https://github.com/datastax/ruby-driver/blob/v3.0.3/CHANGELOG.md). Version
192
192
  numbering follows the [semantic versioning](http://semver.org/) scheme.
193
193
 
194
194
  Private and experimental APIs, defined as whatever is not in the
@@ -107,10 +107,8 @@ module Cassandra
107
107
  nil
108
108
  else
109
109
  view_row = rows_views.first
110
- base_table = @schema.keyspace(keyspace_name).table(view_row['base_table_name'])
111
110
  create_materialized_view(view_row,
112
- rows_columns,
113
- base_table)
111
+ rows_columns)
114
112
  end
115
113
  end
116
114
  end
@@ -1216,10 +1214,8 @@ module Cassandra
1216
1214
 
1217
1215
  views = rows_views.each_with_object({}) do |row, h|
1218
1216
  view_name = row['view_name']
1219
- base_table = tables[row['base_table_name']]
1220
1217
  h[view_name] = create_materialized_view(row,
1221
1218
  lookup_columns[view_name],
1222
- base_table,
1223
1219
  types)
1224
1220
  end
1225
1221
 
@@ -1366,9 +1362,10 @@ module Cassandra
1366
1362
  options['target'], options))
1367
1363
  end
1368
1364
 
1369
- def create_materialized_view(view_data, rows_columns, base_table, types = nil)
1365
+ def create_materialized_view(view_data, rows_columns, types = nil)
1370
1366
  keyspace_name = view_data['keyspace_name']
1371
1367
  view_name = view_data['view_name']
1368
+ base_table_name = view_data['base_table_name']
1372
1369
  include_all_columns = view_data['include_all_columns']
1373
1370
  where_clause = view_data['where_clause']
1374
1371
 
@@ -1406,7 +1403,7 @@ module Cassandra
1406
1403
  view_options,
1407
1404
  include_all_columns,
1408
1405
  where_clause,
1409
- base_table,
1406
+ base_table_name,
1410
1407
  view_data['id'])
1411
1408
  end
1412
1409
  end
@@ -286,13 +286,12 @@ module Cassandra
286
286
 
287
287
  # @private
288
288
  # keyspace attribute may be nil because when this object was constructed, we didn't have
289
- # its keyspace constructed yet. So allow updating @keyspace if it's nil, thus
289
+ # its keyspace constructed yet. So allow updating @keyspace, thus
290
290
  # allowing fetchers to create keyspace, table/view, and hook them together without
291
291
  # worrying about chickens and eggs.
292
- # NOTE: Ignore the set request if the @keyspace is already set.
293
292
  # rubocop:disable Style/AccessorMethodName
294
293
  def set_keyspace(keyspace)
295
- @keyspace = keyspace unless @keyspace
294
+ @keyspace = keyspace
296
295
  end
297
296
 
298
297
  # @private
@@ -54,7 +54,7 @@ module Cassandra
54
54
  #
55
55
  # @see https://github.com/apache/cassandra/blob/cassandra-3.4/doc/native_protocol_v4.spec#L125-L131 Description
56
56
  # of custom payload in Cassandra native protocol v4.
57
- # @see https://datastax.github.io/java-driver/manual/custom_payloads/#enabling-custom-payloads-on-c-nodes
57
+ # @see http://docs.datastax.com/en/developer/java-driver/3.0/supplemental/manual/custom_payloads/?local=true&nav=toc#enabling-custom-payloads-on-c-nodes
58
58
  # Enabling custom payloads on Cassandra nodes.
59
59
  #
60
60
  # @example Sending a custom payload
@@ -113,13 +113,15 @@ module Cassandra
113
113
  # @return [Boolean] whether this keyspace has a materialized view with the given name
114
114
  # @param name [String] materialized view name
115
115
  def has_materialized_view?(name)
116
- @views.key?(name)
116
+ # We check if the view exists *and* that its base-table is set. If base-table isn't available,
117
+ # it will be soon, so the user can poll on this method until we return a fully-baked materialized view.
118
+ @views.key?(name) && !@views[name].base_table.nil?
117
119
  end
118
120
 
119
121
  # @return [Cassandra::MaterializedView, nil] a materialized view or nil
120
122
  # @param name [String] materialized view name
121
123
  def materialized_view(name)
122
- @views[name]
124
+ @views[name] if has_materialized_view?(name)
123
125
  end
124
126
 
125
127
  # Yield or enumerate each materialized view defined in this keyspace
@@ -130,10 +132,16 @@ module Cassandra
130
132
  # @return [Array<Cassandra::MaterializedView>] a list of materialized views
131
133
  def each_materialized_view(&block)
132
134
  if block_given?
133
- @views.each_value(&block)
135
+ @views.each_value do |v|
136
+ block.call(v) if v.base_table
137
+ end
134
138
  self
135
139
  else
136
- @views.values
140
+ result = []
141
+ @views.each_value do |v|
142
+ result << v if v.base_table
143
+ end
144
+ result
137
145
  end
138
146
  end
139
147
  alias materialized_views each_materialized_view
@@ -21,9 +21,6 @@ module Cassandra
21
21
  # @see Cassandra::Keyspace#each_materialized_view
22
22
  # @see Cassandra::Keyspace#materialized_view
23
23
  class MaterializedView < ColumnContainer
24
- # @return [Table] the table that this materialized view applies to.
25
- attr_reader :base_table
26
-
27
24
  # @private
28
25
  def initialize(keyspace,
29
26
  name,
@@ -33,12 +30,17 @@ module Cassandra
33
30
  options,
34
31
  include_all_columns,
35
32
  where_clause,
36
- base_table,
33
+ base_table_name,
37
34
  id)
38
35
  super(keyspace, name, partition_key, clustering_columns, other_columns, options, id)
39
36
  @include_all_columns = include_all_columns
40
37
  @where_clause = where_clause
41
- @base_table = base_table
38
+ @base_table_name = base_table_name
39
+ end
40
+
41
+ # @return [Table] the table that this materialized view applies to.
42
+ def base_table
43
+ @keyspace.table(@base_table_name)
42
44
  end
43
45
 
44
46
  # @return [String] a cql representation of this materialized view
@@ -52,7 +54,7 @@ module Cassandra
52
54
  Util.escape_name(column.name)
53
55
  end.join(', ')
54
56
  end
55
- cql << "\nFROM #{keyspace_name}.#{Util.escape_name(@base_table.name)}"
57
+ cql << "\nFROM #{keyspace_name}.#{Util.escape_name(@base_table_name)}"
56
58
  cql << "\nWHERE #{@where_clause}" if @where_clause
57
59
  cql << "\nPRIMARY KEY (("
58
60
  cql << @partition_key.map do |column|
@@ -74,7 +76,7 @@ module Cassandra
74
76
  super.eql?(other) &&
75
77
  @include_all_columns == other.include_all_columns &&
76
78
  @where_clause == other.where_clause &&
77
- @base_table == other.base_table
79
+ @base_table_name == other.base_table.name
78
80
  end
79
81
  alias == eql?
80
82
 
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Cassandra
20
- VERSION = '3.0.2'.freeze
20
+ VERSION = '3.0.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.0.2
4
+ version: 3.0.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: 2016-06-27 00:00:00.000000000 Z
13
+ date: 2016-07-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ione