Class: Textus::Store::Jobs::Retention::Sweep
- Inherits:
-
Object
- Object
- Textus::Store::Jobs::Retention::Sweep
- Defined in:
- lib/textus/store/jobs/retention/sweep.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(prefix: nil, lane: nil) ⇒ Object
-
#initialize(manifest:, file_stat:, clock:) ⇒ Sweep
constructor
A new instance of Sweep.
Constructor Details
#initialize(manifest:, file_stat:, clock:) ⇒ Sweep
Returns a new instance of Sweep.
14 15 16 17 18 |
# File 'lib/textus/store/jobs/retention/sweep.rb', line 14 def initialize(manifest:, file_stat:, clock:) @manifest = manifest @file_stat = file_stat @clock = clock end |
Class Method Details
.expired?(ttl_seconds:, mtime:, now:) ⇒ Boolean
8 9 10 11 12 |
# File 'lib/textus/store/jobs/retention/sweep.rb', line 8 def self.expired?(ttl_seconds:, mtime:, now:) return false if ttl_seconds.nil? || mtime.nil? (now - mtime).to_i > ttl_seconds end |
Instance Method Details
#call(prefix: nil, lane: nil) ⇒ Object
20 21 22 23 24 |
# File 'lib/textus/store/jobs/retention/sweep.rb', line 20 def call(prefix: nil, lane: nil) @manifest.data.entries .select { |m| matches?(m, prefix: prefix, lane: lane) } .flat_map { |m| rows_for(m) } end |