class Roma::Storage::TCAsyncStorage

Private Instance Methods

open_db(fname) click to toggle source
    # File lib/roma/storage/tc_storage.rb
137 def open_db(fname)
138   hdb = HDB::new
139 
140   set_options(hdb)
141 
142   hdb.instance_eval{
143     alias put putasync
144   }
145 
146   if !hdb.open(fname, HDB::OWRITER | HDB::OCREAT)
147     ecode = hdb.ecode
148     raise RuntimeError.new("tcdb open error #{hdb.errmsg(ecode)}")
149   end
150 
151   Thread.new {
152     loop{
153       sleep 10
154       hdb.sync
155     }
156   }
157 
158   hdb
159 end