Class: Phronomy::Persistence
- Inherits:
-
Object
- Object
- Phronomy::Persistence
- Defined in:
- lib/phronomy/persistence.rb,
lib/phronomy/persistence/in_memory.rb
Defined Under Namespace
Classes: ConflictError, InMemory, NotFoundError, UnsupportedBackendError
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#executions ⇒ Object
readonly
Returns the value of attribute executions.
-
#journals ⇒ Object
readonly
Returns the value of attribute journals.
-
#workflow_states ⇒ Object
readonly
Returns the value of attribute workflow_states.
Instance Method Summary collapse
-
#assert_agent_watermark!(agent_id:, agent_revision:, journal_position:) ⇒ Object
private
Verifies that a live Agent still owns the durable base it hydrated.
- #capabilities ⇒ Object
-
#initialize(contents:, agents:, journals:, executions:, workflow_states:) ⇒ Persistence
constructor
A new instance of Persistence.
- #transaction ⇒ Object
Constructor Details
#initialize(contents:, agents:, journals:, executions:, workflow_states:) ⇒ Persistence
Returns a new instance of Persistence.
11 12 13 14 15 16 17 18 |
# File 'lib/phronomy/persistence.rb', line 11 def initialize(contents:, agents:, journals:, executions:, workflow_states:) @contents = contents @agents = agents @journals = journals @executions = executions @workflow_states = workflow_states validate_capabilities! end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
9 10 11 |
# File 'lib/phronomy/persistence.rb', line 9 def agents @agents end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
9 10 11 |
# File 'lib/phronomy/persistence.rb', line 9 def contents @contents end |
#executions ⇒ Object (readonly)
Returns the value of attribute executions.
9 10 11 |
# File 'lib/phronomy/persistence.rb', line 9 def executions @executions end |
#journals ⇒ Object (readonly)
Returns the value of attribute journals.
9 10 11 |
# File 'lib/phronomy/persistence.rb', line 9 def journals @journals end |
#workflow_states ⇒ Object (readonly)
Returns the value of attribute workflow_states.
9 10 11 |
# File 'lib/phronomy/persistence.rb', line 9 def workflow_states @workflow_states end |
Instance Method Details
#assert_agent_watermark!(agent_id:, agent_revision:, journal_position:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Verifies that a live Agent still owns the durable base it hydrated. Backends should implement this as a revision/position precondition check, not as a state reload returned to the caller.
32 33 34 35 |
# File 'lib/phronomy/persistence.rb', line 32 def assert_agent_watermark!(agent_id:, agent_revision:, journal_position:) raise UnsupportedBackendError, "#{self.class} does not provide Agent durable-watermark checks" end |
#capabilities ⇒ Object
20 21 22 |
# File 'lib/phronomy/persistence.rb', line 20 def capabilities {atomic_all: false, atomic_admission: false}.freeze end |
#transaction ⇒ Object
24 25 26 |
# File 'lib/phronomy/persistence.rb', line 24 def transaction raise UnsupportedBackendError, "#{self.class} does not provide atomic_all" end |