Skip to main content

Module host

Module host 

Source
Expand description

Host runtime for managing WebAssembly workloads and plugins.

The host module provides the runtime environment for executing WebAssembly workloads. It manages the lifecycle of components, coordinates with plugins to provide capabilities, and handles system resources.

§Key Components

  • Host - The main runtime that manages workloads and plugins
  • HostBuilder - Builder for configuring host settings
  • HostApi - Trait defining the host’s external API
  • HostWorkload - Internal representation of workload states

§Architecture

The host acts as the central coordinator between:

  • WebAssembly components that need execution
  • Plugins that provide WASI and other capabilities
  • System resources like networking and storage
  • External consumers through the HostApi

§Example

use wash_runtime::host::{HostBuilder, HostApi};
use wash_runtime::engine::Engine;
use std::sync::Arc;

let engine = Engine::builder().build()?;
let host = HostBuilder::new()
    .with_engine(engine)
    .with_friendly_name("my-host")
    .build()?;

let host = host.start().await?;
let heartbeat = host.heartbeat().await?;
println!("Host {} is running", heartbeat.friendly_name);

Structs§

Host
A wasmcloud host that manages WebAssembly workloads and plugins.
HostBuilder
Builder for the Host

Enums§

HostWorkload
Internal representation of a workload’s state within the host.

Traits§

HostApi
The API for interacting with a wasmcloud host.