Class: Textus::Produce::Engine
- Inherits:
-
Object
- Object
- Textus::Produce::Engine
- Defined in:
- lib/textus/produce/engine.rb
Overview
The single convergence engine (ADR 0093/0094). “Make these machine entries current from upstream.” Acquire is per-‘from`; publish is one uniform `publish_via` entry point for all kinds (ADR 0094):
intake (from: handler) -> re-pull (Produce::Acquire::Intake), then publish_via
derived (from: project) -> build data + publish_via (ToPaths or None)
derived (from: command) -> skip the build; publish_via publishes
existing store bytes via mode resolution
(None when no targets -> skipped)
Runs as the reconcile build actor (self-elevating); the passed ‘call` supplies only correlation_id/dry_run. Callers choose the key set: the write subscriber passes rdeps ∩ derived; reconcile passes all-derived + stale-intake.
Defined Under Namespace
Modules: AsyncRunner
Class Method Summary collapse
-
.converge(container:, call:, keys:) ⇒ Object
Locked + failure-isolated convergence — the shared entry point for the write trigger (ADR 0093).
Instance Method Summary collapse
-
#call(keys:) ⇒ Object
keys: the machine entry keys to converge.
-
#initialize(container:, call:) ⇒ Engine
constructor
A new instance of Engine.
Constructor Details
#initialize(container:, call:) ⇒ Engine
Returns a new instance of Engine.
36 37 38 39 40 |
# File 'lib/textus/produce/engine.rb', line 36 def initialize(container:, call:) @container = container @call = call @manifest = container.manifest end |
Class Method Details
.converge(container:, call:, keys:) ⇒ Object
Locked + failure-isolated convergence — the shared entry point for the write trigger (ADR 0093). Both the sync path (inline, in the subscriber) and the async path (AsyncRunner) call this. A held lock is a soft miss (an in-flight build/reconcile already produces fresh output); any other error is republished as :produce_failed and never raised at the writer (ADR 0087 §5 failure isolation, preserved).
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/textus/produce/engine.rb', line 22 def self.converge(container:, call:, keys:) Textus::Ports::BuildLock.with(root: container.root) do new(container: container, call: call).call(keys: keys) end rescue Textus::BuildInProgress nil rescue Textus::Error => e container.events.publish( :produce_failed, ctx: Textus::Hooks::Context.for(container: container, call: call), keys: keys, error: e. ) end |
Instance Method Details
#call(keys:) ⇒ Object
keys: the machine entry keys to converge. Returns
{ produced: [k...], skipped: [k...], failed: [{ "key"=>, "error"=> }...] }
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/textus/produce/engine.rb', line 44 def call(keys:) build_call = build_actor_call context = build_context(build_call) out = { produced: [], skipped: [], failed: [] } keys.each do |key| produce_one(key, build_call, context, out) rescue Textus::Error => e out[:failed] << { "key" => key, "error" => e. } end out end |