Module: Smith::Workflow::SplitStepPersistence::Preparation
- Included in:
- Smith::Workflow::SplitStepPersistence
- Defined in:
- lib/smith/workflow/split_step_persistence/preparation.rb
Instance Method Summary collapse
- #confirm_prepared_step! ⇒ Object
- #prepare_persisted_step!(key = nil, adapter: Smith.persistence_adapter) ⇒ Object
Instance Method Details
#confirm_prepared_step! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/smith/workflow/split_step_persistence/preparation.rb', line 21 def confirm_prepared_step! confirmation_claimed = false claim_split_step_confirmation! confirmation_claimed = true confirmed = false payload = @split_step_adapter.fetch(@split_step_persistence_key) raise WorkflowError, "the persisted split-step preparation is not committed" unless persisted_split_step_payload?(payload, @split_step_preparation_payload) @split_step_mutex.synchronize { @split_step_phase = :prepared } confirmed = true self ensure restore_unconfirmed_preparation! if confirmation_claimed && !confirmed end |
#prepare_persisted_step!(key = nil, adapter: Smith.persistence_adapter) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/smith/workflow/split_step_persistence/preparation.rb', line 7 def prepare_persisted_step!(key = nil, adapter: Smith.persistence_adapter) ensure_strict_split_step_persistence! intent_claimed = claim_split_step_preparation_intent! return unless intent_claimed preparation_finalized = false prepare_claimed_persisted_step!(key, adapter) preparation_finalized = true persist_claimed_split_step_preparation!(@split_step_persistence_key, @split_step_adapter) @split_step_transition_name ensure release_split_step_preparation_intent! if intent_claimed && !preparation_finalized end |