Module: Roma::WriteBehindProcess
- Included in:
- Romad
- Defined in:
- lib/roma/write_behind.rb
Overview
module WriteBehind
Constant Summary collapse
- @@wb_queue =
Queue.new
Class Method Summary collapse
Instance Method Summary collapse
- #start_wb_process ⇒ Object
- #stop_wb_process ⇒ Object
- #wb_get_current_file_path(hname) ⇒ Object
- #wb_get_path(hname) ⇒ Object
- #wb_get_stat ⇒ Object
- #wb_rotate(hname) ⇒ Object
Class Method Details
.push(hname, cmd, key, val) ⇒ Object
132 133 134 |
# File 'lib/roma/write_behind.rb', line 132 def self.push(hname, cmd, key, val) @@wb_queue.push([hname, cmd, key, val]) end |
Instance Method Details
#start_wb_process ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/roma/write_behind.rb', line 136 def start_wb_process @wb_thread = Thread.new{ wb_process_loop } @wb_thread[:name] = 'write_behind' rescue =>e @log.error("#{e}\n#{$@}") end |
#stop_wb_process ⇒ Object
145 146 147 148 149 150 151 |
# File 'lib/roma/write_behind.rb', line 145 def stop_wb_process until @@wb_queue.empty? sleep 0.01 end @wb_thread.exit @wb_writer.close_all end |
#wb_get_current_file_path(hname) ⇒ Object
161 162 163 |
# File 'lib/roma/write_behind.rb', line 161 def wb_get_current_file_path(hname) @wb_writer.get_current_file_path(hname) end |
#wb_get_path(hname) ⇒ Object
157 158 159 |
# File 'lib/roma/write_behind.rb', line 157 def wb_get_path(hname) @wb_writer.wb_get_path(hname) end |
#wb_get_stat ⇒ Object
165 166 167 |
# File 'lib/roma/write_behind.rb', line 165 def wb_get_stat @wb_writer.get_stat end |
#wb_rotate(hname) ⇒ Object
153 154 155 |
# File 'lib/roma/write_behind.rb', line 153 def wb_rotate(hname) @wb_writer.rotate(hname) end |