Class: Ibex::GenerationTransaction
- Inherits:
-
Object
- Object
- Ibex::GenerationTransaction
- Defined in:
- lib/ibex/generation_transaction.rb
Overview
Publishes a rendered ArtifactSet with rollback and a manifest-last marker.
Defined Under Namespace
Classes: Error, SourceChanged
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize(artifacts, warning: ->(_message) {}, stability_check: -> { true }, source_records: [], lock_sleeper: ->(seconds) { sleep(seconds) }) ⇒ GenerationTransaction
constructor
rubocop:disable Layout/LineLength.
Constructor Details
#initialize(artifacts, warning: ->(_message) {}, stability_check: -> { true }, source_records: [], lock_sleeper: ->(seconds) { sleep(seconds) }) ⇒ GenerationTransaction
rubocop:disable Layout/LineLength
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ibex/generation_transaction.rb', line 31 def initialize(artifacts, warning: ->() {}, stability_check: -> { true }, source_records: [], lock_sleeper: ->(seconds) { sleep(seconds) }) @artifacts = artifacts @warning = warning @stability_check = stability_check @source_records = source_records @lock_sleeper = lock_sleeper @locks = [] #: Array[File] @locked_paths = [] #: Array[String] @records = [] #: Array[Hash[Symbol, untyped]] @committed = false @temporary_sequence = 0 end |
Instance Method Details
#commit ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ibex/generation_transaction.rb', line 47 def commit @committed = false prepare_records validate_source_boundaries! acquire_locks prepare_records validate_source_boundaries! validate_locked_targets! ensure_sources_stable!("before staging outputs") stage_records ensure_sources_stable!("while staging outputs") backup_records sync_directories! install_group(:non_marker) sync_directories! ensure_sources_stable!("before parser publication") install_group(:parser) sync_directories! ensure_sources_stable!("after parser publication") install_group(:manifest) sync_directories! ensure_sources_stable!("after manifest publication") @committed = true cleanup_success rescue StandardError, SignalException => e @committed ? report_post_commit_failure(e) : handle_failure(e) ensure release_locks end |