cassandra_complex 0.5
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/.document +5 -0
- data/CHANGES.txt +9 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +57 -0
- data/LICENSE.txt +201 -0
- data/README.md +64 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/cassandra_complex.gemspec +77 -0
- data/lib/cassandra_complex.rb +7 -0
- data/lib/cassandra_complex/configuration.rb +59 -0
- data/lib/cassandra_complex/connection.rb +168 -0
- data/lib/cassandra_complex/index.rb +39 -0
- data/lib/cassandra_complex/model.rb +309 -0
- data/lib/cassandra_complex/row.rb +10 -0
- data/lib/cassandra_complex/table.rb +271 -0
- data/spec/cassandra_complex/model_spec.rb +203 -0
- data/spec/cassandra_complex/table_spec.rb +372 -0
- data/spec/spec_helper.rb +2 -0
- data/test/benchmark.rb +38 -0
- metadata +182 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
class TimelineTable < CassandraComplex::Table
|
|
4
|
+
set_table_name 'timeline'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
CassandraComplex::Configuration.logger = Logger.new(STDOUT)
|
|
8
|
+
|
|
9
|
+
describe 'Table' do
|
|
10
|
+
|
|
11
|
+
before :all do
|
|
12
|
+
conn = CassandraComplex::Connection.new('127.0.0.1:9160')
|
|
13
|
+
conn.execute('CREATE KEYSPACE cassandra_complex_test WITH strategy_class = \'SimpleStrategy\' AND strategy_options:replication_factor = 1;')
|
|
14
|
+
CassandraComplex::Configuration.read({'host'=>'127.0.0.1:9160', 'default_keyspace'=>'cassandra_complex_test'})
|
|
15
|
+
create_table_command = <<-eos
|
|
16
|
+
CREATE TABLE timeline (
|
|
17
|
+
user_id varchar,
|
|
18
|
+
tweet_id int,
|
|
19
|
+
author varchar,
|
|
20
|
+
body varchar,
|
|
21
|
+
PRIMARY KEY (user_id, tweet_id));
|
|
22
|
+
eos
|
|
23
|
+
TimelineTable.execute(create_table_command)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
after :all do
|
|
27
|
+
conn = CassandraComplex::Connection.new('127.0.0.1:9160')
|
|
28
|
+
conn.execute('DROP TABLE timeline;')
|
|
29
|
+
conn.execute('DROP KEYSPACE cassandra_complex;')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context 'execute' do
|
|
33
|
+
before (:each) do
|
|
34
|
+
TimelineTable.truncate
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
after (:all) do
|
|
38
|
+
TimelineTable.truncate
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'single requests' do
|
|
42
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user0\',0,\'test_author0\',\'test_body0\');'
|
|
43
|
+
TimelineTable.execute(request)
|
|
44
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user1\',1,\'test_author1\',\'test_body1\');'
|
|
45
|
+
TimelineTable.execute(request)
|
|
46
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user2\',2,\'test_author2\',\'test_body2\');'
|
|
47
|
+
TimelineTable.execute(request)
|
|
48
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user3\',3,\'test_author3\',\'test_body3\');'
|
|
49
|
+
TimelineTable.execute(request)
|
|
50
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user4\',4,\'test_author4\',\'test_body4\');'
|
|
51
|
+
TimelineTable.execute(request)
|
|
52
|
+
TimelineTable.all.size.should == 5
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'block processing' do
|
|
56
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user0\',0,\'test_author0\',\'test_body0\');'
|
|
57
|
+
TimelineTable.execute(request)
|
|
58
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user1\',1,\'test_author1\',\'test_body1\');'
|
|
59
|
+
TimelineTable.execute(request)
|
|
60
|
+
request = 'INSERT INTO timeline (user_id,tweet_id,author,body) values (\'test_user2\',2,\'test_author2\',\'test_body2\');'
|
|
61
|
+
|
|
62
|
+
count = 1
|
|
63
|
+
TimelineTable.execute('SELECT * FROM timeline limit 3;') { count += 1 }
|
|
64
|
+
count.should == 3
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'table_name' do
|
|
70
|
+
it 'returns correct table name' do
|
|
71
|
+
TimelineTable.table_name.should == 'timeline'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'set proper table_name' do
|
|
75
|
+
module SomeModule
|
|
76
|
+
class TimelineTable < CassandraComplex::Table
|
|
77
|
+
set_table_name 'timeline'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
SomeModule::TimelineTable.table_name.should == 'timeline'
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
context 'id' do
|
|
87
|
+
it 'returns correct id' do
|
|
88
|
+
TimelineTable.id.should == 'user_id'
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
context 'all' do
|
|
93
|
+
|
|
94
|
+
before(:each) do
|
|
95
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 16, 'author' => 'test_author0', 'body' => 'test_body0'})
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
after(:each) do
|
|
99
|
+
TimelineTable.truncate
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'without params' do
|
|
103
|
+
result = TimelineTable.all
|
|
104
|
+
result.size.should == 1
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'with key' do
|
|
108
|
+
result = TimelineTable.all('test_user0')
|
|
109
|
+
result.size.should == 1
|
|
110
|
+
result[0]['user_id'].should == 'test_user0'
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'with not existing key' do
|
|
114
|
+
result = TimelineTable.all('test_')
|
|
115
|
+
result.size.should == 0
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'with key and where clauses' do
|
|
119
|
+
TimelineTable.all('test_user0', { :where => 'tweet_id = 16' }).size.should == 1
|
|
120
|
+
TimelineTable.all({'user_id' => 'test_user0', 'tweet_id' => 16}).size.should == 1
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'with array key' do
|
|
124
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 1, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
125
|
+
result = TimelineTable.all(['test_user0', 'test_user1'])
|
|
126
|
+
result.size.should == 2
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'without key and with where clauses' do
|
|
130
|
+
result = TimelineTable.all(:all, { :where => 'user_id = \'test_user0\'' })
|
|
131
|
+
result.size.should == 1
|
|
132
|
+
result[0]['user_id'].should == 'test_user0'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it 'without key and with order clauses' do
|
|
136
|
+
result = TimelineTable.all({'user_id' => 'test_user0'}, {:order => 'tweet_id' })
|
|
137
|
+
result.size.should == 1
|
|
138
|
+
result[0]['user_id'].should == 'test_user0'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it 'without key and with limit clauses' do
|
|
142
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 1, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
143
|
+
result = TimelineTable.all(:all, { :limit => 1 })
|
|
144
|
+
result.size.should == 1
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it 'select expression' do
|
|
148
|
+
result = TimelineTable.all(:all, { :select_expression => 'user_id, author' })
|
|
149
|
+
result[0]['user_id'].should_not == nil
|
|
150
|
+
result[0]['body'].should == nil
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'with block processing' do
|
|
154
|
+
id_sum = 0
|
|
155
|
+
TimelineTable.all { |element| id_sum += element['tweet_id'] }
|
|
156
|
+
id_sum.should == 16
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it 'one binding key' do
|
|
160
|
+
result = TimelineTable.all(:all, { :where => ['user_id = ?', 'test_user0'] })
|
|
161
|
+
result.size.should == 1
|
|
162
|
+
result[0]['user_id'].should == 'test_user0'
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'two binding keys' do
|
|
166
|
+
result = TimelineTable.all(:all, { :where => ['user_id = ? and tweet_id = ?', 'test_user0', 16] })
|
|
167
|
+
result.size.should == 1
|
|
168
|
+
result[0]['user_id'].should == 'test_user0'
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it 'few binding keys' do
|
|
172
|
+
result = TimelineTable.all(:all, { :where => ['user_id = ? and tweet_id > ? and tweet_id < ?', 'test_user0', 10, 20] })
|
|
173
|
+
result.size.should == 1
|
|
174
|
+
result[0]['user_id'].should == 'test_user0'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'distinct values' do
|
|
178
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 17, 'author' => 'test_author1', 'body' => 'test_body0'})
|
|
179
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 16, 'author' => 'test_author2', 'body' => 'test_body0'})
|
|
180
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 17, 'author' => 'test_author3', 'body' => 'test_body0'})
|
|
181
|
+
|
|
182
|
+
TimelineTable.all('test_user0', {:where => ['tweet_id = ?', 17], :distinct => 'author'}).should == ['test_author1']
|
|
183
|
+
TimelineTable.all('test_user1', {:distinct => 'tweet_id'}).sort.should == [16, 17]
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
context 'count' do
|
|
189
|
+
|
|
190
|
+
before(:each) do
|
|
191
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 16, 'author' => 'test_author0', 'body' => 'test_body0'})
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
after(:each) do
|
|
195
|
+
TimelineTable.truncate
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'without params' do
|
|
199
|
+
count = TimelineTable.count
|
|
200
|
+
count.should == 1
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
it 'with key' do
|
|
204
|
+
count = TimelineTable.count('test_user0')
|
|
205
|
+
count.should == 1
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
it 'with not existing key' do
|
|
209
|
+
count = TimelineTable.count('test_')
|
|
210
|
+
count.should == 0
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it 'with key and where clauses' do
|
|
214
|
+
count = TimelineTable.count('test_user0', { :where => 'tweet_id >= 10' })
|
|
215
|
+
count.should == 1
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it 'with array key' do
|
|
219
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 16, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
220
|
+
count = TimelineTable.count(['test_user0', 'test_user1'])
|
|
221
|
+
count.should == 2
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
it 'without key and with where clauses' do
|
|
225
|
+
count = TimelineTable.count(:all, { :where => 'user_id = \'test_user0\'' })
|
|
226
|
+
count.should == 1
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
it 'without key and with order clauses' do
|
|
230
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 16, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
231
|
+
count = TimelineTable.count({'user_id' => 'test_user0'}, {:order => 'tweet_id' })
|
|
232
|
+
count.should == 1
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
it 'without key and with limit clauses' do
|
|
236
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 16, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
237
|
+
count = TimelineTable.count(:all, { :limit => 1 })
|
|
238
|
+
count.should == 1
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
it 'with block processing' do
|
|
242
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 16, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
243
|
+
id_sum = 0
|
|
244
|
+
TimelineTable.count { |element| id_sum += element['count'] }
|
|
245
|
+
id_sum.should == 2
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
context 'create' do
|
|
251
|
+
|
|
252
|
+
before (:each) do
|
|
253
|
+
TimelineTable.truncate
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
after (:all) do
|
|
257
|
+
TimelineTable.truncate
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
it 'create record' do
|
|
261
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'})
|
|
262
|
+
timelines = TimelineTable.all('test_user0')
|
|
263
|
+
timelines.size.should == 1
|
|
264
|
+
timelines[0]['user_id'].should == 'test_user0'
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
it 'timestamp' do
|
|
268
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'}, { :timestamp => 2 })
|
|
269
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author1', 'body' => 'test_body1'}, { :timestamp => 1 })
|
|
270
|
+
TimelineTable.all.size.should == 1
|
|
271
|
+
result = TimelineTable.all('test_user0')
|
|
272
|
+
result.size.should == 1
|
|
273
|
+
result[0]['author'].should == 'test_author0'
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
it 'ttl' do
|
|
277
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 1, 'author' => 'test_author1', 'body' => 'test_body1'}, { :ttl => 1 })
|
|
278
|
+
result = TimelineTable.all('test_user1')
|
|
279
|
+
result.size.should == 1
|
|
280
|
+
sleep(2)
|
|
281
|
+
result = TimelineTable.all('test_user1')
|
|
282
|
+
result.size.should == 0
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
context 'update' do
|
|
288
|
+
|
|
289
|
+
before (:each) do
|
|
290
|
+
TimelineTable.truncate
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
after (:all) do
|
|
294
|
+
TimelineTable.truncate
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
it 'update record' do
|
|
298
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'})
|
|
299
|
+
TimelineTable.update({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body1'})
|
|
300
|
+
result = TimelineTable.all('test_user0')
|
|
301
|
+
result.size.should == 1
|
|
302
|
+
result[0]['body'].should == 'test_body1'
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
it 'timestamp' do
|
|
306
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'}, { :timestamp => 2 })
|
|
307
|
+
TimelineTable.update({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body1'}, { :timestamp => 1 })
|
|
308
|
+
result = TimelineTable.all('test_user0')
|
|
309
|
+
result.size.should == 1
|
|
310
|
+
result[0]['author'].should == 'test_author0'
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
it 'ttl' do
|
|
314
|
+
TimelineTable.update({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'}, { :ttl => 1 })
|
|
315
|
+
result = TimelineTable.all('test_user0')
|
|
316
|
+
result.size.should == 1
|
|
317
|
+
sleep(2)
|
|
318
|
+
result = TimelineTable.all('test_user0')
|
|
319
|
+
result.size.should == 0
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
context 'delete' do
|
|
325
|
+
before (:each) do
|
|
326
|
+
TimelineTable.truncate
|
|
327
|
+
TimelineTable.create({'user_id' => 'test_user0', 'tweet_id' => 0, 'author' => 'test_author0', 'body' => 'test_body0'})
|
|
328
|
+
TimelineTable.create({'user_id' => 'test_user1', 'tweet_id' => 1, 'author' => 'test_author1', 'body' => 'test_body1'})
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
after (:each) do
|
|
332
|
+
TimelineTable.delete('test_user0')
|
|
333
|
+
TimelineTable.delete('test_user1')
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
it 'single key' do
|
|
337
|
+
TimelineTable.delete('test_user0').should == true
|
|
338
|
+
TimelineTable.all('test_user0').size.should == 0
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
it 'array key' do
|
|
342
|
+
TimelineTable.delete(['test_user0', 'test_user1']).should == true
|
|
343
|
+
TimelineTable.delete(['test_user0', 'test_user1']).should == true
|
|
344
|
+
TimelineTable.all.size.should == 0
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
it 'hash where' do
|
|
348
|
+
TimelineTable.delete({'user_id' => 'test_user0', 'tweet_id' => 0})
|
|
349
|
+
TimelineTable.delete({'user_id' => 'test_user1', 'tweet_id' => 1})
|
|
350
|
+
TimelineTable.all.size.should == 0
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
it 'supports bind' do
|
|
354
|
+
TimelineTable.delete(nil, {:where => ['user_id = ? and tweet_id = ?', 'test_user0', '0']})
|
|
355
|
+
TimelineTable.delete(nil, {:where => ['user_id = ? and tweet_id = ?', 'test_user1', '1']})
|
|
356
|
+
TimelineTable.all.size.should == 0
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
it 'single key with options' do
|
|
360
|
+
TimelineTable.delete(nil, {:where => ['user_id = ? and tweet_id = ?', 'test_user0', '0'], :columns => ['author', 'body']})
|
|
361
|
+
TimelineTable.all.size.should == 1
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
it 'supports timestamp' do
|
|
365
|
+
TimelineTable.delete(nil, {:where => ['user_id = ? and tweet_id = ?', 'test_user0', '0'], :timestamp=> (Time.now.to_i + 10) }).should == true
|
|
366
|
+
TimelineTable.all.size.should == 2
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
end
|
|
372
|
+
|
data/spec/spec_helper.rb
ADDED
data/test/benchmark.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'progress_bar'
|
|
2
|
+
require 'benchmark'
|
|
3
|
+
|
|
4
|
+
MAX = 10**6
|
|
5
|
+
PORTION = MAX / 100
|
|
6
|
+
|
|
7
|
+
class TimelineModel < CassandraComplex::Model
|
|
8
|
+
table 'timeline'
|
|
9
|
+
|
|
10
|
+
attribute :user_id, 'varchar'
|
|
11
|
+
attribute :tweet_id, 'int'
|
|
12
|
+
attribute :author, 'varchar'
|
|
13
|
+
attribute :body, 'varchar'
|
|
14
|
+
|
|
15
|
+
primary_key :user_id, :tweet_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
progress_bar = ProgressBar.new(MAX, :bar, :percentage, :elapsed, :eta)
|
|
19
|
+
|
|
20
|
+
conn = CassandraComplex::Connection.new('127.0.0.1:9160')
|
|
21
|
+
conn.execute('DROP KEYSPACE cassandra_complex_benchmark;')
|
|
22
|
+
conn.execute('CREATE KEYSPACE cassandra_complex_benchmark WITH strategy_class = \'SimpleStrategy\' AND strategy_options:replication_factor = 1;')
|
|
23
|
+
CassandraComplex::Configuration.read({'host'=>'127.0.0.1:9160', 'default_keyspace'=>'cassandra_complex_benchmark'})
|
|
24
|
+
TimelineModel.create_table
|
|
25
|
+
puts "#{MAX} records created, found, deleted within cassandra in(user, system, total, real) time:"
|
|
26
|
+
puts Benchmark.measure{
|
|
27
|
+
(1..MAX).each do |i|
|
|
28
|
+
|
|
29
|
+
progress_bar.increment! PORTION if (i%PORTION) == 0
|
|
30
|
+
id = "test_#{i}"
|
|
31
|
+
TimelineModel.new({'user_id' => id, 'tweet_id' => i, 'author' => id, 'body' => id}).save
|
|
32
|
+
timeline = TimelineModel.find(id)
|
|
33
|
+
timeline[0].delete
|
|
34
|
+
end
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
TimelineModel.drop_table
|
|
38
|
+
conn.execute('DROP KEYSPACE cassandra_complex_benchmark;')
|
metadata
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cassandra_complex
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.5'
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Sergey Enin
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: redcarpet
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: yard
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: cassandra-cql
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - '='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 1.1.4
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - '='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.1.4
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: shoulda
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: rdoc
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ~>
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '3.12'
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ~>
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '3.12'
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: bundler
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
none: false
|
|
98
|
+
requirements:
|
|
99
|
+
- - ~>
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: 1.1.0
|
|
102
|
+
type: :development
|
|
103
|
+
prerelease: false
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - ~>
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 1.1.0
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: jeweler
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
none: false
|
|
114
|
+
requirements:
|
|
115
|
+
- - ~>
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 1.8.4
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
none: false
|
|
122
|
+
requirements:
|
|
123
|
+
- - ~>
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: 1.8.4
|
|
126
|
+
description: Basic model - wrapper for CQL(Cassandra Query Language) operations.
|
|
127
|
+
email: sergeyenin@gmail.com
|
|
128
|
+
executables: []
|
|
129
|
+
extensions: []
|
|
130
|
+
extra_rdoc_files:
|
|
131
|
+
- LICENSE.txt
|
|
132
|
+
- README.md
|
|
133
|
+
files:
|
|
134
|
+
- .document
|
|
135
|
+
- CHANGES.txt
|
|
136
|
+
- Gemfile
|
|
137
|
+
- Gemfile.lock
|
|
138
|
+
- LICENSE.txt
|
|
139
|
+
- README.md
|
|
140
|
+
- Rakefile
|
|
141
|
+
- VERSION
|
|
142
|
+
- cassandra_complex.gemspec
|
|
143
|
+
- lib/cassandra_complex.rb
|
|
144
|
+
- lib/cassandra_complex/configuration.rb
|
|
145
|
+
- lib/cassandra_complex/connection.rb
|
|
146
|
+
- lib/cassandra_complex/index.rb
|
|
147
|
+
- lib/cassandra_complex/model.rb
|
|
148
|
+
- lib/cassandra_complex/row.rb
|
|
149
|
+
- lib/cassandra_complex/table.rb
|
|
150
|
+
- spec/cassandra_complex/model_spec.rb
|
|
151
|
+
- spec/cassandra_complex/table_spec.rb
|
|
152
|
+
- spec/spec_helper.rb
|
|
153
|
+
- test/benchmark.rb
|
|
154
|
+
homepage: http://github.com/sergeyenin/cassandra_complex
|
|
155
|
+
licenses:
|
|
156
|
+
- Apache License 2
|
|
157
|
+
post_install_message:
|
|
158
|
+
rdoc_options: []
|
|
159
|
+
require_paths:
|
|
160
|
+
- lib
|
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
|
+
none: false
|
|
163
|
+
requirements:
|
|
164
|
+
- - ! '>='
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
segments:
|
|
168
|
+
- 0
|
|
169
|
+
hash: -195492477460173433
|
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
|
+
none: false
|
|
172
|
+
requirements:
|
|
173
|
+
- - ! '>='
|
|
174
|
+
- !ruby/object:Gem::Version
|
|
175
|
+
version: '0'
|
|
176
|
+
requirements: []
|
|
177
|
+
rubyforge_project:
|
|
178
|
+
rubygems_version: 1.8.24
|
|
179
|
+
signing_key:
|
|
180
|
+
specification_version: 3
|
|
181
|
+
summary: Basic model - wrapper for CQL(Cassandra Query Language) operations.
|
|
182
|
+
test_files: []
|