begin
require 'bdb'
rescue LoadError
- fatal "rbot couldn't load the bdb module, perhaps you need to install it? try: http://www.ruby-lang.org/en/raa-list.rhtml?name=bdb"
+ fatal "rbot couldn't load the bdb module, perhaps you need to install it? try http://www.ruby-lang.org/en/raa-list.rhtml?name=bdb or http://github.com/knu/ruby-bdb"
rescue Exception => e
fatal "rbot couldn't load the bdb module: #{e.pretty_inspect}"
end
class CIBtree < Btree
def bdb_bt_compare(a, b)
if a == nil || b == nil
- warning "CIBTree: comparing #{a.inspect} (#{self[a].inspect}) with #{b.inspect} (#{self[b].inspect})"
+ warning "CIBTree: comparing key #{a.inspect} with #{b.inspect}"
end
(a||'').downcase <=> (b||'').downcase
end
end
def DBTree.cleanup_logs()
+ if @@env.nil?
+ debug "No BDB environment, skipping checkpoint"
+ return
+ end
begin
debug "DBTree: checkpointing ..."
@@env.checkpoint
end
def DBTree.stats()
+ if @@env.nil?
+ debug "No BDB environment, no stats"
+ return
+ end
begin
debug "General stats:"
debug @@env.stat
end
def DBTree.cleanup_env()
+ if @@env.nil?
+ debug "No BDB environment, skipping cleanup"
+ return
+ end
begin
debug "DBTree: checking transactions ..."
has_active_txn = @@env.txn_stat["st_nactive"] > 0
# debug "closing registry #{registry}"
return if !@registry
registry.close
+ @registry = nil
end
# convert value to string form for storing in the registry