Class: Textus::Domain::Policy::Retention

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

Overview

Garbage collection (ADR 0093). A glob-matched rule slot: when an entry ages past ‘ttl`, retire it. Destructive only — runs on the full `reconcile` pass, never on a write (ADR 0079’s invariant). Orthogonal to production (‘source:`): an intake entry can re-pull hourly AND archive after 90 days. `warn`/`refresh` are gone (refresh is implied by an intake source; warn never fired after ADR 0089’s pure-read get).

Constant Summary collapse

ACTIONS =
%i[drop archive].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Retention

Returns a new instance of Retention.



15
16
17
18
19
20
21
22
# File 'lib/textus/domain/policy/retention.rb', line 15

def initialize(raw)
  @ttl = raw["ttl"] or
    raise Textus::BadManifest.new("retention requires a 'ttl:'")
  @action = (raw["action"] || "").to_s.to_sym
  return if ACTIONS.include?(@action)

  raise Textus::BadManifest.new("retention action must be one of #{ACTIONS.join("|")}, got #{raw["action"].inspect}")
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



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

def action
  @action
end

Instance Method Details

#destructive?Boolean

Returns:

  • (Boolean)


25
# File 'lib/textus/domain/policy/retention.rb', line 25

def destructive? = true

#ttl_secondsObject



24
# File 'lib/textus/domain/policy/retention.rb', line 24

def ttl_seconds = Textus::Domain::Duration.seconds(@ttl)