Class: Textus::Domain::Retention

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/domain/retention.rb

Overview

Reports leaves whose age (now - file mtime) exceeds a retention window. Each row is { “key”, “path”, “action” => “expire”|“archive”, “age_seconds” }.

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, file_stat:, clock:) ⇒ Retention

Returns a new instance of Retention.



6
7
8
9
10
# File 'lib/textus/domain/retention.rb', line 6

def initialize(manifest:, file_stat:, clock:)
  @manifest  = manifest
  @file_stat = file_stat
  @clock     = clock
end

Instance Method Details

#call(prefix: nil, zone: nil) ⇒ Object



12
13
14
15
16
# File 'lib/textus/domain/retention.rb', line 12

def call(prefix: nil, zone: nil)
  @manifest.data.entries
           .select { |m| entry_matches?(m, prefix: prefix, zone: zone) }
           .flat_map { |m| rows_for(m) }
end