sessionm-cassandra_object 2.3.3 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,12 @@ module CassandraObject
4
4
  module ClassMethods
5
5
  def find(key, opts={})
6
6
  # kludge to play nice ActiveRecord association
7
- opts.assert_valid_keys(:conditions)
7
+ opts.assert_valid_keys(:conditions, :consistency)
8
+ opts[:consistency] ||= thrift_read_consistency
8
9
  raise(ArgumentError, "unexpected conditions") if opts[:conditions].present?
9
10
  raise(CassandraObject::InvalidKey, "invalid key: #{key}") if key.blank? || ! parse_key(key)
10
11
 
11
- if (attributes = ActiveSupport::Notifications.instrument("get.cassandra_object", column_family: column_family, key: key) { connection.get(column_family, key) }) &&
12
+ if (attributes = ActiveSupport::Notifications.instrument("get.cassandra_object", column_family: column_family, key: key) { connection.get(column_family, key, opts.slice(:consistency)) }) &&
12
13
  !attributes.empty?
13
14
  instantiate(key, attributes)
14
15
  else
@@ -16,15 +17,18 @@ module CassandraObject
16
17
  end
17
18
  end
18
19
 
19
- def find_by_id(key)
20
- find(key)
20
+ def find_by_id(key, opts={})
21
+ find(key, opts)
21
22
  rescue CassandraObject::RecordNotFound
22
23
  nil
23
24
  end
24
25
 
25
- def get_counter(key, column)
26
+ def get_counter(key, column, opts={})
27
+ opts.assert_valid_keys(:consistency)
28
+ opts[:consistency] ||= thrift_read_consistency
29
+
26
30
  result = ActiveSupport::Notifications.instrument("get_counter.cassandra_object", column_family: column_family, key: key, column: column) do
27
- connection.get(column_family, key, column)
31
+ connection.get(column_family, key, column, opts)
28
32
  end
29
33
 
30
34
  if result
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sessionm-cassandra_object'
5
- s.version = '2.3.3'
5
+ s.version = '2.3.4'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
 
metadata CHANGED
@@ -1,81 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sessionm-cassandra_object
3
- version: !ruby/object:Gem::Version
4
- hash: 5
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.4
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 3
9
- - 3
10
- version: 2.3.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Koziarski
14
9
  - gotime
15
10
  - sessionm
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2012-12-14 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
14
+ date: 2012-12-22 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
23
17
  name: rails
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
26
19
  none: false
27
- requirements:
20
+ requirements:
28
21
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 21
31
- segments:
32
- - 3
33
- - 0
34
- - 9
22
+ - !ruby/object:Gem::Version
35
23
  version: 3.0.9
36
24
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: cassandra
40
25
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: !ruby/object:Gem::Requirement
42
27
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 53
47
- segments:
48
- - 0
49
- - 11
50
- - 3
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 3.0.9
32
+ - !ruby/object:Gem::Dependency
33
+ name: cassandra
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
51
39
  version: 0.11.3
52
40
  type: :runtime
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: bundler
56
41
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
58
43
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 23
63
- segments:
64
- - 1
65
- - 0
66
- - 0
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.11.3
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
67
55
  version: 1.0.0
68
56
  type: :development
69
- version_requirements: *id003
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.0
70
64
  description: Cassandra ActiveModel
71
65
  email: klange@sessionm.com
72
66
  executables: []
73
-
74
67
  extensions: []
75
-
76
- extra_rdoc_files:
68
+ extra_rdoc_files:
77
69
  - README.markdown
78
- files:
70
+ files:
79
71
  - .gitignore
80
72
  - CHANGELOG
81
73
  - Gemfile
@@ -168,42 +160,29 @@ files:
168
160
  - test/validations_test.rb
169
161
  homepage: http://github.com/sessionm/cassandra_object
170
162
  licenses: []
171
-
172
163
  post_install_message:
173
164
  rdoc_options: []
174
-
175
- require_paths:
165
+ require_paths:
176
166
  - lib
177
- required_ruby_version: !ruby/object:Gem::Requirement
167
+ required_ruby_version: !ruby/object:Gem::Requirement
178
168
  none: false
179
- requirements:
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- hash: 55
183
- segments:
184
- - 1
185
- - 9
186
- - 2
169
+ requirements:
170
+ - - ! '>='
171
+ - !ruby/object:Gem::Version
187
172
  version: 1.9.2
188
- required_rubygems_version: !ruby/object:Gem::Requirement
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
174
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- hash: 17
194
- segments:
195
- - 1
196
- - 3
197
- - 5
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
198
178
  version: 1.3.5
199
179
  requirements: []
200
-
201
180
  rubyforge_project:
202
181
  rubygems_version: 1.8.24
203
182
  signing_key:
204
183
  specification_version: 3
205
184
  summary: Cassandra ActiveModel
206
- test_files:
185
+ test_files:
207
186
  - test/active_model_test.rb
208
187
  - test/attributes_test.rb
209
188
  - test/base_test.rb