redis-rdb 0.1.0

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.
Files changed (41) hide show
  1. data/.gitignore +2 -0
  2. data/LICENSE +22 -0
  3. data/README.md +91 -0
  4. data/Rakefile +7 -0
  5. data/examples/aof_dumper.rb +8 -0
  6. data/examples/read_rdb.rb +9 -0
  7. data/lib/rdb.rb +10 -0
  8. data/lib/rdb/callbacks.rb +129 -0
  9. data/lib/rdb/constants.rb +35 -0
  10. data/lib/rdb/dumper.rb +37 -0
  11. data/lib/rdb/dumpers/aof.rb +112 -0
  12. data/lib/rdb/errors.rb +4 -0
  13. data/lib/rdb/lzf.rb +48 -0
  14. data/lib/rdb/reader-state.rb +25 -0
  15. data/lib/rdb/reader.rb +387 -0
  16. data/lib/rdb/version.rb +3 -0
  17. data/redis-rdb.gemspec +30 -0
  18. data/test/helpers.rb +377 -0
  19. data/test/rdb/database_empty.rdb +1 -0
  20. data/test/rdb/database_multiple_logical_dbs.rdb +0 -0
  21. data/test/rdb/hash_as_ziplist.rdb +0 -0
  22. data/test/rdb/hash_normal.rdb +0 -0
  23. data/test/rdb/hash_with_big_values.rdb +0 -0
  24. data/test/rdb/hash_with_compressed_strings_as_zipmap.rdb +0 -0
  25. data/test/rdb/hash_with_uncompressed_strings_as_zipmap.rdb +0 -0
  26. data/test/rdb/keys_compressed.rdb +0 -0
  27. data/test/rdb/keys_integer.rdb +0 -0
  28. data/test/rdb/keys_uncompressed.rdb +0 -0
  29. data/test/rdb/keys_with_expiration.rdb +0 -0
  30. data/test/rdb/list_normal.rdb +0 -0
  31. data/test/rdb/list_of_compressed_strings_as_ziplist.rdb +0 -0
  32. data/test/rdb/list_of_integers_as_ziplist.rdb +0 -0
  33. data/test/rdb/list_of_uncompressed_strings_as_ziplist.rdb +0 -0
  34. data/test/rdb/set_as_intset_16bits.rdb +0 -0
  35. data/test/rdb/set_as_intset_32bits.rdb +0 -0
  36. data/test/rdb/set_as_intset_64bits.rdb +0 -0
  37. data/test/rdb/set_normal.rdb +0 -0
  38. data/test/rdb/sortedset_as_ziplist.rdb +0 -0
  39. data/test/rdb/sortedset_normal.rdb +0 -0
  40. data/test/test_reader.rb +416 -0
  41. metadata +109 -0
