Class: LogStash::Outputs::Qingstor::RotationPolicy::Size

Inherits:
Policy
  • Object
show all
Defined in:
lib/logstash/outputs/qingstor/rotation_policy.rb

Instance Method Summary collapse

Methods inherited from Policy

#name, #positive_check

Constructor Details

#initialize(file_size, _) ⇒ Size

Returns a new instance of Size.



42
43
44
45
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 42

def initialize(file_size, _)
  @file_size = file_size
  positive_check(@file_size)
end

Instance Method Details

#needs_periodic?Boolean

Returns:

  • (Boolean)


51
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 51

def needs_periodic?; false; end

#rotate?(file) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 47

def rotate?(file)
  file.size >= @file_size
end

#to_sObject



53
54
55
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 53

def to_s
  { :policy => name, :file_size => @file_size }.to_s
end