higgs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/ChangeLog +208 -0
  2. data/LICENSE +26 -0
  3. data/README +2 -0
  4. data/Rakefile +75 -0
  5. data/bin/higgs_backup +67 -0
  6. data/bin/higgs_dump_index +43 -0
  7. data/bin/higgs_dump_jlog +42 -0
  8. data/bin/higgs_verify +37 -0
  9. data/lib/cgi/session/higgs.rb +72 -0
  10. data/lib/higgs/block.rb +192 -0
  11. data/lib/higgs/cache.rb +117 -0
  12. data/lib/higgs/dbm.rb +55 -0
  13. data/lib/higgs/exceptions.rb +31 -0
  14. data/lib/higgs/flock.rb +77 -0
  15. data/lib/higgs/index.rb +164 -0
  16. data/lib/higgs/jlog.rb +159 -0
  17. data/lib/higgs/lock.rb +189 -0
  18. data/lib/higgs/storage.rb +1086 -0
  19. data/lib/higgs/store.rb +228 -0
  20. data/lib/higgs/tar.rb +390 -0
  21. data/lib/higgs/thread.rb +370 -0
  22. data/lib/higgs/tman.rb +513 -0
  23. data/lib/higgs/utils/bman.rb +285 -0
  24. data/lib/higgs/utils.rb +22 -0
  25. data/lib/higgs/version.rb +21 -0
  26. data/lib/higgs.rb +59 -0
  27. data/misc/cache_bench/cache_bench.rb +43 -0
  28. data/misc/dbm_bench/.strc +8 -0
  29. data/misc/dbm_bench/Rakefile +78 -0
  30. data/misc/dbm_bench/dbm_multi_thread.rb +199 -0
  31. data/misc/dbm_bench/dbm_rnd_delete.rb +43 -0
  32. data/misc/dbm_bench/dbm_rnd_read.rb +44 -0
  33. data/misc/dbm_bench/dbm_rnd_update.rb +44 -0
  34. data/misc/dbm_bench/dbm_seq_read.rb +45 -0
  35. data/misc/dbm_bench/dbm_seq_write.rb +44 -0
  36. data/misc/dbm_bench/st_verify.rb +28 -0
  37. data/misc/io_bench/cksum_bench.rb +48 -0
  38. data/misc/io_bench/jlog_bench.rb +71 -0
  39. data/misc/io_bench/write_bench.rb +128 -0
  40. data/misc/thread_bench/lock_bench.rb +132 -0
  41. data/mkrdoc.rb +8 -0
  42. data/rdoc.yml +13 -0
  43. data/sample/count.rb +60 -0
  44. data/sample/dbmtest.rb +38 -0
  45. data/test/Rakefile +45 -0
  46. data/test/run.rb +32 -0
  47. data/test/test_block.rb +163 -0
  48. data/test/test_cache.rb +214 -0
  49. data/test/test_cgi_session.rb +142 -0
  50. data/test/test_flock.rb +162 -0
  51. data/test/test_index.rb +258 -0
  52. data/test/test_jlog.rb +180 -0
  53. data/test/test_lock.rb +320 -0
  54. data/test/test_online_backup.rb +169 -0
  55. data/test/test_storage.rb +439 -0
  56. data/test/test_storage_conf.rb +202 -0
  57. data/test/test_storage_init_opts.rb +89 -0
  58. data/test/test_store.rb +211 -0
  59. data/test/test_tar.rb +432 -0
  60. data/test/test_thread.rb +541 -0
  61. data/test/test_tman.rb +875 -0
  62. data/test/test_tman_init_opts.rb +56 -0
  63. data/test/test_utils_bman.rb +234 -0
  64. metadata +115 -0
