Sha256: dd3a35e9bd3abd4c6700e3e520b8689e36a1ae1448096f1e845d556b1477e6da

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

# encoding: utf-8
module LogStash
  module Outputs
    class Swift
      class TimeRotationPolicy
        attr_reader :time_file

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

          @time_file = time_file * 60
        end

        def rotate?(file)
          file.size > 0 && (Time.now - file.ctime) >= time_file
        end

        def needs_periodic?
          true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-output-swift-0.1 lib/logstash/outputs/swift/time_rotation_policy.rb