Module: Rubino::Run::GateRegistry

Defined in:
lib/rubino/run/gate_registry.rb

Overview

Process-wide registry of ApprovalGate instances, keyed by run_id. Module-level state (no instance): one hash + one mutex held at the module singleton class.

Lifecycle: Executor#start calls register when a run begins and unregister in its ensure block; HTTP decision endpoints call fetch to resolve the gate before forwarding a decision.

Single-process only: the gate lives in the Ruby heap, so this does not survive multi-process scaling (Puma workers, forked servers). Decisions routed to the wrong worker silently fail #fetch.

Class Method Summary collapse

Class Method Details

.fetch(run_id) ⇒ Object



25
26
27
# File 'lib/rubino/run/gate_registry.rb', line 25

def fetch(run_id)
  @mutex.synchronize { @gates[run_id] }
end

.register(run_id, gate) ⇒ Object



21
22
23
# File 'lib/rubino/run/gate_registry.rb', line 21

def register(run_id, gate)
  @mutex.synchronize { @gates[run_id] = gate }
end

.reset!Object



33
34
35
# File 'lib/rubino/run/gate_registry.rb', line 33

def reset!
  @mutex.synchronize { @gates.clear }
end

.unregister(run_id) ⇒ Object



29
30
31
# File 'lib/rubino/run/gate_registry.rb', line 29

def unregister(run_id)
  @mutex.synchronize { @gates.delete(run_id) }
end