Binary file
@@ -0,0 +1,416 @@
1
+ $:.unshift File.expand_path('../test', File.dirname(__FILE__)),
2
+ File.expand_path('../lib', File.dirname(__FILE__))
3
+
4
+ require 'rdb'
5
+ require 'helpers'
6
+
7
+ setup do
8
+ {
9
+ callbacks: TestCallbacks.new
10
+ }
11
+ end
12
+
13
+ test 'should handle empty databases' do |options|
14
+ rdb = read_test_rdb('database_empty.rdb', options)
15
+
16
+ events = [
17
+ [:start_rdb, [6]],
18
+ [:end_rdb, []],
19
+ ]
20
+
21
+ assert events == rdb.events
22
+ end
23
+
24
+ test 'should handle multiple logical databases' do |options|
25
+ rdb = read_test_rdb('database_multiple_logical_dbs.rdb', options)
26
+
27
+ events = [
28
+ [:start_rdb, [3]],
29
+ [:start_database, [0]],
30
+ [:set, ['key_in_zeroth_database', 'zero']],
31
+ [:end_database, [0]],
32
+ [:start_database, [2]],
33
+ [:set, ['key_in_second_database', 'second']],
34
+ [:end_database, [2]],
35
+ [:end_rdb, []],
36
+ ]
37
+
38
+ assert events == rdb.events
39
+ end
40
+
41
+ test 'should read integer keys' do |options|
42
+ rdb = read_test_rdb('keys_integer.rdb', options)
43
+
44
+ events = [
45
+ [:start_rdb, [3]],
46
+ [:start_database, [0]],
47
+ [:set, [183358245, 'Positive 32 bit integer']],
48
+ [:set, [125, 'Positive 8 bit integer']],
49
+ [:set, [-29477, 'Negative 16 bit integer']],
50
+ [:set, [-123, 'Negative 8 bit integer']],
51
+ [:set, [43947, 'Positive 16 bit integer']],
52
+ [:set, [-183358245, 'Negative 32 bit integer']],
53
+ [:end_database, [0]],
54
+ [:end_rdb, []],
55
+ ]
56
+
57
+ assert events == rdb.events
58
+ end
59
+
60
+ test 'should read keys and their expiration' do |options|
61
+ rdb = read_test_rdb('keys_with_expiration.rdb', options)
62
+
63
+ events = [
64
+ [:start_rdb, [4]],
65
+ [:start_database, [0]],
66
+ [:set, ['expires_ms_precision', '2022-12-25 10:11:12.573 UTC']],
67
+ [:pexpireat, ['expires_ms_precision', 1671963072573000]],
68
+ [:end_database, [0]],
69
+ [:end_rdb, []],
70
+ ]
71
+
72
+ assert events == rdb.events
73
+ assert Time.parse(rdb.events[2][1][1]) == pexpireat_to_time(rdb.events[3][1][1])
74
+ end
75
+
76
+ test 'should read LZF-compressed key strings' do |options|
77
+ rdb = read_test_rdb('keys_compressed.rdb', options)
78
+
79
+ events = [
80
+ [:start_rdb, [3]],
81
+ [:start_database, [0]],
82
+ [:set, ['a' * 200, 'Key that redis should compress easily']],
83
+ [:end_database, [0]],
84
+ [:end_rdb, []],
85
+ ]
86
+
87
+ assert events == rdb.events
88
+ end
89
+
90
+ test 'should read uncompressed key strings' do |options|
91
+ rdb = read_test_rdb('keys_uncompressed.rdb', options)
92
+
93
+ events = [
94
+ [:start_rdb, [3]],
95
+ [:start_database, [0]],
96
+ [:set, [RDB_KEY_MIN_4BITS_MAX_16BITS, 'Key length more than 6 bits but less than 14 bits']],
97
+ [:set, [RDB_KEY_MAX_6BITS, 'Key length within 6 bits']],
98
+ [:set, [RDB_KEY_MIN_14BITS_MAX_32BITS, 'Key length more than 14 bits but less than 32']],
99
+ [:end_database, [0]],
100
+ [:end_rdb, []],
101
+ ]
102
+
103
+ assert events == rdb.events
104
+ end
105
+
106
+ test 'should read lists' do |options|
107
+ rdb = read_test_rdb('list_normal.rdb', options)
108
+
109
+ events = [:start_rdb, :start_database, :start_list, *([:rpush] * 1000), :end_list, :end_database, :end_rdb]
110
+
111
+ assert events == rdb.events.map { |event,| event }
112
+ assert 1000 == rdb.lists['force_linkedlist'].length
113
+ assert '41PJSO2KRV6SK1WJ6936L06YQDPV68R5J2TAZO3YAR5IL5GUI8' == rdb.lists['force_linkedlist'][0]
114
+ assert 'E1RVJE0CPK9109Q3LO6X4D1GNUG5NGTQNCYTJHHW4XEM7VSO6V' == rdb.lists['force_linkedlist'][499]
115
+ assert '2C5URE2L24D9GJUZJ59IWCAH8SGYF5T7QZ0EXQ0IE4I2JSB1QD' == rdb.lists['force_linkedlist'][999]
116
+ end
117
+
118
+ test 'should read lists with integers serialized as ziplists' do |options|
119
+ rdb = read_test_rdb('list_of_integers_as_ziplist.rdb', options)
120
+
121
+ events = [
122
+ [:start_rdb, [6]],
123
+ [:start_database, [0]],
124
+ [:start_list, ['ziplist_with_integers', 24]],
125
+ [:rpush, ['ziplist_with_integers', 0]],
126
+ [:rpush, ['ziplist_with_integers', 1]],
127
+ [:rpush, ['ziplist_with_integers', 2]],
128
+ [:rpush, ['ziplist_with_integers', 3]],
129
+ [:rpush, ['ziplist_with_integers', 4]],
130
+ [:rpush, ['ziplist_with_integers', 5]],
131
+ [:rpush, ['ziplist_with_integers', 6]],
132
+ [:rpush, ['ziplist_with_integers', 7]],
133
+ [:rpush, ['ziplist_with_integers', 8]],
134
+ [:rpush, ['ziplist_with_integers', 9]],
135
+ [:rpush, ['ziplist_with_integers', 10]],
136
+ [:rpush, ['ziplist_with_integers', 11]],
137
+ [:rpush, ['ziplist_with_integers', 12]],
138
+ [:rpush, ['ziplist_with_integers', -2]],
139
+ [:rpush, ['ziplist_with_integers', 13]],
140
+ [:rpush, ['ziplist_with_integers', 25]],
141
+ [:rpush, ['ziplist_with_integers', -61]],
142
+ [:rpush, ['ziplist_with_integers', 63]],
143
+ [:rpush, ['ziplist_with_integers', 16380]],
144
+ [:rpush, ['ziplist_with_integers', 49536]],
145
+ [:rpush, ['ziplist_with_integers', 16777008]],
146
+ [:rpush, ['ziplist_with_integers', -16773840]],
147
+ [:rpush, ['ziplist_with_integers', 1073741872]],
148
+ [:rpush, ['ziplist_with_integers', 9223372036854775807]],
149
+ [:end_list, ['ziplist_with_integers']],
150
+ [:end_database, [0]],
151
+ [:end_rdb, []],
152
+ ]
153
+
154
+ assert events == rdb.events
155
+ end
156
+
157
+ test 'should read lists with compressed strings serialized as ziplists' do |options|
158
+ rdb = read_test_rdb('list_of_compressed_strings_as_ziplist.rdb', options)
159
+
160
+ events = [
161
+ [:start_rdb, [3]],
162
+ [:start_database, [0]],
163
+ [:start_list, ['ziplist_compresses_easily', 6]],
164
+ [:rpush, ['ziplist_compresses_easily', 'a' * 6]],
165
+ [:rpush, ['ziplist_compresses_easily', 'a' * 12]],
166
+ [:rpush, ['ziplist_compresses_easily', 'a' * 18]],
167
+ [:rpush, ['ziplist_compresses_easily', 'a' * 24]],
168
+ [:rpush, ['ziplist_compresses_easily', 'a' * 30]],
169
+ [:rpush, ['ziplist_compresses_easily', 'a' * 36]],
170
+ [:end_list, ['ziplist_compresses_easily']],
171
+ [:end_database, [0]],
172
+ [:end_rdb, []],
173
+ ]
174
+
175
+ assert events == rdb.events
176
+ end
177
+
178
+ test 'should read lists with uncompressed strings serialized as ziplists' do |options|
179
+ rdb = read_test_rdb('list_of_uncompressed_strings_as_ziplist.rdb', options)
180
+
181
+ events = [
182
+ [:start_rdb, [3]],
183
+ [:start_database, [0]],
184
+ [:start_list, ['ziplist_doesnt_compress', 2]],
185
+ [:rpush, ['ziplist_doesnt_compress', 'aj2410']],
186
+ [:rpush, ['ziplist_doesnt_compress', 'cc953a17a8e096e76a44169ad3f9ac87c5f8248a403274416179aa9fbd852344']],
187
+ [:end_list, ['ziplist_doesnt_compress']],
188
+ [:end_database, [0]],
189
+ [:end_rdb, []],
190
+ ]
191
+
192
+ assert events == rdb.events
193
+ end
194
+
195
+ test 'should read sets' do |options|
196
+ rdb = read_test_rdb('set_normal.rdb', options)
197
+
198
+ events = [
199
+ [:start_rdb, [3]],
200
+ [:start_database, [0]],
201
+ [:start_set, ['regular_set', 6]],
202
+ [:sadd, ['regular_set', 'beta']],
203
+ [:sadd, ['regular_set', 'delta']],
204
+ [:sadd, ['regular_set', 'alpha']],
205
+ [:sadd, ['regular_set', 'phi']],
206
+ [:sadd, ['regular_set', 'gamma']],
207
+ [:sadd, ['regular_set', 'kappa']],
208
+ [:end_set, ['regular_set']],
209
+ [:end_database, [0]],
210
+ [:end_rdb, []],
211
+ ]
212
+
213
+ assert events == rdb.events
214
+ end
215
+
216
+ test 'should read sets encoded as intsets (16 bits)' do |options|
217
+ rdb = read_test_rdb('set_as_intset_16bits.rdb', options)
218
+
219
+ events = [
220
+ [:start_rdb, [3]],
221
+ [:start_database, [0]],
222
+ [:start_set, ['intset_16', 3]],
223
+ [:sadd, ['intset_16', 32764]],
224
+ [:sadd, ['intset_16', 32765]],
225
+ [:sadd, ['intset_16', 32766]],
226
+ [:end_set, ['intset_16']],
227
+ [:end_database, [0]],
228
+ [:end_rdb, []],
229
+ ]
230
+
231
+ assert events == rdb.events
232
+ end
233
+
234
+ test 'should read sets encoded as intsets (32 bits)' do |options|
235
+ rdb = read_test_rdb('set_as_intset_32bits.rdb', options)
236
+
237
+ events = [
238
+ [:start_rdb, [3]],
239
+ [:start_database, [0]],
240
+ [:start_set, ['intset_32', 3]],
241
+ [:sadd, ['intset_32', 2147418108]],
242
+ [:sadd, ['intset_32', 2147418109]],
243
+ [:sadd, ['intset_32', 2147418110]],
244
+ [:end_set, ['intset_32']],
245
+ [:end_database, [0]],
246
+ [:end_rdb, []],
247
+ ]
248
+
249
+ assert events == rdb.events
250
+ end
251
+
252
+ test 'should read sets encoded as intsets (64 bits)' do |options|
253
+ rdb = read_test_rdb('set_as_intset_64bits.rdb', options)
254
+
255
+ events = [
256
+ [:start_rdb, [3]],
257
+ [:start_database, [0]],
258
+ [:start_set, ['intset_64', 3]],
259
+ [:sadd, ['intset_64', 9223090557583032316]],
260
+ [:sadd, ['intset_64', 9223090557583032317]],
261
+ [:sadd, ['intset_64', 9223090557583032318]],
262
+ [:end_set, ['intset_64']],
263
+ [:end_database, [0]],
264
+ [:end_rdb, []],
265
+ ]
266
+
267
+ assert events == rdb.events
268
+ end
269
+
270
+ test 'should read sorted sets' do |options|
271
+ rdb = read_test_rdb('sortedset_normal.rdb', options)
272
+
273
+ events = [:start_rdb, :start_database, :start_sortedset, *([:zadd] * 500), :end_sortedset, :end_database, :end_rdb]
274
+
275
+ assert events == rdb.events.map { |event,| event }
276
+ assert 500 == rdb.sortedsets['force_sorted_set'].length
277
+ assert ['3.1899999999999999', 'G72TWVWH0DY782VG0H8VVAR8RNO7BS9QGOHTZFJU67X7L0Z3PR'] == rdb.sortedsets['force_sorted_set'][0]
278
+ assert ['4.3499999999999996', '95S5BW6RTTCUIQXOTT77YQC9D1ULUSB8MPYU71Q32WMLAL7WWG'] == rdb.sortedsets['force_sorted_set'][249]
279
+ assert ['4.7300000000000004', 'MBNE4KFV66LQQUZNFC7Z5KS1Y5I1IIIOT37OBUSGNDQQ2ITGZ8'] == rdb.sortedsets['force_sorted_set'][499]
280
+ end
281
+
282
+ test 'should read sorted sets encoded as ziplists' do |options|
283
+ rdb = read_test_rdb('sortedset_as_ziplist.rdb', options)
284
+
285
+ events = [
286
+ [:start_rdb, [3]],
287
+ [:start_database, [0]],
288
+ [:start_sortedset, ['sorted_set_as_ziplist', 3]],
289
+ [:zadd, ['sorted_set_as_ziplist', 1, '8b6ba6718a786daefa69438148361901']],
290
+ [:zadd, ['sorted_set_as_ziplist', '2.3700000000000001', 'cb7a24bb7528f934b841b34c3a73e0c7']],
291
+ [:zadd, ['sorted_set_as_ziplist', '3.423', '523af537946b79c4f8369ed39ba78605']],
292
+ [:end_sortedset, ['sorted_set_as_ziplist']],
293
+ [:end_database, [0]],
294
+ [:end_rdb, []],
295
+ ]
296
+
297
+ assert events == rdb.events
298
+ end
299
+
300
+ test 'should read hashes' do |options|
301
+ rdb = read_test_rdb('hash_normal.rdb', options)
302
+
303
+ events = [:start_rdb, :start_database, :start_hash, *([:hset] * 1000), :end_hash, :end_database, :end_rdb]
304
+
305
+ assert events == rdb.events.map { |event,| event }
306
+ assert 1000 == rdb.hashes['force_dictionary'].length
307
+ assert 'MBW4JW2398Z1DLMAVE5MAK8Z368PJIEHC7WGJUMTPX96KGWFRM' == rdb.hashes['force_dictionary']['N8HKPIK4RC4I2CXVV90LQCWODW1DZYD0DA26R8V5QP7UR511M8']
308
+ assert 'MFR2P9FJS90TS3S23QISM2HU691ZL4DTDP2I4ABBLNCFZI79DR' == rdb.hashes['force_dictionary']['8W7OAWM5W3ED3I4AUBC600IU4S67UGV6M91AOWW1STH129NBMO']
309
+ assert '4YOEJ3QPNQ6UADK4RZ3LDN8H0KQHD9605OQTJND8B1FTODSL74' == rdb.hashes['force_dictionary']['PET9GLTADHF2LAE6EUNDX6SPE1M7VFWBK5S9TW3967SAG0UUUB']
310
+ end
311
+
312
+ test 'should read hashes encoded as ziplists' do |options|
313
+ rdb = read_test_rdb('hash_as_ziplist.rdb', options)
314
+
315
+ events = [
316
+ [:start_rdb, [4]],
317
+ [:start_database, [0]],
318
+ [:start_hash, ['zipmap_compresses_easily', 3]],
319
+ [:hset, ['zipmap_compresses_easily', 'a', 'aa']],
320
+ [:hset, ['zipmap_compresses_easily', 'aa', 'aaaa']],
321
+ [:hset, ['zipmap_compresses_easily', 'aaaaa', 'aaaaaaaaaaaaaa']],
322
+ [:end_hash, ['zipmap_compresses_easily']],
323
+ [:end_database, [0]],
324
+ [:end_rdb, []],
325
+ ]
326
+
327
+ assert events == rdb.events
328
+ end
329
+
330
+ test 'should read hashes with compressed strings encoded as zipmaps' do |options|
331
+ rdb = read_test_rdb('hash_with_compressed_strings_as_zipmap.rdb', options)
332
+
333
+ events = [
334
+ [:start_rdb, [3]],
335
+ [:start_database, [0]],
336
+ [:start_hash, ['zipmap_compresses_easily', 3]],
337
+ [:hset, ['zipmap_compresses_easily', 'a', 'aa']],
338
+ [:hset, ['zipmap_compresses_easily', 'aa', 'aaaa']],
339
+ [:hset, ['zipmap_compresses_easily', 'aaaaa', 'aaaaaaaaaaaaaa']],
340
+ [:end_hash, ['zipmap_compresses_easily']],
341
+ [:end_database, [0]],
342
+ [:end_rdb, []],
343
+ ]
344
+
345
+ assert events == rdb.events
346
+ end
347
+
348
+ test 'should read hashes with uncompressed strings encoded as zipmaps' do |options|
349
+ rdb = read_test_rdb('hash_with_uncompressed_strings_as_zipmap.rdb', options)
350
+
351
+ events = [
352
+ [:start_rdb, [3]],
353
+ [:start_database, [0]],
354
+ [:start_hash, ['zimap_doesnt_compress', 2]],
355
+ [:hset, ['zimap_doesnt_compress', 'MKD1G6', '2']],
356
+ [:hset, ['zimap_doesnt_compress', 'YNNXK', 'F7TI']],
357
+ [:end_hash, ['zimap_doesnt_compress']],
358
+ [:end_database, [0]],
359
+ [:end_rdb, []],
360
+ ]
361
+
362
+ assert events == rdb.events
363
+ end
364
+
365
+ test 'should handle hashes with values between 253 and 255 bytes encoded as zipmaps' do |options|
366
+ rdb = read_test_rdb('hash_with_big_values.rdb', options)
367
+
368
+ events = [
369
+ [:start_rdb, [2]],
370
+ [:start_database, [0]],
371
+ [:start_hash, ['zipmap_with_big_values', 4]],
372
+ [:hset, ['zipmap_with_big_values', '253bytes', 'NYKK5QA4TDYJFZH0FCVT39DWI89IH7HV9HV162MULYY9S6H67MGS6YZJ54Q2NISW'+
373
+ '9U69VC6ZK3OJV6J095P0P5YNSEHGCBJGYNZ8BPK3GEFBB8ZMGPT2Y33WNSETHINM'+
374
+ 'SZ4VKWUE8CXE0Y9FO7L5ZZ02EO26TLXF5NUQ0KMA98973QY62ZO1M1WDDZNS25F3'+
375
+ '7KGBQ8W4R5V1YJRR2XNSQKZ4VY7GW6X038UYQG30ZM0JY1NNMJ12BKQPF2IDQ']],
376
+ [:hset, ['zipmap_with_big_values', '254bytes', 'IZ3PNCQQV5RG4XOAXDN7IPWJKEK0LWRARBE3393UYD89PSQFC40AG4RCNW2M4YAV'+
377
+ 'JR0WD8AVO2F8KFDGUV0TGU8GF8M2HZLZ9RDX6V0XKIOXJJ3EMWQGFEY7E56RAOPT'+
378
+ 'A60G6SQRZ59ZBUKA6OMEW3K0LH464C7XKAX3K8AXDUX63VGX99JDCW1W2KTXPQRN'+
379
+ '1R1PY5LXNXPW7AAIYUM2PUKN2YN2MXWS5HR8TPMKYJIFTLK2DNQNGTVAWMULON']],
380
+ [:hset, ['zipmap_with_big_values', '255bytes', '6EUW8XSNBHMEPY991GZVZH4ITUQVKXQYL7UBYS614RDQSE7BDRUW00M6Y4W6WUQB'+
381
+ 'DFVHH6V2EIAEQGLV72K4UY7XXKL6K6XH6IN4QVS15GU1AAH9UI40UXEA8IZ5CZRR'+
382
+ 'K6SAV3R3X283O2OO9KG4K0DG0HZX1MLFDQHXGCC96M9YUVKXOEC5X35Q4EKET0SD'+
383
+ 'FDSBF1QKGAVS9202EL7MP2KPOYAUKU1SZJW5OP30WAPSM9OG97EBHW2XOWGICZG']],
384
+ [:hset, ['zipmap_with_big_values', '300bytes', 'IJXP54329MQ96A2M28QF6SFX3XGNWGAII3M32MSIMR0O478AMZKNXDUYD5JGMHJR'+
385
+ 'B9A85RZ3DC3AIS62YSDW2BDJ97IBSH7FKOVFWKJYS7XBMIBX0Z1WNLQRY7D27PFP'+
386
+ 'BBGBDFDCKL0FIOBYEADX6G5UK3B0XYMGS0379GRY6F0FY5Q9JUCJLGOGDNNP8XW3'+
387
+ 'SJX2L872UJZZL8G871G9THKYQ2WKPFEBIHOOTIGDNWC15NL5324W8FYDP97JHKCS'+
388
+ 'MLWXNMSTYIUE7F22ZGR4NZK3T0UTBZ2AFRCT5LMT3P6B']],
389
+ [:end_hash, ['zipmap_with_big_values']],
390
+ [:end_database, [0]],
391
+ [:end_rdb, []],
392
+ ]
393
+
394
+ assert events == rdb.events
395
+ end
396
+
397
+ test 'should filter top-level objects before raising events' do |options|
398
+ options[:callbacks].filter = lambda do |state|
399
+ state.database == 2 && state.key.match(/second/) && state.key_type == :string
400
+ end
401
+
402
+ rdb = read_test_rdb('database_multiple_logical_dbs.rdb', options)
403
+
404
+ events = [
405
+ [:start_rdb, [3]],
406
+ [:start_database, [0]],
407
+ [:skip_object, ['key_in_zeroth_database']],
408
+ [:end_database, [0]],
409
+ [:start_database, [2]],
410
+ [:set, ['key_in_second_database', 'second']],
411
+ [:end_database, [2]],
412
+ [:end_rdb, []],
413
+ ]
414
+
415
+ assert events == rdb.events
416
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redis-rdb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniele Alessandri
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &26123892 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *26123892
25
+ - !ruby/object:Gem::Dependency
26
+ name: cutest
27
+ requirement: &26123508 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *26123508
36
+ description: ! " This library provides a set of modules and classes that make it
37
+ easy to handle\n binary database dumps generated by Redis (.rdb files).\n"
38
+ email:
39
+ - suppakilla@gmail.com
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - LICENSE
46
+ - README.md
47
+ - Rakefile
48
+ - examples/aof_dumper.rb
49
+ - examples/read_rdb.rb
50
+ - lib/rdb.rb
51
+ - lib/rdb/callbacks.rb
52
+ - lib/rdb/constants.rb
53
+ - lib/rdb/dumper.rb
54
+ - lib/rdb/dumpers/aof.rb
55
+ - lib/rdb/errors.rb
56
+ - lib/rdb/lzf.rb
57
+ - lib/rdb/reader-state.rb
58
+ - lib/rdb/reader.rb
59
+ - lib/rdb/version.rb
60
+ - redis-rdb.gemspec
61
+ - test/helpers.rb
62
+ - test/rdb/database_empty.rdb
63
+ - test/rdb/database_multiple_logical_dbs.rdb
64
+ - test/rdb/hash_as_ziplist.rdb
65
+ - test/rdb/hash_normal.rdb
66
+ - test/rdb/hash_with_big_values.rdb
67
+ - test/rdb/hash_with_compressed_strings_as_zipmap.rdb
68
+ - test/rdb/hash_with_uncompressed_strings_as_zipmap.rdb
69
+ - test/rdb/keys_compressed.rdb
70
+ - test/rdb/keys_integer.rdb
71
+ - test/rdb/keys_uncompressed.rdb
72
+ - test/rdb/keys_with_expiration.rdb
73
+ - test/rdb/list_normal.rdb
74
+ - test/rdb/list_of_compressed_strings_as_ziplist.rdb
75
+ - test/rdb/list_of_integers_as_ziplist.rdb
76
+ - test/rdb/list_of_uncompressed_strings_as_ziplist.rdb
77
+ - test/rdb/set_as_intset_16bits.rdb
78
+ - test/rdb/set_as_intset_32bits.rdb
79
+ - test/rdb/set_as_intset_64bits.rdb
80
+ - test/rdb/set_normal.rdb
81
+ - test/rdb/sortedset_as_ziplist.rdb
82
+ - test/rdb/sortedset_normal.rdb
83
+ - test/test_reader.rb
84
+ homepage: https://github.com/nrk/redis-rdb
85
+ licenses:
86
+ - MIT
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.9.0
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 1.8.16
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: A set of utilities to handle Redis .rdb files.
109
+ test_files: []