Class: LogStash::Outputs::Qingstor::TemporaryFileFactory
- Inherits:
-
Object
- Object
- LogStash::Outputs::Qingstor::TemporaryFileFactory
- Defined in:
- lib/logstash/outputs/qingstor/temporary_file_factory.rb
Defined Under Namespace
Classes: IOWrappedGzip
Constant Summary collapse
- FILE_MODE =
'a'.freeze
- GZIP_ENCODING =
'gzip'.freeze
- GZIP_EXTENSION =
'log.gz'.freeze
- TXT_EXTENSION =
'log'.freeze
- STRFTIME =
'%Y-%m-%dT%H.%M'.freeze
Instance Attribute Summary collapse
-
#counter ⇒ Object
Returns the value of attribute counter.
-
#current ⇒ Object
Returns the value of attribute current.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
Instance Method Summary collapse
-
#initialize(prefix, tags, encoding, tmpdir) ⇒ TemporaryFileFactory
constructor
A new instance of TemporaryFileFactory.
- #rotate! ⇒ Object
Constructor Details
#initialize(prefix, tags, encoding, tmpdir) ⇒ TemporaryFileFactory
Returns a new instance of TemporaryFileFactory.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 22 def initialize(prefix, , encoding, tmpdir) @counter = 0 @prefix = prefix = @encoding = encoding @tmpdir = tmpdir @lock = Mutex.new rotate! end |
Instance Attribute Details
#counter ⇒ Object
Returns the value of attribute counter.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def counter @counter end |
#current ⇒ Object
Returns the value of attribute current.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def current @current end |
#encoding ⇒ Object
Returns the value of attribute encoding.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def encoding @encoding end |
#prefix ⇒ Object
Returns the value of attribute prefix.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def prefix @prefix end |
#tags ⇒ Object
Returns the value of attribute tags.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def end |
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
20 21 22 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 20 def tmpdir @tmpdir end |
Instance Method Details
#rotate! ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 33 def rotate! @lock.synchronize do @current = new_file increment_counter @current end end |