Class: Textus::Maintenance::Retention::Apply
- Inherits:
-
Object
- Object
- Textus::Maintenance::Retention::Apply
- Defined in:
- lib/textus/maintenance/retention/apply.rb
Overview
The destructive half of convergence: apply retention rows (drop/archive). Lifted verbatim from the legacy reconcile apply/archive_leaf so drain/serve and the ‘sweep` job handler share one path. Runs as the caller’s role — never self-elevates (ADR 0079/0093: destructiveness decides authority).
Instance Method Summary collapse
- #call(rows) ⇒ Object
-
#initialize(container:, call:) ⇒ Apply
constructor
A new instance of Apply.
Constructor Details
#initialize(container:, call:) ⇒ Apply
Returns a new instance of Apply.
11 12 13 14 |
# File 'lib/textus/maintenance/retention/apply.rb', line 11 def initialize(container:, call:) @container = container @call = call end |
Instance Method Details
#call(rows) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/textus/maintenance/retention/apply.rb', line 16 def call(rows) out = { dropped: [], archived: [], failed: [] } delete = Write::KeyDelete.new(container: @container, call: @call) rows.each do |row| key = row["key"] begin case row["action"] when "drop" delete.call(key) out[:dropped] << key when "archive" archive_leaf(row) delete.call(key) out[:archived] << key end rescue Textus::Error => e out[:failed] << { "key" => key, "error" => e. } end end out end |