Class: Fluent::SystemdInput::PosWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/systemd/pos_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cursorObject (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

#shutdownObject



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

#startObject



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