Skip to main content

Substrate

Trait Substrate 

Source
pub trait Substrate: Send + Sync {
Show 13 methods // Required methods fn name(&self) -> &str; fn validate_definition(&self, def: &StackDef) -> Result<(), SubstrateFault>; fn supports_source_override(&self) -> bool; fn default_lease(&self) -> Duration; fn service_origin( &self, def: &StackDef, instance: &str, service: &str, ) -> String; fn build_namespace( &self, def: &StackDef, instance: &str, 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, 'async_trait>( &'life0 self, instance: &'life1 str, checkpoint: &'life2 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; fn destroy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, instance: &'life1 str, checkpoint: &'life2 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; // Provided methods fn finalize_teardown<'life0, 'life1, 'async_trait>( &'life0 self, _instance: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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, 'async_trait>( &'life0 self, _def: &'life1 StackDef, _instance: &'life2 str, _services: &'life3 [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 { ... }
}

Required Methods§

Source

fn name(&self) -> &str

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

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 service_origin( &self, def: &StackDef, instance: &str, service: &str, ) -> String

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

Source

fn build_namespace( &self, def: &StackDef, instance: &str, 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, 'async_trait>( &'life0 self, instance: &'life1 str, checkpoint: &'life2 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,

Re-check a recorded resource against reality.

Source

fn destroy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, instance: &'life1 str, checkpoint: &'life2 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: '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 finalize_teardown<'life0, 'life1, 'async_trait>( &'life0 self, _instance: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateFault>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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, 'async_trait>( &'life0 self, _def: &'life1 StackDef, _instance: &'life2 str, _services: &'life3 [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,

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§