Class: Pangea::Magma::Orchestrator
- Defined in:
- lib/pangea/magma/orchestrator.rb
Overview
The umbrella primitive — composes Workspace + Chain + Migration + Distribution into one operator-facing surface. Per theory/PANGEA-MAGMA-ORCHESTRATION.md §III.6.
Authors:
orch = Pangea::Magma::Orchestrator.new(
distribution: dist,
attestation: { enabled: true },
)
orch.deploy! # full reconcile across the distribution
orch.deploy!(only: [:seph_vpc]) # subset
orch.migrate!(migration) # apply a typed Migration plan
orch.attestation_chain # aggregated tameshi receipts
Instance Attribute Summary collapse
-
#attestation ⇒ Object
readonly
Returns the value of attribute attestation.
-
#distribution ⇒ Object
readonly
Returns the value of attribute distribution.
-
#optimization ⇒ Object
readonly
Returns the value of attribute optimization.
Instance Method Summary collapse
-
#attestation_chain ⇒ Object
Aggregate tameshi attestation receipts across every workspace in the distribution.
-
#deploy!(only: nil) ⇒ Object
Full reconcile across the distribution.
-
#diff(target_distribution:) ⇒ Object
Cross-distribution diff — describe what would change if we re-distributed (e.g. tier_separation → per_provider).
-
#initialize(distribution:, optimization: nil, attestation: {}) ⇒ Orchestrator
constructor
A new instance of Orchestrator.
-
#migrate!(migration) ⇒ Object
Apply a typed Migration plan.
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(distribution:, optimization: nil, attestation: {}) ⇒ Orchestrator
Returns a new instance of Orchestrator.
27 28 29 30 31 |
# File 'lib/pangea/magma/orchestrator.rb', line 27 def initialize(distribution:, optimization: nil, attestation: {}) @distribution = distribution @optimization = optimization @attestation = attestation end |
Instance Attribute Details
#attestation ⇒ Object (readonly)
Returns the value of attribute attestation.
25 26 27 |
# File 'lib/pangea/magma/orchestrator.rb', line 25 def attestation @attestation end |
#distribution ⇒ Object (readonly)
Returns the value of attribute distribution.
25 26 27 |
# File 'lib/pangea/magma/orchestrator.rb', line 25 def distribution @distribution end |
#optimization ⇒ Object (readonly)
Returns the value of attribute optimization.
25 26 27 |
# File 'lib/pangea/magma/orchestrator.rb', line 25 def optimization @optimization end |
Instance Method Details
#attestation_chain ⇒ Object
Aggregate tameshi attestation receipts across every workspace in the distribution. Returns the typed chain Hash. M0.4.
63 64 65 66 |
# File 'lib/pangea/magma/orchestrator.rb', line 63 def attestation_chain raise NotImplementedError, "Orchestrator#attestation_chain awaits M0.4 magma-attest aggregation" end |
#deploy!(only: nil) ⇒ Object
Full reconcile across the distribution. Returns the AggregateReport from ‘magma flow run`. The Orchestrator’s ‘:optimization` attaches to the chain so its hints survive the round-trip through the flow.json.
37 38 39 40 41 42 |
# File 'lib/pangea/magma/orchestrator.rb', line 37 def deploy!(only: nil) chain = @distribution.to_chain chain = chain.with_optimization(@optimization) if @optimization chain = subset_chain(chain, only) if only && !only.empty? chain.reconcile_all end |
#diff(target_distribution:) ⇒ Object
Cross-distribution diff — describe what would change if we re-distributed (e.g. tier_separation → per_provider). M0.3 implementation; the typed surface ships now.
54 55 56 57 58 59 |
# File 'lib/pangea/magma/orchestrator.rb', line 54 def diff(target_distribution:) raise NotImplementedError, "Orchestrator#diff awaits M0.3 distribution-diff implementation; " \ "current=#{@distribution.strategy}, " \ "target=#{target_distribution.strategy}" end |
#migrate!(migration) ⇒ Object
Apply a typed Migration plan. Routes to Migration#apply! which drives ‘magma migrate` (M0.2). For M0.1 this raises with the typed plan available for inspection.
47 48 49 |
# File 'lib/pangea/magma/orchestrator.rb', line 47 def migrate!(migration) migration.plan.apply! end |
#to_h ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/pangea/magma/orchestrator.rb', line 68 def to_h { distribution: @distribution.to_h, optimization: @optimization&.to_h, attestation: @attestation, } end |
#to_json(*args) ⇒ Object
76 77 78 |
# File 'lib/pangea/magma/orchestrator.rb', line 76 def to_json(*args) to_h.to_json(*args) end |