Class: LogStash::Inputs::CouchDBChanges::SequenceDB::File

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/couchdb_changes.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ File

Returns a new instance of File.



118
119
120
# File 'lib/logstash/inputs/couchdb_changes.rb', line 118

def initialize(file)
  @sequence_path = file
end

Instance Method Details

#readObject



122
123
124
# File 'lib/logstash/inputs/couchdb_changes.rb', line 122

def read
  ::File.exists?(@sequence_path) ? ::File.read(@sequence_path).chomp.strip : 0
end

#write(sequence = nil) ⇒ Object



126
127
128
129
# File 'lib/logstash/inputs/couchdb_changes.rb', line 126

def write(sequence = nil)
  sequence = 0 if sequence.nil?
  ::File.write(@sequence_path, sequence.to_s)
end