Class: LogStash::Outputs::Swift::SizeRotationPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/swift/size_rotation_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size_file) ⇒ SizeRotationPolicy

Returns a new instance of SizeRotationPolicy.



8
9
10
11
12
13
14
# File 'lib/logstash/outputs/swift/size_rotation_policy.rb', line 8

def initialize(size_file)
  if size_file <= 0
    raise LogStash::ConfigurationError, "`size_file` need to be greather than 0"
  end

  @size_file = size_file
end

Instance Attribute Details

#size_fileObject (readonly)

Returns the value of attribute size_file.



6
7
8
# File 'lib/logstash/outputs/swift/size_rotation_policy.rb', line 6

def size_file
  @size_file
end

Instance Method Details

#needs_periodic?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/logstash/outputs/swift/size_rotation_policy.rb', line 20

def needs_periodic?
  false
end

#rotate?(file) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/logstash/outputs/swift/size_rotation_policy.rb', line 16

def rotate?(file)
  file.size >= size_file
end