Skip to main content

Substrate

Trait Substrate 

Source
pub trait Substrate: Send + Sync {
Show 24 methods // Required methods fn name(&self) -> &str; fn capabilities(&self) -> Capabilities; fn validate_definition(&self, def: &StackDef) -> Result<(), SubstrateFault>; fn supports_source_override(&self) -> bool; fn default_lease(&self) -> Duration; fn build_namespace( &self, def: &StackDef, instance: &InstanceContext<'_>, prior: &[Checkpoint], secrets: &BTreeMap<String, String>, purpose: NamespacePurpose, ) -> Namespace; fn execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx: StepContext<'life1>, ) -> Pin<Box<dyn Future<Output = Result<StepResource, SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, instance: &'life1 InstanceContext<'life2>, checkpoint: &'life3 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<Observation, SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn destroy<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, instance: &'life1 InstanceContext<'life2>, checkpoint: &'life3 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; // Provided methods fn can_manage_resource(&self, resource: &ResourceRecord) -> bool { ... } fn execution_plan(&self, def: &StackDef) -> Result<ExecutionPlan, DefError> { ... } fn supports_source_override_for( &self, _def: &StackDef, _service: &str, ) -> bool { ... } fn validate(&self, def: &StackDef) -> Result<(), SubstrateFault> { ... } fn service_origin( &self, def: &StackDef, instance: &InstanceContext<'_>, service: &str, ) -> String { ... } fn step_revision( &self, ctx: &StepContext<'_>, ) -> Result<String, SubstrateFault> { ... } fn refresh_each_operation(&self, step: &Step) -> bool { ... } fn reconcile<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: StepContext<'life1>, _previous: &'life2 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<StepResource, SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn destroy_record<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _store: &'life1 Store, instance: &'life2 InstanceContext<'life3>, resource: &'life4 ResourceRecord, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn observe_record<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _store: &'life1 Store, instance: &'life2 InstanceContext<'life3>, resource: &'life4 ResourceRecord, ) -> Pin<Box<dyn Future<Output = Result<Observation, SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn restore_routes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _store: &'life1 Store, _instance: &'life2 InstanceContext<'life3>, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn finalize_teardown<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _instance: &'life1 InstanceContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn spend<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<SpendInfo>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn spend_line<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn fetch_logs<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, _store: &'life1 Store, _def: &'life2 StackDef, _instance: &'life3 InstanceContext<'life4>, _services: &'life5 [String], _tail: usize, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ServiceLog>>, SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait { ... }
}

Required Methods§

Source

fn name(&self) -> &str

The name instances are bound to at creation (--on <name>).

Source

fn capabilities(&self) -> Capabilities

Source

fn validate_definition(&self, def: &StackDef) -> Result<(), SubstrateFault>

Substrate-specific shape validation of the definition — core has already checked everything substrate-blind.

Source

fn supports_source_override(&self) -> bool

Whether --source service=path pins are allowed here. Local substrates say yes; deploy-from-ref substrates say no (§1).

Source

fn default_lease(&self) -> Duration

Per-substrate lease default (§6).

Source

fn build_namespace( &self, def: &StackDef, instance: &InstanceContext<'_>, prior: &[Checkpoint], secrets: &BTreeMap<String, String>, purpose: NamespacePurpose, ) -> Namespace

Build the interpolation namespace for one instance.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx: StepContext<'life1>, ) -> Pin<Box<dyn Future<Output = Result<StepResource, SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute one step, returning the resource for the journal.

Source

fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, instance: &'life1 InstanceContext<'life2>, checkpoint: &'life3 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<Observation, SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Re-check a recorded resource against reality.

Source

fn destroy<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, instance: &'life1 InstanceContext<'life2>, checkpoint: &'life3 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Destroy a recorded resource. Returning Ok is a claim the engine immediately verifies with observe — silence is not success (invariant 4).

Provided Methods§

Source

fn can_manage_resource(&self, resource: &ResourceRecord) -> bool

Route inventory records without granting ownership of their resources.

Source

fn execution_plan(&self, def: &StackDef) -> Result<ExecutionPlan, DefError>

Source

fn supports_source_override_for(&self, _def: &StackDef, _service: &str) -> bool

Source

fn validate(&self, def: &StackDef) -> Result<(), SubstrateFault>

Source

fn service_origin( &self, def: &StackDef, instance: &InstanceContext<'_>, service: &str, ) -> String

The origin ${services.X.origin} resolves to for this substrate.

Source

fn step_revision(&self, ctx: &StepContext<'_>) -> Result<String, SubstrateFault>

Source

fn refresh_each_operation(&self, step: &Step) -> bool

Whether a new operation must re-evaluate this step despite a matching revision.

Source

fn reconcile<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: StepContext<'life1>, _previous: &'life2 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<StepResource, SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Apply changed inputs to an existing resource. Providers must preserve its ownership handle or explicitly replace and retire it in the journal.

Source

fn destroy_record<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _store: &'life1 Store, instance: &'life2 InstanceContext<'life3>, resource: &'life4 ResourceRecord, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Recover and destroy unfinished inventory without losing newly discovered handles.

Source

fn observe_record<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _store: &'life1 Store, instance: &'life2 InstanceContext<'life3>, resource: &'life4 ResourceRecord, ) -> Pin<Box<dyn Future<Output = Result<Observation, SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Source

fn restore_routes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _store: &'life1 Store, _instance: &'life2 InstanceContext<'life3>, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Rebuild controller routes from verified runtime handles after restart.

Source

fn finalize_teardown<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _instance: &'life1 InstanceContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Substrate-wide cleanup after verified teardown (e.g. delete a shared Stripe Projects environment).

Source

fn spend<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<SpendInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Structured spend for --json envelopes (§4). Substrates that spend nothing (local) return None.

Source

fn spend_line<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Human spend line after up/down (§4 — never silently nothing).

Source

fn fetch_logs<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, _store: &'life1 Store, _def: &'life2 StackDef, _instance: &'life3 InstanceContext<'life4>, _services: &'life5 [String], _tail: usize, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ServiceLog>>, SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Recent logs for services (§2 — recent window, no streaming). None means this substrate has no log facility (the daemon never saw the processes and there is no remote log API); the CLI reports that rather than inventing output.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§