pub trait Runtime:
AsAny
+ Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 WorkloadSpec,
) -> Pin<Box<dyn Future<Output = Result<WorkloadHandle>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<WorkloadStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn logs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
opts: &'life2 LogOpts,
) -> Pin<Box<dyn Future<Output = Result<LogStream>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn stats<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<ResourceStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn resolve_host_port<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
_container_port: u16,
) -> Pin<Box<dyn Future<Output = Result<Option<u16>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn resolve_container_address<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_handle: &'life1 WorkloadHandle,
_container_port: u16,
_network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
The core runtime abstraction. Both container and Wasm runtimes implement this.
Required Methods§
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 WorkloadSpec,
) -> Pin<Box<dyn Future<Output = Result<WorkloadHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 WorkloadSpec,
) -> Pin<Box<dyn Future<Output = Result<WorkloadHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new workload from the given spec. Does not start it.
Sourcefn start<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start a previously created workload.
Sourcefn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop a running workload, waiting up to timeout for graceful shutdown.
Sourcefn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a stopped workload and clean up resources.
Sourcefn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<WorkloadStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<WorkloadStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the current status of a workload.
Sourcefn logs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
opts: &'life2 LogOpts,
) -> Pin<Box<dyn Future<Output = Result<LogStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn logs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
opts: &'life2 LogOpts,
) -> Pin<Box<dyn Future<Output = Result<LogStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream logs from a workload.
Sourcefn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a command inside a running workload.
Sourcefn stats<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<ResourceStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stats<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
) -> Pin<Box<dyn Future<Output = Result<ResourceStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get current resource usage stats.
Provided Methods§
Sourcefn resolve_host_port<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
_container_port: u16,
) -> Pin<Box<dyn Future<Output = Result<Option<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_host_port<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 WorkloadHandle,
_container_port: u16,
) -> Pin<Box<dyn Future<Output = Result<Option<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resolve the host-accessible port for a workload after it has been started.
Returns None if the runtime does not expose ports or the workload has no port mapping.
Default implementation returns None.
Sourcefn resolve_container_address<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_handle: &'life1 WorkloadHandle,
_container_port: u16,
_network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn resolve_container_address<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_handle: &'life1 WorkloadHandle,
_container_port: u16,
_network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Resolve the container’s network address (ip:port) on its Docker network.
This allows the proxy to route directly to the container IP
without going through host port mappings.
Returns None if not applicable (e.g., Wasm workloads).