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, Disk, Memory
Class Method Summary collapse
-
.default ⇒ Object
Selects a backend:
Nexo.config.run_storewhen a host set one, else 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: Nexo.config.run_store when a host set one, else 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.
The configured store wins over both, which is the only way a non-Rails host gets durability: everything that survives a process — checkpoint, suspend, resume, a run's recorded artifacts — is read back from the store, and Memory dies with the process. See Disk.
27 28 29 30 31 32 33 34 35 |
# File 'lib/nexo/run_store.rb', line 27 def self.default return Nexo.config.run_store if Nexo.config.run_store if defined?(::ActiveRecord::Base) && defined?(Nexo::WorkflowRun) ActiveRecord.new else Memory.new end end |