Module: Nexo::RunStore
- Defined in:
- lib/nexo/run_store.rb
Overview
Storage seam for Workflow runs. Two interchangeable backends expose an identical create/find interface and return run objects responding to the same shape, which is what lets one Workflow implementation drive either the in-memory store (plain Ruby) or the ActiveRecord store (Rails).
A run object responds to: id, workflow_class, status, payload,
result, error, events, artifacts, state, plus update!(attrs),
push_event(event), save_events!, push_artifact(artifact),
save_artifacts!, and save_state! (Spec 13).
Defined Under Namespace
Classes: ActiveRecord, Memory
Class Method Summary collapse
-
.default ⇒ Object
Selects a backend: the ActiveRecord store when both ::ActiveRecord::Base and Nexo::WorkflowRun are defined (the Rails path), otherwise the in-memory store.
Class Method Details
.default ⇒ Object
Selects a backend: the ActiveRecord store when both ::ActiveRecord::Base and Nexo::WorkflowRun are defined (the Rails path), otherwise the in-memory store. With no Rails loaded the AR check short-circuits, so the plain-Ruby path never references ActiveRecord.
18 19 20 21 22 23 24 |
# File 'lib/nexo/run_store.rb', line 18 def self.default if defined?(::ActiveRecord::Base) && defined?(Nexo::WorkflowRun) ActiveRecord.new else Memory.new end end |