Class: Fluent::SystemdInput::PosWriter
- Inherits:
-
Object
- Object
- Fluent::SystemdInput::PosWriter
- Defined in:
- lib/fluent/plugin/systemd/pos_writer.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
Instance Method Summary collapse
-
#initialize(pos_file) ⇒ PosWriter
constructor
A new instance of PosWriter.
- #shutdown ⇒ Object
- #start ⇒ Object
- #update(c) ⇒ Object
Constructor Details
#initialize(pos_file) ⇒ PosWriter
Returns a new instance of PosWriter.
4 5 6 7 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 4 def initialize(pos_file) @path = pos_file setup end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
9 10 11 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 9 def cursor @cursor end |
Instance Method Details
#shutdown ⇒ Object
17 18 19 20 21 22 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 17 def shutdown return unless path @running = false thread.join write_pos end |
#start ⇒ Object
11 12 13 14 15 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 11 def start return unless path @running = true @thread = Thread.new(&method(:work)) end |
#update(c) ⇒ Object
24 25 26 27 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 24 def update(c) return unless path lock.synchronize { @cursor = c } end |