nose 0.1.0pre → 0.1.0pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cbc98973cefc286e5457924f9f314d79f8e00e2
4
- data.tar.gz: f3182e0f7583fb068ddd3a679f1ad4ed34af4548
3
+ metadata.gz: f962003be2e5c1613e5d05a3c752dba22212aceb
4
+ data.tar.gz: e06cc1936e9c85a7e5ccb6e3a59827011a3ff8d5
5
5
  SHA512:
6
- metadata.gz: c0e4526807ab3d17ca001361b6bbee74afeb94df64d54886f15eaac9045a460d2cd7109e56d6d567d2636267e992f9e4195f4d240bff4975545239d3843cf8fb
7
- data.tar.gz: 9445a603f50c33bfcf2d055a48cac3c0ded0763a6631100a33f16c8e3c92b01beba512725a5f73b0a8671a63bd4a45dea44eb60fb42a82cc454915fecbd046a9
6
+ metadata.gz: e012acadb4ca0198d34c87dcff1f60c28c4be7e119a0976d3270730866815e5cc65cd90ae2e70cee38ad19e1e2cee18820b70234948fa173c16a664d1898cd56
7
+ data.tar.gz: ca8e6c58a1ee20be1accd32ede0cce6b8b3ac1350f9134bfbdd72aabd39e51853b0e4dd4ca64f00ea9a46ceb4c26c54a1bfdc71eef2d72a83b9cccdae64a69ec
data/models/eac.rb ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable all
3
+
4
+ NoSE::Model.new do
5
+ # Define entities along with the size and cardinality of their fields
6
+ # as well as an estimated number of each entity
7
+
8
+ (Entity 'Player' do
9
+ ID 'PlayerID'
10
+ String 'PlayerName'
11
+ Integer 'PlayerFlags'
12
+ Boolean 'IsAdmin'
13
+ end) * 100_000
14
+
15
+ (Entity 'Session' do
16
+ ID 'SessionID'
17
+ Date 'TimeStarted'
18
+ Date 'TimeEnded'
19
+ end) * 100_000
20
+
21
+ (Entity 'PlayerState' do
22
+ ID 'StateID'
23
+ Float 'PosX'
24
+ Float 'PosY'
25
+ Float 'PosZ'
26
+ Date 'ClientTimestamp'
27
+ Date 'ServerTimestamp'
28
+ end) * 4_000_000
29
+
30
+ (Entity 'Server' do
31
+ ID 'ServerID'
32
+ String 'ServerIP'
33
+ String 'ServerName'
34
+ end) * 5_000
35
+
36
+ HasOne 'player', 'sessions',
37
+ 'Session' => 'Player'
38
+
39
+ HasOne 'server', 'sessions',
40
+ 'Session' => 'Server'
41
+
42
+ HasOne 'session', 'states',
43
+ 'PlayerState' => 'Session'
44
+ end
data/models/ebay.rb ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Insipired by the blog post below on data modeling in Cassandra
4
+ # www.ebaytechblog.com/2012/07/16/cassandra-data-modeling-best-practices-part-1/
5
+
6
+ # rubocop:disable all
7
+
8
+ NoSE::Model.new do
9
+ # Define entities along with the size and cardinality of their fields
10
+ # as well as an estimated number of each entity
11
+ (Entity 'users' do
12
+ ID 'UserID'
13
+ String 'Name', 50
14
+ String 'Email', 50
15
+ end) * 100
16
+
17
+ (Entity 'items' do
18
+ ID 'ItemID'
19
+ String 'Title', 50
20
+ String 'Desc', 200
21
+ end) * 1_000
22
+
23
+ (Entity 'likes' do
24
+ ID 'LikeID'
25
+ Date 'LikedAt'
26
+ end) * 10_000
27
+
28
+ HasOne 'user', 'likes',
29
+ 'likes' => 'users'
30
+ HasOne 'item', 'likes',
31
+ 'likes' => 'items'
32
+ end
data/models/rubis.rb ADDED
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable all
3
+
4
+ NoSE::Model.new do
5
+ # Define entities along with the size and cardinality of their fields
6
+ # as well as an estimated number of each entity
7
+
8
+ (Entity 'categories' do
9
+ ID 'id'
10
+ String 'name', 20
11
+ Integer 'dummy', count: 1
12
+ end) * 50
13
+
14
+ (Entity 'regions' do
15
+ ID 'id'
16
+ String 'name', 25
17
+ Integer 'dummy', count: 1
18
+ end) * 5
19
+
20
+ (Entity 'users' do
21
+ ID 'id'
22
+ String 'firstname', 6
23
+ String 'lastname', 7
24
+ String 'nickname', 12
25
+ String 'password', 15
26
+ String 'email', 23
27
+ Integer 'rating', count: 50
28
+ Float 'balance', count: 10_000
29
+ Date 'creation_date'
30
+ end) * 2_000
31
+
32
+ (Entity 'items' do
33
+ ID 'id'
34
+ String 'name', 19
35
+ String 'description', 197
36
+ Float 'initial_price'
37
+ Integer 'quantity', count: 100
38
+ Float 'reserve_price'
39
+ Float 'buy_now'
40
+ Integer 'nb_of_bids', count: 100
41
+ Float 'max_bid'
42
+ Date 'start_date'
43
+ Date 'end_date'
44
+ end) * 20_000
45
+
46
+ (Entity 'bids' do
47
+ ID 'id'
48
+ Integer 'qty', count: 5
49
+ Float 'bid'
50
+ Date 'date'
51
+ end) * 200_000
52
+
53
+ (Entity 'comments' do
54
+ ID 'id'
55
+ Integer 'rating', count: 10
56
+ Date 'date'
57
+ String 'comment', 130
58
+ end) * 100_000
59
+
60
+ (Entity 'buynow' do
61
+ ID 'id'
62
+ Integer 'qty', count: 4
63
+ Date 'date'
64
+ end) * 40_000
65
+
66
+ HasOne 'region', 'users',
67
+ 'users' => 'regions'
68
+
69
+ HasOne 'seller', 'items_sold',
70
+ 'items' => 'users'
71
+
72
+ HasOne 'category', 'items',
73
+ 'items' => 'categories'
74
+
75
+ HasOne 'user', 'bids',
76
+ 'bids' => 'users'
77
+
78
+ HasOne 'item', 'bids',
79
+ 'bids' => 'items'
80
+
81
+ HasOne 'from_user', 'comments_sent',
82
+ 'comments' => 'users'
83
+
84
+ HasOne 'to_user', 'comments_received',
85
+ 'comments' => 'users'
86
+
87
+ HasOne 'item', 'comments',
88
+ 'comments' => 'items'
89
+
90
+ HasOne 'buyer', 'bought_now',
91
+ 'buynow' => 'users'
92
+
93
+ HasOne 'item', 'bought_now',
94
+ 'buynow' => 'items'
95
+ end
96
+
97
+ # rubocop:enable all
data/plans/ebay.rb ADDED
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ NoSE::Plans::ExecutionPlans.new do
4
+ Schema 'ebay'
5
+
6
+ Group 'GetUser' do
7
+ Plan 'GetUser' do
8
+ Select users['*']
9
+ Param users.UserID, :==
10
+ Lookup 'users_by_id', [users.UserID, :==]
11
+ end
12
+ end
13
+
14
+ Group 'GetItem' do
15
+ Plan 'GetItem' do
16
+ Select items['*']
17
+ Param items.ItemID, :==
18
+ Lookup 'items_by_id', [items.ItemID, :==]
19
+ end
20
+ end
21
+
22
+ Group 'GetUserLikes' do
23
+ Plan 'GetUserLikes' do
24
+ Select items['*']
25
+ Param users.UserID, :==
26
+ Lookup 'likes_by_user', [users.UserID, :==]
27
+ Lookup 'items_by_id', [items.ItemID, :==]
28
+ end
29
+ end
30
+
31
+ Group 'GetItemLikes' do
32
+ Plan 'GetItemLikes' do
33
+ Select users['*']
34
+ Param items.ItemID, :==
35
+ Lookup 'likes_by_item', [items.ItemID, :==]
36
+ Lookup 'users_by_id', [users.UserID, :==]
37
+ end
38
+ end
39
+
40
+ Group 'AddLike' do
41
+ Plan 'AddItemLike' do
42
+ Param items.ItemID, :==
43
+ Param likes.LikeID, :==
44
+ Param likes.LikedAt, :==
45
+ Param users.UserID, :==
46
+ Insert 'likes_by_item'
47
+ end
48
+
49
+ Plan 'AddUserLike' do
50
+ Param users.UserID, :==
51
+ Param likes.LikeID, :==
52
+ Param likes.LikedAt, :==
53
+ Param items.ItemID, :==
54
+ Insert 'likes_by_user'
55
+ end
56
+ end
57
+
58
+ Group 'AddUser' do
59
+ Plan 'AddUser' do
60
+ Param users.UserID, :==
61
+ Param users.Name, :==
62
+ Param users.Email, :==
63
+ Insert 'users_by_id'
64
+ end
65
+ end
66
+
67
+ Group 'AddItem' do
68
+ Plan 'AddItem' do
69
+ Param items.ItemID, :==
70
+ Param items.Title, :==
71
+ Param items.Desc, :==
72
+ Insert 'items_by_id'
73
+ end
74
+ end
75
+
76
+ Group 'UpdateItemTitle' do
77
+ Plan 'UpdateItemTitle' do
78
+ Param items.ItemID, :==
79
+ Param items.Title, :==
80
+ Insert 'items_by_id', items.ItemID, items.Title
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,420 @@
1
+ # frozen_string_literal: true
2
+
3
+ NoSE::Plans::ExecutionPlans.new do
4
+ Schema 'rubis_baseline'
5
+
6
+ DefaultMix :browsing
7
+
8
+ Group 'BrowseCategories', browsing: 4.44,
9
+ bidding: 7.65,
10
+ write_medium: 7.65,
11
+ write_heavy: 7.65 do
12
+ Plan 'Authentication' do
13
+ Select users.password
14
+ Param users.id, :==
15
+ Lookup 'users', [users.id, :==]
16
+ end
17
+
18
+ Plan 'Categories' do
19
+ Select categories['*']
20
+ Param categories.dummy, :==, 1
21
+ Lookup 'all_categories', [categories.dummy, :==]
22
+ Lookup 'categories', [categories.id, :==]
23
+ end
24
+ end
25
+
26
+ Group 'ViewBidHistory', browsing: 2.38,
27
+ bidding: 1.54,
28
+ write_medium: 1.54,
29
+ write_heavy: 1.54 do
30
+ Plan 'ItemName' do
31
+ Select items.name
32
+ Param items.id, :==
33
+ Lookup 'items', [items.id, :==]
34
+ end
35
+
36
+ Plan 'Bids' do
37
+ Select bids['*'], users.id, users.nickname
38
+ Param items.id, :==
39
+ Lookup 'bids_by_item', [items.id, :==]
40
+ Lookup 'bids', [bids.id, :==]
41
+ Lookup 'users', [users.id, :==]
42
+ end
43
+ end
44
+
45
+ Group 'ViewItem', browsing: 22.95,
46
+ bidding: 14.17,
47
+ write_medium: 14.17,
48
+ write_heavy: 14.17 do
49
+ Plan 'ItemData' do
50
+ Select items['*']
51
+ Param items.id, :==
52
+ Lookup 'items', [items.id, :==]
53
+ end
54
+
55
+ Plan 'Bids' do
56
+ Select bids['*']
57
+ Param items.id, :==
58
+ Lookup 'bids_by_item', [items.id, :==]
59
+ Lookup 'bids', [bids.id, :==]
60
+ end
61
+ end
62
+
63
+ Group 'SearchItemsByCategory', browsing: 27.77,
64
+ bidding: 15.94,
65
+ write_medium: 15.94,
66
+ write_heavy: 15.94 do
67
+ Plan 'ItemList' do
68
+ Select items['*']
69
+ Param categories.id, :==
70
+ Param items.end_date, :>=
71
+ Lookup 'items_by_category',
72
+ [categories.id, :==],
73
+ [items.end_date, :>=], limit: 25
74
+ Lookup 'items', [items.id, :==]
75
+ end
76
+ end
77
+
78
+ Group 'SearchItemsByRegion', browsing: 8.26,
79
+ bidding: 6.34,
80
+ write_medium: 6.34,
81
+ write_heavy: 6.34 do
82
+ Plan 'ItemList' do
83
+ Select items['*']
84
+ Param regions.id, :==
85
+ Param categories.id, :==
86
+ Param items.end_date, :>=
87
+ Lookup 'items_by_region',
88
+ [regions.id, :==],
89
+ [categories.id, :==],
90
+ [items.end_date, :>=], limit: 25
91
+ Lookup 'items', [items.id, :==]
92
+ end
93
+ end
94
+
95
+ Group 'BrowseRegions', browsing: 3.21,
96
+ bidding: 5.39,
97
+ write_medium: 5.39,
98
+ write_heavy: 5.39 do
99
+ Plan 'Regions' do
100
+ Select regions['*']
101
+ Param regions.dummy, :==, 1
102
+ Lookup 'all_regions', [regions.dummy, :==]
103
+ Lookup 'regions', [regions.id, :==]
104
+ end
105
+ end
106
+
107
+ Group 'ViewUserInfo', browsing: 4.41,
108
+ bidding: 2.48,
109
+ write_medium: 2.48,
110
+ write_heavy: 2.48 do
111
+ Plan 'UserData' do
112
+ Select users['*'], regions.id, regions.name
113
+ Param users.id, :==
114
+ Lookup 'users', [users.id, :==]
115
+ Lookup 'regions', [regions.id, :==]
116
+ end
117
+
118
+ Plan 'CommentsReceived' do
119
+ Select comments['*']
120
+ Param users.id, :==
121
+ Lookup 'comments_by_user', [users.id, :==]
122
+ Lookup 'comments', [comments.id, :==]
123
+ end
124
+ end
125
+
126
+ Group 'RegisterItem', bidding: 0.53,
127
+ write_medium: 0.53 * 10,
128
+ write_heavy: 0.53 * 100 do
129
+ Plan 'InsertItem' do
130
+ Param items.id, :==
131
+ Param items.name, :==
132
+ Param items.description, :==
133
+ Param items.initial_price, :==
134
+ Param items.quantity, :==
135
+ Param items.reserve_price, :==
136
+ Param items.buy_now, :==
137
+ Param items.nb_of_bids, :==
138
+ Param items.max_bid, :==
139
+ Param items.start_date, :==
140
+ Param items.end_date, :==
141
+ Insert 'items'
142
+ end
143
+
144
+ Plan 'AddToSold' do
145
+ Param items.id, :==
146
+ Param items.end_date, :==
147
+ Param users.id, :==
148
+ Insert 'user_items_sold'
149
+ end
150
+
151
+ Plan 'AddToCategory' do
152
+ Param items.id, :==
153
+ Param items.end_date, :==
154
+ Param categories.id, :==
155
+ Insert 'items_by_category'
156
+ end
157
+
158
+ Plan 'AddToRegion' do
159
+ Support do
160
+ Plan 'GetRegion' do
161
+ Select regions.id
162
+ Param users.id, :==
163
+ Lookup 'users', [users.id, :==]
164
+ end
165
+ end
166
+
167
+ Param users.id, :==
168
+ Param items.id, :==
169
+ Param items.end_date, :==
170
+ Param regions.id, :==
171
+ Param categories.id, :==
172
+ Insert 'items_by_region'
173
+ end
174
+ end
175
+
176
+ Group 'RegisterUser', bidding: 1.07,
177
+ write_medium: 1.07 * 10,
178
+ write_heavy: 1.07 * 100 do
179
+ Plan 'AddUser' do
180
+ Support do
181
+ Plan 'GetRegionName' do
182
+ Select regions.name
183
+ Param regions.id, :==
184
+ Lookup 'regions', [regions.id, :==]
185
+ end
186
+ end
187
+
188
+ Param users.id, :==
189
+ Param users.firstname, :==
190
+ Param users.lastname, :==
191
+ Param users.nickname, :==
192
+ Param users.password, :==
193
+ Param users.email, :==
194
+ Param users.rating, :==, 0
195
+ Param users.balance, :==, 0
196
+ Param users.creation_date, :==
197
+ Param regions.id, :==
198
+ Insert 'users'
199
+ end
200
+
201
+ Plan 'AddToRegion' do
202
+ Param users.id, :==
203
+ Param users.nickname, :==
204
+ Param regions.id, :==
205
+ Insert 'users_by_region'
206
+ end
207
+ end
208
+
209
+ Group 'BuyNow', bidding: 1.16,
210
+ write_medium: 1.16,
211
+ write_heavy: 1.16 do
212
+ Plan 'Authentication' do
213
+ Select users.password
214
+ Param users.id, :==
215
+ Lookup 'users', [users.id, :==]
216
+ end
217
+
218
+ Plan 'ItemData' do
219
+ Select items['*']
220
+ Param items.id, :==
221
+ Lookup 'items', [items.id, :==]
222
+ end
223
+ end
224
+
225
+ Group 'StoreBuyNow', bidding: 1.10,
226
+ write_medium: 1.10 * 10,
227
+ write_heavy: 1.10 * 100 do
228
+ Plan 'ReduceQuantity' do
229
+ Support do
230
+ Plan 'OldQuantity' do
231
+ Select items.quantity
232
+ Param items.id, :==
233
+ Lookup 'items', [items.id, :==]
234
+ end
235
+ end
236
+
237
+ Param items.id, :==
238
+ Insert 'items', items.id, items.quantity
239
+ end
240
+
241
+ Plan 'AddBuyNow' do
242
+ Param buynow.id, :==
243
+ Param buynow.qty, :==
244
+ Param buynow.date, :==
245
+ Param items.id, :==
246
+ Insert 'buynow'
247
+ end
248
+
249
+ Plan 'AddToBought' do
250
+ Param users.id, :==
251
+ Param buynow.id, :==
252
+ Param buynow.date, :==
253
+ Insert 'buynow_by_user'
254
+ end
255
+ end
256
+
257
+ Group 'PutBid', bidding: 5.40, write_medium: 5.40, write_heavy: 5.40 do
258
+ Plan 'Authentication' do
259
+ Select users.password
260
+ Param users.id, :==
261
+ Lookup 'users', [users.id, :==]
262
+ end
263
+
264
+ Plan 'ItemData' do
265
+ Select items['*']
266
+ Param items.id, :==
267
+ Lookup 'items', [items.id, :==]
268
+ end
269
+
270
+ Plan 'Bids' do
271
+ Select bids['*']
272
+ Param items.id, :==
273
+ Lookup 'bids_by_item', [items.id, :==]
274
+ Lookup 'bids', [bids.id, :==]
275
+ end
276
+ end
277
+
278
+ Group 'StoreBid', bidding: 3.74,
279
+ write_medium: 3.74 * 10,
280
+ write_heavy: 3.74 * 100 do
281
+ Plan 'CheckMaxBid' do
282
+ Select items.nb_of_bids, items.max_bid
283
+ Param items.id, :==
284
+ Lookup 'items', [items.id, :==]
285
+ end
286
+
287
+ Plan 'AddBid' do
288
+ Support do
289
+ Plan 'GetMaxBid' do
290
+ Select items.max_bid
291
+ Param items.id, :==
292
+ Lookup 'items', [items.id, :==]
293
+ end
294
+ end
295
+
296
+ Param items.id, :==
297
+ Param items.max_bid, :==
298
+ Insert 'items', items.id, items.max_bid
299
+ end
300
+
301
+ Plan 'AddToBids' do
302
+ Param bids.id, :==
303
+ Param bids.qty, :==
304
+ Param bids.bid, :==
305
+ Param bids.date, :==
306
+ Param users.id, :==
307
+ Insert 'bids'
308
+ end
309
+
310
+ Plan 'AddToItemBids' do
311
+ Param items.id, :==
312
+ Param bids.id, :==
313
+ Insert 'bids_by_item'
314
+ end
315
+
316
+ Plan 'AddToUserBids' do
317
+ Param users.id, :==
318
+ Param bids.id, :==
319
+ Param bids.date, :==
320
+ Insert 'bids_by_user'
321
+ end
322
+ end
323
+
324
+ Group 'PutComment', bidding: 0.46,
325
+ write_medium: 0.46,
326
+ write_heavy: 0.46 do
327
+ Plan 'Authentication' do
328
+ Select users.password
329
+ Param users.id, :==
330
+ Lookup 'users', [users.id, :==]
331
+ end
332
+
333
+ Plan 'ItemData' do
334
+ Select items['*']
335
+ Param items.id, :==
336
+ Lookup 'items', [items.id, :==]
337
+ end
338
+
339
+ Plan 'UserData' do
340
+ Select users['*']
341
+ Param users.id, :==
342
+ Lookup 'users', [users.id, :==]
343
+ end
344
+ end
345
+
346
+ Group 'StoreComment', bidding: 0.45,
347
+ write_medium: 0.45 * 10,
348
+ write_heavy: 0.45 * 100 do
349
+ Plan 'UpdateRating' do
350
+ Support do
351
+ Plan 'GetRating' do
352
+ Select users.rating, regions.id
353
+ Param users.id, :==
354
+ Lookup 'users', [users.id, :==]
355
+ end
356
+ end
357
+
358
+ Param users.id, :==
359
+ Param users.rating, :==
360
+ Insert 'users', users.id, regions.id, users.rating
361
+ end
362
+
363
+ Plan 'InsertComment' do
364
+ Param comments.id, :==
365
+ Param comments.rating, :==
366
+ Param comments.date, :==
367
+ Param comments.comment, :==
368
+ Insert 'comments'
369
+ end
370
+
371
+ Plan 'AddToUserComments' do
372
+ Param users.id, :==
373
+ Param comments.id, :==
374
+ Insert 'comments_by_user'
375
+ end
376
+ end
377
+
378
+ Group 'AboutMe', bidding: 1.71,
379
+ write_medium: 1.71,
380
+ write_heavy: 1.71 do
381
+ Plan 'UserData' do
382
+ Select users['*']
383
+ Param users.id, :==
384
+ Lookup 'users', [users.id, :==]
385
+ end
386
+
387
+ Plan 'CommentsReceived' do
388
+ Select comments['*']
389
+ Param users.id, :==
390
+ Lookup 'comments_by_user', [users.id, :==]
391
+ Lookup 'comments', [comments.id, :==]
392
+ end
393
+
394
+ Plan 'BuyNow' do
395
+ Select items['*']
396
+ Param users.id, :==
397
+ Param buynow.date, :>=
398
+ Lookup 'buynow_by_user', [users.id, :==], [buynow.date, :>=]
399
+ Lookup 'buynow', [buynow.id, :==]
400
+ Lookup 'items', [items.id, :==]
401
+ end
402
+
403
+ Plan 'ItemsSold' do
404
+ Select items['*']
405
+ Param users.id, :==
406
+ Param items.end_date, :>=
407
+ Lookup 'user_items_sold', [users.id, :==], [items.end_date, :>=]
408
+ Lookup 'items', [items.id, :==]
409
+ end
410
+
411
+ Plan 'ItemsBid' do
412
+ Select items['*'], bids.id
413
+ Param users.id, :==
414
+ Param bids.date, :>=
415
+ Lookup 'bids_by_user', [users.id, :==], [bids.date, :>=]
416
+ Lookup 'bids', [bids.id, :==]
417
+ Lookup 'items', [items.id, :==]
418
+ end
419
+ end
420
+ end