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.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
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.
6 7 8 9 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 6 def initialize(pos_file) @path = pos_file setup end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
11 12 13 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 11 def cursor @cursor end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 11 def path @path end |
Instance Method Details
#shutdown ⇒ Object
19 20 21 22 23 24 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 19 def shutdown return unless path @running = false thread.join write_pos end |
#start ⇒ Object
13 14 15 16 17 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 13 def start return unless path @running = true @thread = Thread.new(&method(:work)) end |
#update(c) ⇒ Object
26 27 28 29 |
# File 'lib/fluent/plugin/systemd/pos_writer.rb', line 26 def update(c) return unless path lock.synchronize { @cursor = c } end |