pub struct Switchyard<E: FactsEmitter, A: AuditSink> { /* private fields */ }Expand description
Facade for orchestrating Switchyard stages over a configured Policy and adapters.
Construct via ApiBuilder or Switchyard::builder and then call plan,
preflight, and apply in sequence. The type parameters E and A are
emitter types implementing FactsEmitter and AuditSink, respectively.
Implementations§
Source§impl<E: FactsEmitter, A: AuditSink> Switchyard<E, A>
impl<E: FactsEmitter, A: AuditSink> Switchyard<E, A>
Sourcepub fn new(facts: E, audit: A, policy: Policy) -> Self
pub fn new(facts: E, audit: A, policy: Policy) -> Self
Construct a Switchyard with defaults. This function delegates to the builder.
This delegates to ApiBuilder::new(facts, audit, policy).build() to
avoid duplicating initialization logic.
Sourcepub fn builder(facts: E, audit: A, policy: Policy) -> ApiBuilder<E, A>
pub fn builder(facts: E, audit: A, policy: Policy) -> ApiBuilder<E, A>
Entrypoint for constructing via the builder (default construction path).
Prefer this over new so you can configure optional adapters and timeouts.
Sourcepub fn with_lock_manager(self, lock: Box<dyn DebugLockManager>) -> Self
pub fn with_lock_manager(self, lock: Box<dyn DebugLockManager>) -> Self
Configure via ApiBuilder::with_lock_manager.
Sourcepub fn with_overrides(self, overrides: Overrides) -> Self
pub fn with_overrides(self, overrides: Overrides) -> Self
Configure per-instance overrides for simulations (tests/controlled scenarios).
Sourcepub fn with_ownership_oracle(self, owner: Box<dyn DebugOwnershipOracle>) -> Self
pub fn with_ownership_oracle(self, owner: Box<dyn DebugOwnershipOracle>) -> Self
Configure via ApiBuilder::with_ownership_oracle.
Sourcepub fn with_attestor(self, attest: Box<dyn DebugAttestor>) -> Self
pub fn with_attestor(self, attest: Box<dyn DebugAttestor>) -> Self
Configure via ApiBuilder::with_attestor.
Sourcepub fn with_smoke_runner(self, smoke: Box<dyn DebugSmokeTestRunner>) -> Self
pub fn with_smoke_runner(self, smoke: Box<dyn DebugSmokeTestRunner>) -> Self
Configure via ApiBuilder::with_smoke_runner.
Sourcepub const fn with_lock_timeout_ms(self, timeout_ms: u64) -> Self
pub const fn with_lock_timeout_ms(self, timeout_ms: u64) -> Self
Configure via ApiBuilder::with_lock_timeout_ms.
Sourcepub fn plan(&self, input: PlanInput) -> Plan
pub fn plan(&self, input: PlanInput) -> Plan
Build a Plan from the provided PlanInput with stable action ordering.
This emits planning facts and returns a Plan suitable for preflight and apply.
Sourcepub fn preflight(&self, plan: &Plan) -> Result<PreflightReport, ApiError>
pub fn preflight(&self, plan: &Plan) -> Result<PreflightReport, ApiError>
Execute preflight analysis for a plan.
Returns a PreflightReport containing rows (one per action), warnings, and stops.
§Errors
Returns an ApiError if the preflight analysis fails.
Sourcepub fn apply(
&self,
plan: &Plan,
mode: ApplyMode,
) -> Result<ApplyReport, ApiError>
pub fn apply( &self, plan: &Plan, mode: ApplyMode, ) -> Result<ApplyReport, ApiError>
Apply a plan in the specified mode.
Returns an ApplyReport with execution results. In Commit mode, missing
required adapters such as a LockManager may be mapped to ApiError::LockingTimeout.
§Errors
Returns an ApiError if the plan application fails.
Sourcepub fn plan_rollback_of(&self, report: &ApplyReport) -> Plan
pub fn plan_rollback_of(&self, report: &ApplyReport) -> Plan
Construct a rollback Plan that inverses executed actions from an ApplyReport.
Emits a planning fact for visibility and then builds the inverse plan.
Sourcepub fn prune_backups(&self, target: &SafePath) -> Result<PruneResult, ApiError>
pub fn prune_backups(&self, target: &SafePath) -> Result<PruneResult, ApiError>
Prune backup artifacts for a given target according to retention policy.
Emits a prune.result fact with details about counts and policy used.
§Errors
Returns an ApiError if backup pruning fails.