Class: Textus::Domain::Retention::Sweep
- Inherits:
-
Object
- Object
- Textus::Domain::Retention::Sweep
- Defined in:
- lib/textus/domain/retention/sweep.rb
Overview
Retention sweep reporter (ADR 0093/0099). Which entries are past their ‘retention:` ttl and the destructive action that applies. Age basis: file mtime. Only drop/archive. Renamed off the Domain::Retention vs Domain::Policy::Retention collision (ADR 0099).
Class Method Summary collapse
Instance Method Summary collapse
- #call(prefix: nil, zone: 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.
17 18 19 20 21 |
# File 'lib/textus/domain/retention/sweep.rb', line 17 def initialize(manifest:, file_stat:, clock:) @manifest = manifest @file_stat = file_stat @clock = clock end |
Class Method Details
.expired?(ttl_seconds:, mtime:, now:) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/textus/domain/retention/sweep.rb', line 11 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, zone: nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/textus/domain/retention/sweep.rb', line 23 def call(prefix: nil, zone: nil) @manifest.data.entries .select { |m| matches?(m, prefix: prefix, zone: zone) } .flat_map { |m| rows_for(m) } end |