diff options
author | Matthias H <apoc@sixserv.org> | 2014-02-24 22:50:16 +0100 |
---|---|---|
committer | Matthias H <apoc@sixserv.org> | 2014-02-24 22:50:16 +0100 |
commit | 41a24fd35c29f48194c5bc034972d9859267d2b5 (patch) | |
tree | 0402713079bd97f110d273f8b7c379565f4c6d78 | |
parent | 0041296443e8ae0779aec721b902bd83d799e0a1 (diff) |
[registry] rbotdb script now imports tc databases
-rwxr-xr-x | bin/rbotdb | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -227,6 +227,8 @@ class ImportRegistry case @type when :dbm write_dbm(file, hash) + when :tc + write_tc(file, hash) when :daybreak write_daybreak(file, hash) end @@ -242,6 +244,19 @@ class ImportRegistry db.close end + def write_tc(file, data) + db = TokyoCabinet::BDB.new + db.open(file + '.tdb', + TokyoCabinet::BDB::OREADER | + TokyoCabinet::BDB::OCREAT | + TokyoCabinet::BDB::OWRITER) + data.each_pair do |key, value| + db[key] = value + end + db.optimize + db.close + end + def write_daybreak(file, data) db = Daybreak::DB.new(file + '.db') data.each_pair do |key, value| |