module Roma::WriteBehindProcess

Public Class Methods

push(hname, cmd, key, val) click to toggle source
    # File lib/roma/write_behind.rb
266 def self.push(hname, cmd, key, val)
267   @@wb_queue.push([hname, cmd, key, val])
268 end

Public Instance Methods

start_wb_process() click to toggle source
    # File lib/roma/write_behind.rb
270 def start_wb_process
271   @wb_thread = Thread.new{
272     wb_process_loop
273   }
274   @wb_thread[:name] = 'write_behind'
275 rescue =>e
276   @log.error("#{e}\n#{$@}")
277 end
stop_wb_process() click to toggle source
    # File lib/roma/write_behind.rb
279 def stop_wb_process
280   until @@wb_queue.empty?
281     sleep 0.01
282   end
283   @wb_thread.exit
284   @wb_writer.close_all
285   @cr_writer.close_all
286 end
wb_get_current_file_path(hname) click to toggle source
    # File lib/roma/write_behind.rb
296 def wb_get_current_file_path(hname)
297   @wb_writer.get_current_file_path(hname)
298 end
wb_get_path(hname) click to toggle source
    # File lib/roma/write_behind.rb
292 def wb_get_path(hname)
293   @wb_writer.wb_get_path(hname)
294 end
wb_get_stat() click to toggle source
    # File lib/roma/write_behind.rb
300 def wb_get_stat
301   @wb_writer.get_stat.merge(@cr_writer.get_stat)
302 end
wb_rotate(hname) click to toggle source
    # File lib/roma/write_behind.rb
288 def wb_rotate(hname)
289   @wb_writer.rotate(hname)
290 end

Private Instance Methods

wb_process_loop() click to toggle source
    # File lib/roma/write_behind.rb
304 def wb_process_loop
305   loop {
306     while dat = @@wb_queue.pop
307       # dat ====> [hname, cmd, key, value]
308       @cr_writer.transmit(dat[1], dat[2], dat[3]) unless dat[0]
309       @wb_writer.write(dat[0], dat[1], dat[2], dat[3])
310     end
311   }
312 rescue =>e
313   @log.error("#{e}\n#{$@}")
314   retry
315 end