sessionm-cassandra_object 2.2.14 → 2.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cassandra_object.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
module CassandraObject
|
2
|
+
module AsyncConnection
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
class_attribute :connection_spec
|
7
|
+
|
8
|
+
class_eval do
|
9
|
+
@@fiber_connections = {}
|
10
|
+
def self.connection()
|
11
|
+
@@fiber_connections[Fiber.current.object_id] ||=
|
12
|
+
begin
|
13
|
+
spec = connection_spec.dup
|
14
|
+
|
15
|
+
if EM.reactor_running?
|
16
|
+
require 'thrift_client/event_machine'
|
17
|
+
spec[:thrift].merge!(:transport => Thrift::EventMachineTransport,
|
18
|
+
:transport_wrapper => nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
Cassandra.new(spec[:keyspace], spec[:servers], spec[:thrift])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def self.connection?() !!connection end
|
25
|
+
|
26
|
+
def connection
|
27
|
+
defined?(@connection) ? @connection : singleton_class.connection
|
28
|
+
end
|
29
|
+
|
30
|
+
def connection?
|
31
|
+
!!connection
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module ClassMethods
|
37
|
+
DEFAULT_OPTIONS = {
|
38
|
+
servers: "127.0.0.1:9160",
|
39
|
+
thrift: {}
|
40
|
+
}
|
41
|
+
def establish_connection(spec)
|
42
|
+
spec.reverse_merge!(DEFAULT_OPTIONS)
|
43
|
+
spec[:thrift].symbolize_keys!
|
44
|
+
self.connection_spec = spec
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -30,7 +30,9 @@ module CassandraObject
|
|
30
30
|
include ActiveModel::Conversion
|
31
31
|
extend ActiveSupport::DescendantsTracker
|
32
32
|
|
33
|
-
|
33
|
+
#TODO: make the connection type configurable
|
34
|
+
include AsyncConnection
|
35
|
+
#include Connection
|
34
36
|
include Consistency
|
35
37
|
include Identity
|
36
38
|
include Attributes
|
metadata
CHANGED
@@ -1,58 +1,74 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sessionm-cassandra_object
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 2
|
8
|
+
- 16
|
9
|
+
version: 2.2.16
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Michael Koziarski
|
9
13
|
- gotime
|
10
14
|
- sessionm
|
11
15
|
autorequire:
|
12
16
|
bindir: bin
|
13
17
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
|
19
|
+
date: 2011-08-12 00:00:00 -04:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
17
23
|
name: rails
|
18
|
-
|
19
|
-
|
20
|
-
requirements:
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
21
27
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 0
|
32
|
+
version: "3.0"
|
24
33
|
type: :runtime
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
28
36
|
name: cassandra
|
29
|
-
|
30
|
-
|
31
|
-
requirements:
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
32
40
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 11
|
45
|
+
- 3
|
34
46
|
version: 0.11.3
|
35
47
|
type: :runtime
|
36
|
-
|
37
|
-
|
38
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
39
50
|
name: bundler
|
40
|
-
|
41
|
-
|
42
|
-
requirements:
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
43
54
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 0
|
59
|
+
- 0
|
45
60
|
version: 1.0.0
|
46
61
|
type: :development
|
47
|
-
|
48
|
-
version_requirements: *70124182832160
|
62
|
+
version_requirements: *id003
|
49
63
|
description: Cassandra ActiveModel
|
50
64
|
email: klange@sessionm.com
|
51
65
|
executables: []
|
66
|
+
|
52
67
|
extensions: []
|
53
|
-
|
68
|
+
|
69
|
+
extra_rdoc_files:
|
54
70
|
- README.markdown
|
55
|
-
files:
|
71
|
+
files:
|
56
72
|
- .gitignore
|
57
73
|
- CHANGELOG
|
58
74
|
- Gemfile
|
@@ -64,6 +80,7 @@ files:
|
|
64
80
|
- lib/cassandra_object/associations.rb
|
65
81
|
- lib/cassandra_object/associations/one_to_many.rb
|
66
82
|
- lib/cassandra_object/associations/one_to_one.rb
|
83
|
+
- lib/cassandra_object/async_connection.rb
|
67
84
|
- lib/cassandra_object/attributes.rb
|
68
85
|
- lib/cassandra_object/base.rb
|
69
86
|
- lib/cassandra_object/batches.rb
|
@@ -137,31 +154,41 @@ files:
|
|
137
154
|
- test/types/time_type_test.rb
|
138
155
|
- test/types/utf8_string_type_test.rb
|
139
156
|
- test/validations_test.rb
|
157
|
+
has_rdoc: true
|
140
158
|
homepage: http://github.com/sessionm/cassandra_object
|
141
159
|
licenses: []
|
160
|
+
|
142
161
|
post_install_message:
|
143
162
|
rdoc_options: []
|
144
|
-
|
163
|
+
|
164
|
+
require_paths:
|
145
165
|
- lib
|
146
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
segments:
|
171
|
+
- 1
|
172
|
+
- 9
|
173
|
+
- 2
|
151
174
|
version: 1.9.2
|
152
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
segments:
|
180
|
+
- 1
|
181
|
+
- 3
|
182
|
+
- 5
|
157
183
|
version: 1.3.5
|
158
184
|
requirements: []
|
185
|
+
|
159
186
|
rubyforge_project:
|
160
|
-
rubygems_version: 1.
|
187
|
+
rubygems_version: 1.3.6
|
161
188
|
signing_key:
|
162
189
|
specification_version: 3
|
163
190
|
summary: Cassandra ActiveModel
|
164
|
-
test_files:
|
191
|
+
test_files:
|
165
192
|
- test/active_model_test.rb
|
166
193
|
- test/base_test.rb
|
167
194
|
- test/batches_test.rb
|