Class: Textus::Maintenance::Tend

Inherits:
Object
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/maintenance/tend.rb

Overview

The destructive-only lifecycle sweep (ADR 0079, supersedes the composite 0078 body). Drives off the unified Domain::Lifecycle reporter: it applies destructive actions a read never performs (drop = delete via Write::KeyDelete; archive = copy to <store>/archive/ then delete) and refreshes cold expired intake entries (on_expire: refresh) via Write::FetchWorker. Non-destructive annotation (warn) is left to the lazy ‘get`/`freshness` path. Adds no new authority — every sub-op runs with the CALLER’s own ‘call` (role), and is gated exactly as on its own.

Instance Method Summary collapse

Methods included from Contract::DSL

arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Constructor Details

#initialize(container:, call:) ⇒ Tend

Returns a new instance of Tend.



26
27
28
29
# File 'lib/textus/maintenance/tend.rb', line 26

def initialize(container:, call:)
  @container = container
  @call      = call
end

Instance Method Details

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



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/textus/maintenance/tend.rb', line 31

def call(prefix: nil, zone: nil, dry_run: false)
  rows = Textus::Domain::Lifecycle.new(
    manifest: @container.manifest,
    file_stat: Textus::Ports::Storage::FileStat.new,
    clock: Textus::Ports::Clock,
  ).call(prefix: prefix, zone: zone)

  health = Read::Doctor.new(container: @container, call: @call).call
  return dry_run_result(rows, health) if dry_run

  apply_result(apply(rows), health)
end