Rubyの公式RubyCインターフェースを使用していますが、bzipが機能しません。./configureによると、bzipサポートを使用してビルドされました。
checking bzlib.h usability... yes
checking bzlib.h presence... yes
checking for bzlib.h... yes
そこで、2つのファイルにエントリを書き込むだけのこのサンプルプログラムを作成しました。1つはbzipで圧縮され、もう1つはそうではありません。どちらも圧縮されていません。最後の単純なファイルサイズテストとは別に、with_bzip.tcbファイルを編集して、そこに生の文字列テキストを表示できます。
require 'tokyocabinet'
include TokyoCabinet
def write filename, options
File.unlink filename if File.exists? filename
bdb = BDB::new
bdb.tune(0, 0, 0, -1 -1, options) or raise "Couldn't tune"
bdb.open(filename, BDB::OWRITER | BDB::OCREAT | BDB::OLCKNB) or raise "Couldn't open"
bdb["test"] = "This string should be compressed and not appear raw.\n" * 10000
bdb.close
end
write 'without_bzip.tcb', 0
write 'with_bzip.tcb', BDB::TBZIP
puts "Not actually compressed" unless File.size('with_bzip.tcb') < File.size('without_bzip.tcb')
さらに悪いことに、Oklahoma Mixerのプレビューリリースを試してみると(次の例-新しいタグを追加するという評判はありませんが)、正常に圧縮されます。try()呼び出しにデバッグを組み込んだとき、tune(0、0、0、-1、-1、4)に対して同じ呼び出しを行っているようです。私はかなり完全に困惑しています-上記の私のコードが間違っていることを誰かに教えてもらえますか?
require 'oklahoma_mixer'
OklahomaMixer.open("minimal_om.tcb", :opts => 'lb') do |db|
db["test"] = "This string should be compressed and not appear raw.\n" * 10000
end