@@ -0,0 +1,285 @@
1
+ # = backup manager
2
+ #
3
+ # Author:: $Author: toki $
4
+ # Date:: $Date: 2007-09-26 00:20:20 +0900 (Wed, 26 Sep 2007) $
5
+ # Revision:: $Revision: 559 $
6
+ #
7
+ # == license
8
+ # :include:LICENSE
9
+ #
10
+
11
+ require 'drb'
12
+ require 'fileutils'
13
+ require 'higgs/storage'
14
+
15
+ module Higgs
16
+ module Utils
17
+ # = backup manager
18
+ # == requirements for online-backup
19
+ #
20
+ # these parameters should be required when Higgs::Storage is opened.
21
+ #
22
+ # [<tt>:jlog_rotate_max</tt>] value is <tt>0</tt>. rotated journal logs shuold be preserved.
23
+ # [<tt>:jlog_rotate_service_uri</tt>] value is <tt>"druby://localhost:<em>appropriate_port_number</em>"</tt>.
24
+ # journal log rotation remote service should be enabled.
25
+ #
26
+ # == online-backup
27
+ #
28
+ # online-backup is controlled by <tt>higgs_backup</tt> command that
29
+ # is the front end of Higgs::Utils::BackupManager.
30
+ #
31
+ # simple online-backup is like this...
32
+ #
33
+ # % higgs_backup -v -f foo -t backup_dir -u druby://localhost:17320
34
+ # 2007-09-23 03:00:08.925 [23706]: **** START BACKUP SCENARIO ****
35
+ # 2007-09-23 03:00:08.936 [23706]: start index backup.
36
+ # 2007-09-23 03:00:09.331 [23706]: completed index backup.
37
+ # 2007-09-23 03:00:09.333 [23706]: start data backup.
38
+ # 2007-09-23 03:09:16.663 [23706]: completed data backup.
39
+ # 2007-09-23 03:09:16.692 [23706]: start journal log rotation.
40
+ # 2007-09-23 03:09:17.153 [23706]: completed journal log rotation.
41
+ # 2007-09-23 03:09:17.154 [23706]: start journal logs backup.
42
+ # 2007-09-23 03:09:17.205 [23706]: completed journal logs backup.
43
+ # 2007-09-23 03:09:17.206 [23706]: start backup storage recovery.
44
+ # 2007-09-23 03:09:17.798 [23706]: completed backup storage recovery.
45
+ # 2007-09-23 03:09:17.799 [23706]: start backup storage verify.
46
+ # 2007-09-23 03:25:44.122 [23706]: completed backup storage verify.
47
+ # 2007-09-23 03:25:44.140 [23706]: start journal logs clean.
48
+ # 2007-09-23 03:25:44.541 [23706]: completed journal logs clean.
49
+ # 2007-09-23 03:25:44.542 [23706]: **** COMPLETED BACKUP SCENARIO ****
50
+ #
51
+ # online-backup scenario includes these processes.
52
+ #
53
+ # 1. index backup. see Higgs::Utils::BackupManager#backup_index.
54
+ # 2. data backup. see Higgs::Utils::BackupManager#backup_data.
55
+ # 3. journal log rotation. see Higgs::Utils::BackupManager#rotate_jlog.
56
+ # 4. journal logs backup. see Higgs::Utils::BackupManager#backup_jlog.
57
+ # 5. backup storage recovery. see Higgs::Utils::BackupManager#recover.
58
+ # 6. backup storage verify. see Higgs::Utils::BackupManager#verify.
59
+ # 7. journal logs clean. see Higgs::Utils::BackupManager#clean_jlog.
60
+ #
61
+ # == restore from online-backup
62
+ # === 0. situation
63
+ # storage name is `foo' and backup directory is `backup_dir'.
64
+ #
65
+ # === 1. recovery from last online-backup
66
+ # run these commands.
67
+ # % cp -p backup_dir/foo.idx foo.idx
68
+ # % cp -p backup_dir/foo.tar foo.tar
69
+ # % higgs_backup -t . -n foo --command recover
70
+ #
71
+ # === 2. apply last journal log
72
+ # if system is aborted then last journal log is broken.
73
+ # Higgs::Storage applies last jounal log to a readable point at
74
+ # the read-write open.
75
+ #
76
+ # <em>WARNING.</em> Higgs::Storage is normal shutdown and last
77
+ # journal log is not broken. last journal log is not applied and
78
+ # storage data is old version. <em>this situation is inconsistent.</em>
79
+ #
80
+ # == command-line options
81
+ #
82
+ # % higgs_backup --help
83
+ # Usage: higgs_backup [options]
84
+ # --command=BACKUP_COMMAND
85
+ # -f, --from=BACKUP_TARGET_STORAGE
86
+ # -t, --to-dir=DIR_TO_BACKUP
87
+ # -n, --to-name=NAME_TO_BACKUP
88
+ # -u=URI
89
+ # --jlog-rotate-service-uri
90
+ # -v, --verbose, --[no-]verbose
91
+ # --verbose-level=LEVEL
92
+ #
93
+ # === option: <tt>--command=BACKUP_COMMAND</tt>
94
+ # select a process of online-backup.
95
+ # <tt>BACKUP_COMMAND</tt>s are these.
96
+ #
97
+ # <tt>online_backup</tt>:: default. run online-backup scenario.
98
+ # see Higgs::Utils::BackupManager#online_backup.
99
+ # <tt>index</tt>:: index backup. see Higgs::Utils::BackupManager#backup_index.
100
+ # <tt>data</tt>:: data backup. see Higgs::Utils::BackupManager#backup_data.
101
+ # <tt>rotate</tt>:: journal log rotation. see Higgs::Utils::BackupManager#rotate_jlog.
102
+ # <tt>jlog</tt>:: journal logs backup. see Higgs::Utils::BackupManager#backup_jlog.
103
+ # <tt>recover</tt>:: backup storage recovery. see Higgs::Utils::BackupManager#recover.
104
+ # <tt>verify</tt>:: backup storage verify. see Higgs::Utils::BackupManager#verify.
105
+ # <tt>clean</tt>:: journal logs clean. see Higgs::Utils::BackupManager#clean_jlog.
106
+ #
107
+ # === option: <tt>--from=BACKUP_TARGET_STORAGE</tt>
108
+ # <tt>BACKUP_TARGET_STORAGE</tt> is the name of backup target storage.
109
+ #
110
+ # === option: <tt>--to-dir=DIR_TO_BACKUP</tt>
111
+ # backuped storage is copied to the directory of <tt>DIR_TO_BACKUP</tt>.
112
+ #
113
+ # === option: <tt>--to-name=NAME_TO_BACKUP</tt>
114
+ # <tt>NAME_to_BACKUP</tt> is the name of backuped storage.
115
+ # if this option is omitted then <tt>NAME_TO_BACKUP</tt> is the same
116
+ # as <tt>BACKUP_TARGET_STORAGE</tt>.
117
+ #
118
+ # === option: <tt>--jlog-rotate-service-uri=URI</tt>
119
+ # access point journal log rotation remote service.
120
+ # <tt>URI</tt> is the same as <tt>:jlog_rotate_service_uri</tt>
121
+ # when Higgs::Storage is opened.
122
+ #
123
+ # === option: <tt>--verbose</tt>
124
+ # verbose level up.
125
+ #
126
+ # === option: <tt>--verbose-level=LEVEL</tt>
127
+ # set verbose level to <tt>LEVEL</tt>.
128
+ #
129
+ class BackupManager
130
+ # for ident(1)
131
+ CVS_ID = '$Id: bman.rb 559 2007-09-25 15:20:20Z toki $'
132
+
133
+ def initialize(options={})
134
+ @from = options[:from]
135
+ to_dir = options[:to_dir]
136
+ to_name = options[:to_name] || (@from && File.basename(@from))
137
+ @to = File.join(to_dir, to_name) if (to_dir && to_name)
138
+ @jlog_rotate_service_uri = options[:jlog_rotate_service_uri]
139
+ @verbose = options[:verbose] || 0
140
+ @out = options[:out] || STDOUT
141
+ end
142
+
143
+ def log(msg)
144
+ t = Time.now
145
+ timestamp = t.strftime('%Y-%m-%d %H:%M:%S')
146
+ milli_sec = format('%03d', t.to_f * 1000 % 1000)
147
+ "#{timestamp}.#{milli_sec} [#{$$}]: #{msg}\n"
148
+ end
149
+ private :log
150
+
151
+ def connect_service
152
+ unless (@jlog_rotate_service_uri) then
153
+ raise 'required jlog_rotate_service_uri'
154
+ end
155
+ @out << log("connect to jlog_rotate_service: #{@jlog_rotate_service_uri}") if (@verbose >= 2)
156
+ @jlog_rotate_service = DRbObject.new_with_uri(@jlog_rotate_service_uri)
157
+ end
158
+ private :connect_service
159
+
160
+ def backup_index
161
+ @out << log('start index backup.') if (@verbose >= 1)
162
+ unless (@from) then
163
+ raise 'required from_storage'
164
+ end
165
+ unless (@to) then
166
+ raise 'required to_storage'
167
+ end
168
+ connect_service
169
+ @out << log("save to #{@to}.idx") if (@verbose >= 2)
170
+ @jlog_rotate_service.call(File.expand_path(@to) + '.idx')
171
+ @out << log('completed index backup.') if (@verbose >= 1)
172
+ nil
173
+ end
174
+
175
+ def backup_data
176
+ @out << log('start data backup.') if (@verbose >= 1)
177
+ unless (@from) then
178
+ raise 'required from_storage'
179
+ end
180
+ unless (@to) then
181
+ raise 'required to_storage'
182
+ end
183
+ FileUtils.cp("#{@from}.tar", "#{@to}.tar", :preserve => true, :verbose => @verbose >= 2)
184
+ @out << log('completed data backup.') if (@verbose >= 1)
185
+ nil
186
+ end
187
+
188
+ def rotate_jlog
189
+ @out << log('start journal log rotation.') if (@verbose >= 1)
190
+ connect_service
191
+ @jlog_rotate_service.call(true)
192
+ @out << log('completed journal log rotation.') if (@verbose >= 1)
193
+ nil
194
+ end
195
+
196
+ def backup_jlog
197
+ @out << log('start journal logs backup.') if (@verbose >= 1)
198
+ unless (@from) then
199
+ raise 'required from_storage'
200
+ end
201
+ unless (@to) then
202
+ raise 'required to_storage'
203
+ end
204
+ for path in Storage.rotate_entries(@from + '.jlog')
205
+ path =~ /\.jlog\.\d+$/ or raise "mismatch jlog name: #{path}"
206
+ ext = $&
207
+ FileUtils.cp(path, "#{@to}#{ext}", :preserve => true, :verbose => @verbose >= 2)
208
+ end
209
+ @out << log('completed journal logs backup.') if (@verbose >= 1)
210
+ nil
211
+ end
212
+
213
+ def recover
214
+ @out << log('start backup storage recovery.') if (@verbose >= 1)
215
+ unless (@to) then
216
+ raise 'required to_storage'
217
+ end
218
+ Storage.recover(@to, @out, @verbose - 1)
219
+ @out << log('completed backup storage recovery.') if (@verbose >= 1)
220
+ nil
221
+ end
222
+
223
+ def verify
224
+ @out << log('start backup storage verify.') if (@verbose >= 1)
225
+ unless (@to) then
226
+ raise 'required to_storage'
227
+ end
228
+ st = Storage.new(@to, :read_only => true)
229
+ begin
230
+ st.verify(@out, @verbose - 1)
231
+ ensure
232
+ st.shutdown
233
+ end
234
+ @out << log('completed backup storage verify.') if (@verbose >= 1)
235
+ nil
236
+ end
237
+
238
+ def clean_jlog
239
+ @out << log('start journal logs clean.') if (@verbose >= 1)
240
+
241
+ unless (@from) then
242
+ raise 'required from_storage'
243
+ end
244
+ unless (@to) then
245
+ raise 'required to_storage'
246
+ end
247
+
248
+ for to_jlog in Storage.rotate_entries("#{@to}.jlog")
249
+ to_jlog =~ /\.jlog\.\d+$/ or raise "mismatch jlog name: #{to_jlog}"
250
+ ext = $&
251
+ from_jlog = @from + ext
252
+ if (File.exist? from_jlog) then
253
+ FileUtils.rm(from_jlog, :verbose => @verbose >= 2)
254
+ end
255
+ end
256
+
257
+ for to_jlog in Storage.rotate_entries("#{@to}.jlog")
258
+ FileUtils.rm(to_jlog, :verbose => @verbose >= 2)
259
+ end
260
+
261
+ @out << log('completed journal logs clean.') if (@verbose >= 1)
262
+ nil
263
+ end
264
+
265
+ # run online backup scenario
266
+ def online_backup
267
+ @out << log('**** START BACKUP SCENARIO ****') if (@verbose >= 1)
268
+ backup_index
269
+ backup_data
270
+ rotate_jlog
271
+ backup_jlog
272
+ recover
273
+ verify
274
+ clean_jlog
275
+ @out << log('**** COMPLETED BACKUP SCENARIO ****') if (@verbose >= 1)
276
+ nil
277
+ end
278
+ end
279
+ end
280
+ end
281
+
282
+ # Local Variables:
283
+ # mode: Ruby
284
+ # indent-tabs-mode: nil
285
+ # End:
@@ -0,0 +1,22 @@
1
+ # = namespace for utilities
2
+ #
3
+ # Author:: $Author: toki $
4
+ # Date:: $Date: 2007-09-26 00:20:20 +0900 (Wed, 26 Sep 2007) $
5
+ # Revision:: $Revision: 559 $
6
+ #
7
+ # == license
8
+ # :include:LICENSE
9
+ #
10
+
11
+ module Higgs
12
+ # = namespace for command-line utilities
13
+ module Utils
14
+ # for ident(1)
15
+ CVS_ID = '$Id: utils.rb 559 2007-09-25 15:20:20Z toki $'
16
+ end
17
+ end
18
+
19
+ # Local Variables:
20
+ # mode: Ruby
21
+ # indent-tabs-mode: nil
22
+ # End:
@@ -0,0 +1,21 @@
1
+ # = version
2
+ #
3
+ # Author:: $Author: toki $
4
+ # Date:: $Date: 2007-09-29 18:06:25 +0900 (Sat, 29 Sep 2007) $
5
+ # Revision:: $Revision: 578 $
6
+ #
7
+ # == license
8
+ # :include:LICENSE
9
+ #
10
+
11
+ module Higgs
12
+ # for ident(1)
13
+ CVS_ID = '$Id: version.rb 578 2007-09-29 09:06:25Z toki $'
14
+
15
+ VERSION = '0.1.0'
16
+ end
17
+
18
+ # Local Variables:
19
+ # mode: Ruby
20
+ # indent-tabs-mode: nil
21
+ # End:
data/lib/higgs.rb ADDED
@@ -0,0 +1,59 @@
1
+ # = pure ruby transactional storage compatible with unix TAR format
2
+ #
3
+ # Author:: $Author: toki $
4
+ # Date:: $Date: 2007-09-27 00:51:39 +0900 (Thu, 27 Sep 2007) $
5
+ # Revision:: $Revision: 562 $
6
+ #
7
+ # == license
8
+ # :include:LICENSE
9
+ #
10
+
11
+ require 'higgs/dbm'
12
+ require 'higgs/store'
13
+ require 'higgs/version'
14
+
15
+ # = pure ruby transactional storage compatible with unix TAR format
16
+ # == features
17
+ #
18
+ # * data format is compatible with unix TAR format.
19
+ # * data can have meta-data called `property'.
20
+ # * consistency of storage contents is always checked by hash value.
21
+ # * read-write transaction and read-only transaction are supported.
22
+ # * online-backup is supported.
23
+ #
24
+ # == main classes
25
+ #
26
+ # [Higgs::Store] storage like pstore
27
+ # [Higgs::DBM] storage like dbm
28
+ # [Higgs::Utils::BackupManager] online backup utility (body of <tt>higgs_backup</tt> command)
29
+ #
30
+ # == safety level
31
+ # === case of no backup
32
+ #
33
+ # [REQUIREMENTS] default
34
+ # [NORMAL SHUTDOWN] OK, no recovery
35
+ # [PROCESS ABORT] OK, automatic recovery on read-write open
36
+ # [SYSTEM ABORT (OS abort)] NG, data is <em>NOT</em> consistent
37
+ #
38
+ # === case of online backup
39
+ #
40
+ # [REQUIREMENTS] open with parameters:
41
+ # <tt>jlog_rotate_max => 0</tt>,
42
+ # <tt>jlog_rotate_service_uri => "druby://localhost:<em>appropriate_port_number</em>"</tt>,
43
+ # and execute <tt>higgs_backup</tt> (see Higgs::Utils::BackupManager)
44
+ # [NORMAL SHUTDOWN] OK, no recovery
45
+ # [PROCESS ABORT] OK, automatic recovery on read-write open
46
+ # [SYSTEM ABORT (OS abort)] OK, need for <em>MANUAL</em> recovery from backup
47
+ #
48
+ # == license
49
+ #
50
+ # BSD style license.
51
+ # :include:LICENSE
52
+ #
53
+ module Higgs
54
+ end
55
+
56
+ # Local Variables:
57
+ # mode: Ruby
58
+ # indent-tabs-mode: nil
59
+ # End:
@@ -0,0 +1,43 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ # for ident(1)
4
+ CVS_ID = '$Id: cache_bench.rb 559 2007-09-25 15:20:20Z toki $'
5
+
6
+ $: << File.join(File.dirname($0), '..', '..', 'lib')
7
+
8
+ require 'benchmark'
9
+ require 'higgs/cache'
10
+
11
+ loop_count = (ARGV.shift || '100000').to_i
12
+ cache_entries = (ARGV.shift || '10000').to_i
13
+ cache_limit = (ARGV.shift || '1000').to_i
14
+ puts "#{$0}: LOOP:#{loop_count}, ENTRIES:#{cache_entries}, CACHE_LIMIT:#{cache_limit}"
15
+
16
+ def test_store(cache, count, entries)
17
+ srand(0)
18
+ count.times do
19
+ cache[rand(entries)] = rand
20
+ end
21
+ end
22
+
23
+ def test_fetch(cache, count, entries)
24
+ srand(1)
25
+ key_list = cache.keys
26
+ count.times do
27
+ cache[key_list[rand(key_list.size)]]
28
+ end
29
+ end
30
+
31
+ Benchmark.bm(25) do |x|
32
+ [ Hash.new,
33
+ Higgs::LRUCache.new(cache_limit)
34
+ ].each do |cache|
35
+ x.report("[store] #{cache.class}") { test_store(cache, loop_count, cache_entries) }
36
+ x.report("[fetch] #{cache.class}") { test_fetch(cache, loop_count, cache_entries) }
37
+ end
38
+ end
39
+
40
+ # Local Variables:
41
+ # mode: Ruby
42
+ # indent-tabs-mode: nil
43
+ # End:
@@ -0,0 +1,8 @@
1
+ # $Id: .strc 559 2007-09-25 15:20:20Z toki $
2
+ number_of_read_io: 2
3
+ data_cksum_type: MD5
4
+ jlog_sync: false
5
+ jlog_cksum_type: MD5
6
+ jlog_rotate_size: 1048576
7
+ jlog_rotate_max: 1
8
+ logging_level: info
@@ -0,0 +1,78 @@
1
+ # for idnet(1)
2
+ CVS_ID = '$Id: Rakefile 559 2007-09-25 15:20:20Z toki $'
3
+
4
+ LIB_DIR = File.join(File.dirname(__FILE__), '..', '..', 'lib')
5
+
6
+ LOOP_COUNT = ENV['LOOP_COUNT'] || '100'
7
+ DATA_COUNT = ENV['DATA_COUNT'] || '10'
8
+ MAX_DAT_LEN = ENV['MAX_DAT_LEN'] || '32768'
9
+
10
+ def run(cmd)
11
+ ruby '-I', LIB_DIR, cmd, LOOP_COUNT, DATA_COUNT, MAX_DAT_LEN
12
+ end
13
+
14
+ def prof(cmd)
15
+ ruby '-I', LIB_DIR, '-r', 'profile', cmd, LOOP_COUNT, DATA_COUNT, MAX_DAT_LEN
16
+ end
17
+
18
+ def ruby_prof(cmd)
19
+ ENV['RUBYLIB'] = [ ENV['RUBYLIB'], File.expand_path(LIB_DIR) ].join(':')
20
+ printer = ENV['PROF_PRINTER'] || 'flat'
21
+ sh 'ruby-prof', '-p', printer, cmd
22
+ end
23
+
24
+ def benchmarks
25
+ print "\n"
26
+ yield 'dbm_seq_write.rb'
27
+ run 'st_verify.rb'
28
+ yield 'dbm_seq_read.rb'
29
+ run 'st_verify.rb'
30
+ yield 'dbm_rnd_read.rb'
31
+ run 'st_verify.rb'
32
+ yield 'dbm_rnd_update.rb'
33
+ run 'st_verify.rb'
34
+ yield 'dbm_rnd_delete.rb'
35
+ run 'st_verify.rb'
36
+ #yield 'st_reorganize.rb'
37
+ #run 'st_verify.rb'
38
+ nil
39
+ end
40
+
41
+ task :default => [ :run ]
42
+
43
+ task :run => [ :clean ] do
44
+ benchmarks do |rb|
45
+ run rb
46
+ end
47
+ end
48
+
49
+ task :dump_index do
50
+ ruby '-I', LIB_DIR, '../../bin/dump_index.rb', 'foo.idx'
51
+ end
52
+
53
+ task :dump_jlog do
54
+ ruby '-I', LIB_DIR, '../../bin/dump_jlog.rb', 'foo.jlog'
55
+ end
56
+
57
+ task :prof => [ :clean ] do
58
+ benchmarks do |rb|
59
+ prof rb
60
+ end
61
+ end
62
+
63
+ task :ruby_prof => [ :clean ] do
64
+ benchmarks do |rb|
65
+ ruby_prof rb
66
+ end
67
+ end
68
+
69
+ task :clean do
70
+ for db in Dir['foo.*']
71
+ rm_f db
72
+ end
73
+ end
74
+
75
+ # Local Variables:
76
+ # mode: Ruby
77
+ # indent-tabs-mode: nil
78
+ # End: