gotime-cassandra_object 0.7.8 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/lib/cassandra_object/base.rb +4 -1
- data/lib/cassandra_object/find_each.rb +28 -0
- data/lib/cassandra_object/find_with_ids.rb +24 -0
- metadata +24 -80
- data/CHANGELOG +0 -3
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -42
- data/LICENSE +0 -13
- data/TODO +0 -2
- data/gotime-cassandra_object.gemspec +0 -144
- data/lib/cassandra_object/generators/templates/migration.rb.erb +0 -11
- data/lib/cassandra_object/version.rb +0 -9
- data/test/config/cassandra.in.sh +0 -53
- data/test/config/log4j.properties +0 -38
- data/test/config/storage-conf.xml +0 -221
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 [Michael Koziarski]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -17,6 +17,8 @@ require 'cassandra_object/cursor'
|
|
17
17
|
require 'cassandra_object/collection'
|
18
18
|
require 'cassandra_object/types'
|
19
19
|
require 'cassandra_object/mocking'
|
20
|
+
require 'cassandra_object/find_each'
|
21
|
+
require 'cassandra_object/find_with_ids'
|
20
22
|
|
21
23
|
require 'cassandra_object/log_subscriber'
|
22
24
|
|
@@ -56,9 +58,10 @@ module CassandraObject
|
|
56
58
|
include Persistence
|
57
59
|
include Indexes
|
58
60
|
include Dirty
|
59
|
-
|
60
61
|
include Validation
|
61
62
|
include Associations
|
63
|
+
include FindEach
|
64
|
+
include FindWithIds
|
62
65
|
|
63
66
|
attr_reader :attributes
|
64
67
|
attr_accessor :key
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module CassandraObject
|
2
|
+
module FindEach
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def find_each(options={})
|
7
|
+
find_in_batches(options) do |records|
|
8
|
+
records.each { |record| yield record }
|
9
|
+
end
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def find_in_batches(options={})
|
14
|
+
start = options[:start] || ''
|
15
|
+
finish = options[:finish] || ''
|
16
|
+
batch_size = options[:batch_size] || 100
|
17
|
+
|
18
|
+
records = all(start..finish, limit: batch_size)
|
19
|
+
while records.any?
|
20
|
+
yield records
|
21
|
+
records = all(records.last.key.to_s..finish, limit: batch_size+1)
|
22
|
+
records.shift
|
23
|
+
end
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module CassandraObject
|
2
|
+
module FindWithIds
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def find_with_ids(ids, options=nil)
|
7
|
+
expects_array = ids.first.kind_of?(Array)
|
8
|
+
return ids.first if expects_array && ids.first.empty?
|
9
|
+
|
10
|
+
ids = ids.dup
|
11
|
+
ids.flatten!
|
12
|
+
ids.compact!
|
13
|
+
ids.collect!(&:to_s)
|
14
|
+
ids.uniq!
|
15
|
+
|
16
|
+
#raise RecordNotFound, "Couldn't find #{record_klass.name} without an ID" if ids.empty?
|
17
|
+
|
18
|
+
results = multi_get(ids).values.compact
|
19
|
+
|
20
|
+
results.size <= 1 && !expects_array ? results.first : results
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotime-cassandra_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 7
|
8
|
-
- 8
|
9
|
-
version: 0.7.8
|
4
|
+
prerelease:
|
5
|
+
version: 0.8.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Michael Koziarski
|
@@ -15,116 +11,96 @@ autorequire:
|
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
13
|
|
18
|
-
date: 2011-
|
14
|
+
date: 2011-03-09 00:00:00 -08:00
|
19
15
|
default_executable:
|
20
16
|
dependencies:
|
21
17
|
- !ruby/object:Gem::Dependency
|
22
18
|
name: activesupport
|
19
|
+
prerelease: false
|
23
20
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
21
|
none: false
|
25
22
|
requirements:
|
26
23
|
- - ~>
|
27
24
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
25
|
version: "3"
|
31
26
|
type: :runtime
|
32
|
-
prerelease: false
|
33
27
|
version_requirements: *id001
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: activemodel
|
30
|
+
prerelease: false
|
36
31
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
32
|
none: false
|
38
33
|
requirements:
|
39
34
|
- - ~>
|
40
35
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 3
|
43
36
|
version: "3"
|
44
37
|
type: :runtime
|
45
|
-
prerelease: false
|
46
38
|
version_requirements: *id002
|
47
39
|
- !ruby/object:Gem::Dependency
|
48
40
|
name: cassandra
|
41
|
+
prerelease: false
|
49
42
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
43
|
none: false
|
51
44
|
requirements:
|
52
45
|
- - ">="
|
53
46
|
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
47
|
version: "0"
|
57
48
|
type: :runtime
|
58
|
-
prerelease: false
|
59
49
|
version_requirements: *id003
|
60
50
|
- !ruby/object:Gem::Dependency
|
61
51
|
name: nokogiri
|
52
|
+
prerelease: false
|
62
53
|
requirement: &id004 !ruby/object:Gem::Requirement
|
63
54
|
none: false
|
64
55
|
requirements:
|
65
56
|
- - ">="
|
66
57
|
- !ruby/object:Gem::Version
|
67
|
-
segments:
|
68
|
-
- 0
|
69
58
|
version: "0"
|
70
59
|
type: :runtime
|
71
|
-
prerelease: false
|
72
60
|
version_requirements: *id004
|
73
61
|
- !ruby/object:Gem::Dependency
|
74
62
|
name: shoulda
|
63
|
+
prerelease: false
|
75
64
|
requirement: &id005 !ruby/object:Gem::Requirement
|
76
65
|
none: false
|
77
66
|
requirements:
|
78
67
|
- - ">="
|
79
68
|
- !ruby/object:Gem::Version
|
80
|
-
segments:
|
81
|
-
- 0
|
82
69
|
version: "0"
|
83
70
|
type: :development
|
84
|
-
prerelease: false
|
85
71
|
version_requirements: *id005
|
86
72
|
- !ruby/object:Gem::Dependency
|
87
73
|
name: bundler
|
74
|
+
prerelease: false
|
88
75
|
requirement: &id006 !ruby/object:Gem::Requirement
|
89
76
|
none: false
|
90
77
|
requirements:
|
91
78
|
- - ~>
|
92
79
|
- !ruby/object:Gem::Version
|
93
|
-
segments:
|
94
|
-
- 1
|
95
|
-
- 0
|
96
|
-
- 0
|
97
80
|
version: 1.0.0
|
98
81
|
type: :development
|
99
|
-
prerelease: false
|
100
82
|
version_requirements: *id006
|
101
83
|
- !ruby/object:Gem::Dependency
|
102
84
|
name: jeweler
|
85
|
+
prerelease: false
|
103
86
|
requirement: &id007 !ruby/object:Gem::Requirement
|
104
87
|
none: false
|
105
88
|
requirements:
|
106
89
|
- - ~>
|
107
90
|
- !ruby/object:Gem::Version
|
108
|
-
segments:
|
109
|
-
- 1
|
110
|
-
- 5
|
111
|
-
- 1
|
112
91
|
version: 1.5.1
|
113
92
|
type: :development
|
114
|
-
prerelease: false
|
115
93
|
version_requirements: *id007
|
116
94
|
- !ruby/object:Gem::Dependency
|
117
95
|
name: rcov
|
96
|
+
prerelease: false
|
118
97
|
requirement: &id008 !ruby/object:Gem::Requirement
|
119
98
|
none: false
|
120
99
|
requirements:
|
121
100
|
- - ">="
|
122
101
|
- !ruby/object:Gem::Version
|
123
|
-
segments:
|
124
|
-
- 0
|
125
102
|
version: "0"
|
126
103
|
type: :development
|
127
|
-
prerelease: false
|
128
104
|
version_requirements: *id008
|
129
105
|
description: Cassandra ActiveModel
|
130
106
|
email: grantr@gmail.com
|
@@ -133,22 +109,14 @@ executables: []
|
|
133
109
|
extensions: []
|
134
110
|
|
135
111
|
extra_rdoc_files:
|
136
|
-
- LICENSE
|
137
112
|
- README.markdown
|
138
|
-
- TODO
|
139
113
|
files:
|
140
|
-
-
|
141
|
-
- Gemfile
|
142
|
-
- Gemfile.lock
|
143
|
-
- LICENSE
|
144
|
-
- README.markdown
|
114
|
+
- MIT-LICENSE
|
145
115
|
- Rakefile
|
146
|
-
-
|
147
|
-
- gotime-cassandra_object.gemspec
|
148
|
-
- lib/cassandra_object.rb
|
149
|
-
- lib/cassandra_object/associations.rb
|
116
|
+
- README.markdown
|
150
117
|
- lib/cassandra_object/associations/one_to_many.rb
|
151
118
|
- lib/cassandra_object/associations/one_to_one.rb
|
119
|
+
- lib/cassandra_object/associations.rb
|
152
120
|
- lib/cassandra_object/attributes.rb
|
153
121
|
- lib/cassandra_object/base.rb
|
154
122
|
- lib/cassandra_object/callbacks.rb
|
@@ -156,13 +124,14 @@ files:
|
|
156
124
|
- lib/cassandra_object/consistency.rb
|
157
125
|
- lib/cassandra_object/cursor.rb
|
158
126
|
- lib/cassandra_object/dirty.rb
|
127
|
+
- lib/cassandra_object/find_each.rb
|
128
|
+
- lib/cassandra_object/find_with_ids.rb
|
159
129
|
- lib/cassandra_object/generators/migration_generator.rb
|
160
|
-
- lib/cassandra_object/generators/templates/migration.rb.erb
|
161
|
-
- lib/cassandra_object/identity.rb
|
162
130
|
- lib/cassandra_object/identity/abstract_key_factory.rb
|
163
131
|
- lib/cassandra_object/identity/key.rb
|
164
132
|
- lib/cassandra_object/identity/natural_key_factory.rb
|
165
133
|
- lib/cassandra_object/identity/uuid_key_factory.rb
|
134
|
+
- lib/cassandra_object/identity.rb
|
166
135
|
- lib/cassandra_object/indexes.rb
|
167
136
|
- lib/cassandra_object/log_subscriber.rb
|
168
137
|
- lib/cassandra_object/migration.rb
|
@@ -177,13 +146,10 @@ files:
|
|
177
146
|
- lib/cassandra_object/type_registration.rb
|
178
147
|
- lib/cassandra_object/types.rb
|
179
148
|
- lib/cassandra_object/validation.rb
|
180
|
-
- lib/cassandra_object
|
149
|
+
- lib/cassandra_object.rb
|
181
150
|
- test/active_model_test.rb
|
182
151
|
- test/basic_scenarios_test.rb
|
183
152
|
- test/callbacks_test.rb
|
184
|
-
- test/config/cassandra.in.sh
|
185
|
-
- test/config/log4j.properties
|
186
|
-
- test/config/storage-conf.xml
|
187
153
|
- test/connection.rb
|
188
154
|
- test/cursor_test.rb
|
189
155
|
- test/dirty_test.rb
|
@@ -201,8 +167,8 @@ files:
|
|
201
167
|
- test/z_mock_test.rb
|
202
168
|
has_rdoc: true
|
203
169
|
homepage: http://github.com/gotime/cassandra_object
|
204
|
-
licenses:
|
205
|
-
|
170
|
+
licenses: []
|
171
|
+
|
206
172
|
post_install_message:
|
207
173
|
rdoc_options: []
|
208
174
|
|
@@ -213,41 +179,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
179
|
requirements:
|
214
180
|
- - ">="
|
215
181
|
- !ruby/object:Gem::Version
|
216
|
-
hash: -64604789628622989
|
217
|
-
segments:
|
218
|
-
- 0
|
219
182
|
version: "0"
|
220
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
184
|
none: false
|
222
185
|
requirements:
|
223
186
|
- - ">="
|
224
187
|
- !ruby/object:Gem::Version
|
225
|
-
|
226
|
-
- 0
|
227
|
-
version: "0"
|
188
|
+
version: 1.3.5
|
228
189
|
requirements: []
|
229
190
|
|
230
191
|
rubyforge_project:
|
231
|
-
rubygems_version: 1.
|
192
|
+
rubygems_version: 1.6.1
|
232
193
|
signing_key:
|
233
194
|
specification_version: 3
|
234
195
|
summary: Cassandra ActiveModel
|
235
|
-
test_files:
|
236
|
-
|
237
|
-
- test/basic_scenarios_test.rb
|
238
|
-
- test/callbacks_test.rb
|
239
|
-
- test/connection.rb
|
240
|
-
- test/cursor_test.rb
|
241
|
-
- test/dirty_test.rb
|
242
|
-
- test/fixture_models.rb
|
243
|
-
- test/identity/natural_key_factory_test.rb
|
244
|
-
- test/index_test.rb
|
245
|
-
- test/legacy/test_helper.rb
|
246
|
-
- test/migration_test.rb
|
247
|
-
- test/one_to_many_associations_test.rb
|
248
|
-
- test/test_case.rb
|
249
|
-
- test/test_helper.rb
|
250
|
-
- test/time_test.rb
|
251
|
-
- test/types_test.rb
|
252
|
-
- test/validation_test.rb
|
253
|
-
- test/z_mock_test.rb
|
196
|
+
test_files: []
|
197
|
+
|
data/CHANGELOG
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (3.0.3)
|
5
|
-
activesupport (= 3.0.3)
|
6
|
-
builder (~> 2.1.2)
|
7
|
-
i18n (~> 0.4)
|
8
|
-
activesupport (3.0.3)
|
9
|
-
builder (2.1.2)
|
10
|
-
cassandra (0.9.0)
|
11
|
-
json
|
12
|
-
rake
|
13
|
-
simple_uuid (>= 0.1.0)
|
14
|
-
thrift_client (>= 0.6.0)
|
15
|
-
git (1.2.5)
|
16
|
-
i18n (0.5.0)
|
17
|
-
jeweler (1.5.1)
|
18
|
-
bundler (~> 1.0.0)
|
19
|
-
git (>= 1.2.5)
|
20
|
-
rake
|
21
|
-
json (1.4.6)
|
22
|
-
nokogiri (1.4.4)
|
23
|
-
rake (0.8.7)
|
24
|
-
rcov (0.9.9)
|
25
|
-
shoulda (2.11.3)
|
26
|
-
simple_uuid (0.1.1)
|
27
|
-
thrift (0.5.0)
|
28
|
-
thrift_client (0.6.0)
|
29
|
-
thrift (~> 0.5.0)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
activemodel (~> 3)
|
36
|
-
activesupport (~> 3)
|
37
|
-
bundler (~> 1.0.0)
|
38
|
-
cassandra
|
39
|
-
jeweler (~> 1.5.1)
|
40
|
-
nokogiri
|
41
|
-
rcov
|
42
|
-
shoulda
|
data/LICENSE
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Koziarski Software Ltd
|
2
|
-
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
data/TODO
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{gotime-cassandra_object}
|
8
|
-
s.version = "0.7.8"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Michael Koziarski", "grantr"]
|
12
|
-
s.date = %q{2011-02-18}
|
13
|
-
s.description = %q{Cassandra ActiveModel}
|
14
|
-
s.email = %q{grantr@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown",
|
18
|
-
"TODO"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
"CHANGELOG",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE",
|
25
|
-
"README.markdown",
|
26
|
-
"Rakefile",
|
27
|
-
"TODO",
|
28
|
-
"gotime-cassandra_object.gemspec",
|
29
|
-
"lib/cassandra_object.rb",
|
30
|
-
"lib/cassandra_object/associations.rb",
|
31
|
-
"lib/cassandra_object/associations/one_to_many.rb",
|
32
|
-
"lib/cassandra_object/associations/one_to_one.rb",
|
33
|
-
"lib/cassandra_object/attributes.rb",
|
34
|
-
"lib/cassandra_object/base.rb",
|
35
|
-
"lib/cassandra_object/callbacks.rb",
|
36
|
-
"lib/cassandra_object/collection.rb",
|
37
|
-
"lib/cassandra_object/consistency.rb",
|
38
|
-
"lib/cassandra_object/cursor.rb",
|
39
|
-
"lib/cassandra_object/dirty.rb",
|
40
|
-
"lib/cassandra_object/generators/migration_generator.rb",
|
41
|
-
"lib/cassandra_object/generators/templates/migration.rb.erb",
|
42
|
-
"lib/cassandra_object/identity.rb",
|
43
|
-
"lib/cassandra_object/identity/abstract_key_factory.rb",
|
44
|
-
"lib/cassandra_object/identity/key.rb",
|
45
|
-
"lib/cassandra_object/identity/natural_key_factory.rb",
|
46
|
-
"lib/cassandra_object/identity/uuid_key_factory.rb",
|
47
|
-
"lib/cassandra_object/indexes.rb",
|
48
|
-
"lib/cassandra_object/log_subscriber.rb",
|
49
|
-
"lib/cassandra_object/migration.rb",
|
50
|
-
"lib/cassandra_object/migrations.rb",
|
51
|
-
"lib/cassandra_object/migrator.rb",
|
52
|
-
"lib/cassandra_object/mocking.rb",
|
53
|
-
"lib/cassandra_object/persistence.rb",
|
54
|
-
"lib/cassandra_object/serialization.rb",
|
55
|
-
"lib/cassandra_object/tasks/column_family.rb",
|
56
|
-
"lib/cassandra_object/tasks/keyspace.rb",
|
57
|
-
"lib/cassandra_object/tasks/ks.rb",
|
58
|
-
"lib/cassandra_object/type_registration.rb",
|
59
|
-
"lib/cassandra_object/types.rb",
|
60
|
-
"lib/cassandra_object/validation.rb",
|
61
|
-
"lib/cassandra_object/version.rb",
|
62
|
-
"test/active_model_test.rb",
|
63
|
-
"test/basic_scenarios_test.rb",
|
64
|
-
"test/callbacks_test.rb",
|
65
|
-
"test/config/cassandra.in.sh",
|
66
|
-
"test/config/log4j.properties",
|
67
|
-
"test/config/storage-conf.xml",
|
68
|
-
"test/connection.rb",
|
69
|
-
"test/cursor_test.rb",
|
70
|
-
"test/dirty_test.rb",
|
71
|
-
"test/fixture_models.rb",
|
72
|
-
"test/identity/natural_key_factory_test.rb",
|
73
|
-
"test/index_test.rb",
|
74
|
-
"test/legacy/test_helper.rb",
|
75
|
-
"test/migration_test.rb",
|
76
|
-
"test/one_to_many_associations_test.rb",
|
77
|
-
"test/test_case.rb",
|
78
|
-
"test/test_helper.rb",
|
79
|
-
"test/time_test.rb",
|
80
|
-
"test/types_test.rb",
|
81
|
-
"test/validation_test.rb",
|
82
|
-
"test/z_mock_test.rb"
|
83
|
-
]
|
84
|
-
s.homepage = %q{http://github.com/gotime/cassandra_object}
|
85
|
-
s.licenses = ["MIT"]
|
86
|
-
s.require_paths = ["lib"]
|
87
|
-
s.rubygems_version = %q{1.3.7}
|
88
|
-
s.summary = %q{Cassandra ActiveModel}
|
89
|
-
s.test_files = [
|
90
|
-
"test/active_model_test.rb",
|
91
|
-
"test/basic_scenarios_test.rb",
|
92
|
-
"test/callbacks_test.rb",
|
93
|
-
"test/connection.rb",
|
94
|
-
"test/cursor_test.rb",
|
95
|
-
"test/dirty_test.rb",
|
96
|
-
"test/fixture_models.rb",
|
97
|
-
"test/identity/natural_key_factory_test.rb",
|
98
|
-
"test/index_test.rb",
|
99
|
-
"test/legacy/test_helper.rb",
|
100
|
-
"test/migration_test.rb",
|
101
|
-
"test/one_to_many_associations_test.rb",
|
102
|
-
"test/test_case.rb",
|
103
|
-
"test/test_helper.rb",
|
104
|
-
"test/time_test.rb",
|
105
|
-
"test/types_test.rb",
|
106
|
-
"test/validation_test.rb",
|
107
|
-
"test/z_mock_test.rb"
|
108
|
-
]
|
109
|
-
|
110
|
-
if s.respond_to? :specification_version then
|
111
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
112
|
-
s.specification_version = 3
|
113
|
-
|
114
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
115
|
-
s.add_runtime_dependency(%q<activesupport>, ["~> 3"])
|
116
|
-
s.add_runtime_dependency(%q<activemodel>, ["~> 3"])
|
117
|
-
s.add_runtime_dependency(%q<cassandra>, [">= 0"])
|
118
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
119
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
120
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
121
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
122
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
123
|
-
else
|
124
|
-
s.add_dependency(%q<activesupport>, ["~> 3"])
|
125
|
-
s.add_dependency(%q<activemodel>, ["~> 3"])
|
126
|
-
s.add_dependency(%q<cassandra>, [">= 0"])
|
127
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
128
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
129
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
130
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
131
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
132
|
-
end
|
133
|
-
else
|
134
|
-
s.add_dependency(%q<activesupport>, ["~> 3"])
|
135
|
-
s.add_dependency(%q<activemodel>, ["~> 3"])
|
136
|
-
s.add_dependency(%q<cassandra>, [">= 0"])
|
137
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
138
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
139
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
140
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
141
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
data/test/config/cassandra.in.sh
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
cassandra_home=`dirname $0`/..
|
19
|
-
|
20
|
-
# The directory where Cassandra's configs live (required)
|
21
|
-
CASSANDRA_CONF=`pwd`/../test/config
|
22
|
-
|
23
|
-
# This can be the path to a jar file, or a directory containing the
|
24
|
-
# compiled classes. NOTE: This isn't needed by the startup script,
|
25
|
-
# it's just used here in constructing the classpath.
|
26
|
-
cassandra_bin=$cassandra_home/build/classes
|
27
|
-
#cassandra_bin=$cassandra_home/build/cassandra.jar
|
28
|
-
|
29
|
-
# The java classpath (required)
|
30
|
-
CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
|
31
|
-
|
32
|
-
for jar in $cassandra_home/lib/*.jar; do
|
33
|
-
CLASSPATH=$CLASSPATH:$jar
|
34
|
-
done
|
35
|
-
|
36
|
-
# Arguments to pass to the JVM
|
37
|
-
JVM_OPTS=" \
|
38
|
-
-ea \
|
39
|
-
-Xdebug \
|
40
|
-
-Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n \
|
41
|
-
-Xms128M \
|
42
|
-
-Xmx1G \
|
43
|
-
-XX:SurvivorRatio=8 \
|
44
|
-
-XX:TargetSurvivorRatio=90 \
|
45
|
-
-XX:+AggressiveOpts \
|
46
|
-
-XX:+UseParNewGC \
|
47
|
-
-XX:+UseConcMarkSweepGC \
|
48
|
-
-XX:CMSInitiatingOccupancyFraction=1 \
|
49
|
-
-XX:+CMSParallelRemarkEnabled \
|
50
|
-
-XX:+HeapDumpOnOutOfMemoryError \
|
51
|
-
-Dcom.sun.management.jmxremote.port=8080 \
|
52
|
-
-Dcom.sun.management.jmxremote.ssl=false \
|
53
|
-
-Dcom.sun.management.jmxremote.authenticate=false"
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
# for production, you should probably set the root to INFO
|
18
|
-
# and the pattern to %c instead of %l. (%l is slower.)
|
19
|
-
|
20
|
-
# output messages into a rolling log file as well as stdout
|
21
|
-
log4j.rootLogger=DEBUG,stdout,R
|
22
|
-
|
23
|
-
# stdout
|
24
|
-
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
25
|
-
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
26
|
-
|
27
|
-
# rolling log file ("system.log
|
28
|
-
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
|
29
|
-
log4j.appender.R.DatePattern='.'yyyy-MM-dd-HH
|
30
|
-
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
31
|
-
log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
|
32
|
-
# Edit the next line to point to your logs directory
|
33
|
-
log4j.appender.R.File=data/logs/system.log
|
34
|
-
|
35
|
-
# Application logging options
|
36
|
-
#log4j.logger.com.facebook=DEBUG
|
37
|
-
#log4j.logger.com.facebook.infrastructure.gms=DEBUG
|
38
|
-
#log4j.logger.com.facebook.infrastructure.db=DEBUG
|
@@ -1,221 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
~ Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
~ or more contributor license agreements. See the NOTICE file
|
4
|
-
~ distributed with this work for additional information
|
5
|
-
~ regarding copyright ownership. The ASF licenses this file
|
6
|
-
~ to you under the Apache License, Version 2.0 (the
|
7
|
-
~ "License"); you may not use this file except in compliance
|
8
|
-
~ with the License. You may obtain a copy of the License at
|
9
|
-
~
|
10
|
-
~ http:/www.apache.org/licenses/LICENSE-2.0
|
11
|
-
~
|
12
|
-
~ Unless required by applicable law or agreed to in writing,
|
13
|
-
~ software distributed under the License is distributed on an
|
14
|
-
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
~ KIND, either express or implied. See the License for the
|
16
|
-
~ specific language governing permissions and limitations
|
17
|
-
~ under the License.
|
18
|
-
-->
|
19
|
-
<Storage>
|
20
|
-
<!--======================================================================-->
|
21
|
-
<!-- Basic Configuration -->
|
22
|
-
<!--======================================================================-->
|
23
|
-
<ClusterName>Test</ClusterName>
|
24
|
-
|
25
|
-
<!-- Tables and ColumnFamilies
|
26
|
-
Think of a table as a namespace, not a relational table.
|
27
|
-
(ColumnFamilies are closer in meaning to those.)
|
28
|
-
|
29
|
-
There is an implicit table named 'system' for Cassandra internals.
|
30
|
-
-->
|
31
|
-
<Keyspaces>
|
32
|
-
<Keyspace Name="Twitter">
|
33
|
-
<KeysCachedFraction>0.01</KeysCachedFraction>
|
34
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Users" />
|
35
|
-
<ColumnFamily CompareWith="UTF8Type" Name="UserAudits" />
|
36
|
-
<ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="UserRelationships" />
|
37
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Usernames" />
|
38
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Statuses" />
|
39
|
-
<ColumnFamily CompareWith="UTF8Type" Name="StatusAudits" />
|
40
|
-
<ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="StatusRelationships" />
|
41
|
-
</Keyspace>
|
42
|
-
|
43
|
-
<Keyspace Name="Multiblog">
|
44
|
-
<KeysCachedFraction>0.01</KeysCachedFraction>
|
45
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Blogs"/>
|
46
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Comments"/>
|
47
|
-
</Keyspace>
|
48
|
-
|
49
|
-
<Keyspace Name="CassandraObject">
|
50
|
-
<KeysCachedFraction>0.01</KeysCachedFraction>
|
51
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Customers" />
|
52
|
-
<ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="CustomerRelationships" />
|
53
|
-
<ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="CustomersByLastName" />
|
54
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Invoices" />
|
55
|
-
<ColumnFamily CompareWith="UTF8Type" CompareSubcolumnsWith="TimeUUIDType" ColumnType="Super" Name="InvoiceRelationships" />
|
56
|
-
<ColumnFamily CompareWith="UTF8Type" Name="InvoicesByNumber" />
|
57
|
-
<ColumnFamily CompareWith="UTF8Type" Name="Payments" />
|
58
|
-
</Keyspace>
|
59
|
-
</Keyspaces>
|
60
|
-
|
61
|
-
<!-- Partitioner: any IPartitioner may be used, including your own
|
62
|
-
as long as it is on the classpath. Out of the box,
|
63
|
-
Cassandra provides
|
64
|
-
org.apache.cassandra.dht.RandomPartitioner and
|
65
|
-
org.apache.cassandra.dht.OrderPreservingPartitioner.
|
66
|
-
Range queries require using OrderPreservingPartitioner or a subclass.
|
67
|
-
|
68
|
-
Achtung! Changing this parameter requires wiping your data directories,
|
69
|
-
since the partitioner can modify the sstable on-disk format.
|
70
|
-
-->
|
71
|
-
<Partitioner>org.apache.cassandra.dht.OrderPreservingPartitioner</Partitioner>
|
72
|
-
|
73
|
-
<!-- If you are using the OrderPreservingPartitioner and you know your key
|
74
|
-
distribution, you can specify the token for this node to use.
|
75
|
-
(Keys are sent to the node with the "closest" token, so distributing
|
76
|
-
your tokens equally along the key distribution space will spread
|
77
|
-
keys evenly across your cluster.) This setting is only checked the
|
78
|
-
first time a node is started.
|
79
|
-
|
80
|
-
This can also be useful with RandomPartitioner to force equal
|
81
|
-
spacing of tokens around the hash space, especially for
|
82
|
-
clusters with a small number of nodes. -->
|
83
|
-
<InitialToken></InitialToken>
|
84
|
-
|
85
|
-
|
86
|
-
<!-- EndPointSnitch: Setting this to the class that implements IEndPointSnitch
|
87
|
-
which will see if two endpoints are in the same data center or on the same rack.
|
88
|
-
Out of the box, Cassandra provides
|
89
|
-
org.apache.cassandra.locator.EndPointSnitch
|
90
|
-
-->
|
91
|
-
<EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
|
92
|
-
|
93
|
-
<!-- Strategy: Setting this to the class that implements IReplicaPlacementStrategy
|
94
|
-
will change the way the node picker works.
|
95
|
-
Out of the box, Cassandra provides
|
96
|
-
org.apache.cassandra.locator.RackUnawareStrategy
|
97
|
-
org.apache.cassandra.locator.RackAwareStrategy
|
98
|
-
(place one replica in a different datacenter, and the
|
99
|
-
others on different racks in the same one.)
|
100
|
-
-->
|
101
|
-
<ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
|
102
|
-
|
103
|
-
<!-- Number of replicas of the data-->
|
104
|
-
<ReplicationFactor>1</ReplicationFactor>
|
105
|
-
|
106
|
-
<!-- Directories: Specify where Cassandra should store different data on disk
|
107
|
-
Keep the data disks and the CommitLog disks separate for best performance
|
108
|
-
-->
|
109
|
-
<CommitLogDirectory>data/commitlog</CommitLogDirectory>
|
110
|
-
<DataFileDirectories>
|
111
|
-
<DataFileDirectory>data/data</DataFileDirectory>
|
112
|
-
</DataFileDirectories>
|
113
|
-
<CalloutLocation>data/callouts</CalloutLocation>
|
114
|
-
<BootstrapFileDirectory>data/bootstrap</BootstrapFileDirectory>
|
115
|
-
<StagingFileDirectory>data/staging</StagingFileDirectory>
|
116
|
-
|
117
|
-
<!-- Addresses of hosts that are deemed contact points. Cassandra nodes use
|
118
|
-
this list of hosts to find each other and learn the topology of the ring.
|
119
|
-
You must change this if you are running multiple nodes!
|
120
|
-
-->
|
121
|
-
<Seeds>
|
122
|
-
<Seed>127.0.0.1</Seed>
|
123
|
-
</Seeds>
|
124
|
-
|
125
|
-
|
126
|
-
<!-- Miscellaneous -->
|
127
|
-
|
128
|
-
<!-- time to wait for a reply from other nodes before failing the command -->
|
129
|
-
<RpcTimeoutInMillis>5000</RpcTimeoutInMillis>
|
130
|
-
<!-- size to allow commitlog to grow to before creating a new segment -->
|
131
|
-
<CommitLogRotationThresholdInMB>128</CommitLogRotationThresholdInMB>
|
132
|
-
|
133
|
-
|
134
|
-
<!-- Local hosts and ports -->
|
135
|
-
|
136
|
-
<!-- Address to bind to and tell other nodes to connect to.
|
137
|
-
You _must_ change this if you want multiple nodes to be able
|
138
|
-
to communicate!
|
139
|
-
|
140
|
-
Leaving it blank leaves it up to InetAddress.getLocalHost().
|
141
|
-
This will always do the Right Thing *if* the node is properly
|
142
|
-
configured (hostname, name resolution, etc), and the Right
|
143
|
-
Thing is to use the address associated with the hostname (it
|
144
|
-
might not be). -->
|
145
|
-
<ListenAddress>localhost</ListenAddress>
|
146
|
-
<!-- TCP port, for commands and data -->
|
147
|
-
<StoragePort>7000</StoragePort>
|
148
|
-
<!-- UDP port, for membership communications (gossip) -->
|
149
|
-
<ControlPort>7001</ControlPort>
|
150
|
-
|
151
|
-
<!-- The address to bind the Thrift RPC service to. Unlike
|
152
|
-
ListenAddress above, you *can* specify 0.0.0.0 here if you want
|
153
|
-
Thrift to listen on all interfaces.
|
154
|
-
|
155
|
-
Leaving this blank has the same effect it does for ListenAddress,
|
156
|
-
(i.e. it will be based on the configured hostname of the node).
|
157
|
-
-->
|
158
|
-
<ThriftAddress>localhost</ThriftAddress>
|
159
|
-
<!-- Thrift RPC port (the port clients connect to). -->
|
160
|
-
<ThriftPort>9160</ThriftPort>
|
161
|
-
|
162
|
-
|
163
|
-
<!--======================================================================-->
|
164
|
-
<!-- Memory, Disk, and Performance -->
|
165
|
-
<!--======================================================================-->
|
166
|
-
|
167
|
-
<!-- Add column indexes to a row after its contents reach this size -->
|
168
|
-
<ColumnIndexSizeInKB>256</ColumnIndexSizeInKB>
|
169
|
-
|
170
|
-
<!--
|
171
|
-
The maximum amount of data to store in memory before flushing to
|
172
|
-
disk. Note: There is one memtable per column family, and this threshold
|
173
|
-
is based solely on the amount of data stored, not actual heap memory
|
174
|
-
usage (there is some overhead in indexing the columns).
|
175
|
-
-->
|
176
|
-
<MemtableSizeInMB>32</MemtableSizeInMB>
|
177
|
-
|
178
|
-
<!--
|
179
|
-
The maximum number of columns in millions to store in memory
|
180
|
-
before flushing to disk. This is also a per-memtable setting.
|
181
|
-
Use with MemtableSizeInMB to tune memory usage.
|
182
|
-
-->
|
183
|
-
<MemtableObjectCountInMillions>0.01</MemtableObjectCountInMillions>
|
184
|
-
|
185
|
-
<!-- Unlike most systems, in Cassandra writes are faster than
|
186
|
-
reads, so you can afford more of those in parallel.
|
187
|
-
A good rule of thumb is 2 concurrent reads per processor core.
|
188
|
-
You especially want more concurrentwrites if you are using
|
189
|
-
CommitLogSync + CommitLogSyncDelay. -->
|
190
|
-
<ConcurrentReads>8</ConcurrentReads>
|
191
|
-
<ConcurrentWrites>32</ConcurrentWrites>
|
192
|
-
|
193
|
-
<!-- Turn on CommitLogSync to improve durability.
|
194
|
-
When enabled, Cassandra won't ack writes until the commit log
|
195
|
-
has been synced to disk. This is less necessary in Cassandra
|
196
|
-
than in traditional databases since replication reduces the
|
197
|
-
odds of losing data from a failure after writing the log
|
198
|
-
entry but before it actually reaches the disk.
|
199
|
-
-->
|
200
|
-
<CommitLogSync>false</CommitLogSync>
|
201
|
-
<!-- Delay (in microseconds) during which additional commit log
|
202
|
-
entries may be written before fsync. This will increase
|
203
|
-
latency slightly, but can vastly improve throughput where
|
204
|
-
there are many writers. Set to zero to disable
|
205
|
-
(each entry will be synced individually).
|
206
|
-
Reasonable values range from a minimal 100 to even 10000
|
207
|
-
if throughput matters more than latency. (10000us = 10ms
|
208
|
-
write latency isn't even that bad by traditional db
|
209
|
-
standards.)
|
210
|
-
-->
|
211
|
-
<CommitLogSyncDelay>1000</CommitLogSyncDelay>
|
212
|
-
|
213
|
-
|
214
|
-
<!-- Time to wait before garbage-collection deletion markers.
|
215
|
-
Set this to a large enough value that you are confident
|
216
|
-
that the deletion marker will be propagated to all replicas
|
217
|
-
by the time this many seconds has elapsed, even in the
|
218
|
-
face of hardware failures. The default value is ten days.
|
219
|
-
-->
|
220
|
-
<GCGraceSeconds>864000</GCGraceSeconds>
|
221
|
-
</Storage>
|