pub struct Host { /* private fields */ }Expand description
A wasmcloud host that manages WebAssembly workloads and plugins.
The Host is the primary runtime for executing workloads. It manages:
- An engine for compiling and running WebAssembly components
- A collection of workloads and their states
- Plugins that extend host functionality
- System monitoring and resource tracking
Implementations§
Source§impl Host
impl Host
Sourcepub fn builder() -> HostBuilder
pub fn builder() -> HostBuilder
Create a new builder for the host.
Sourcepub async fn stop(self: Arc<Self>) -> Result<()>
pub async fn stop(self: Arc<Self>) -> Result<()>
Stop the host and shut down all plugins.
Attempts to gracefully stop all plugins with a 3-second timeout for each. Errors are logged but don’t prevent other plugins from being stopped.
§Returns
Ok if the shutdown process completes (even with plugin errors).
Sourcepub fn friendly_name(&self) -> &str
pub fn friendly_name(&self) -> &str
Sourcepub fn wit_world(&self) -> WitWorld
pub fn wit_world(&self) -> WitWorld
Returns the WIT (imports, exports) that this host can provide to any component.
Put another way, this represents a simplified version of the host world. For example, this WIT world:
package wasmcloud:host@0.1.0;
interface foo {
...
}
interface bar {
...
}
world host {
import foo;
export bar;
}Would be returned as: ( vec![WitInterface { namespace: “wasmcloud”, package: “host”, interfaces: [“foo”], version: Some(“0.1.0”) }], vec![WitInterface { namespace: “wasmcloud”, package: “host”, interfaces: [“bar”], version: Some(“0.1.0”) }], )
This can be viewed as an inversion of the worlds that this host can support. In the above example,
this host can support any component that imports bar and exports foo. Other exports will be ignored,
and other imports that are unsatisfied will be rejected.
Trait Implementations§
Source§impl HostApi for Host
impl HostApi for Host
Source§async fn workload_start(
&self,
request: WorkloadStartRequest,
) -> Result<WorkloadStartResponse>
async fn workload_start( &self, request: WorkloadStartRequest, ) -> Result<WorkloadStartResponse>
Start a workload
Source§async fn heartbeat(&self) -> Result<HostHeartbeat>
async fn heartbeat(&self) -> Result<HostHeartbeat>
Source§async fn workload_status(
&self,
request: WorkloadStatusRequest,
) -> Result<WorkloadStatusResponse>
async fn workload_status( &self, request: WorkloadStatusRequest, ) -> Result<WorkloadStatusResponse>
Source§async fn workload_stop(
&self,
request: WorkloadStopRequest,
) -> Result<WorkloadStopResponse>
async fn workload_stop( &self, request: WorkloadStopRequest, ) -> Result<WorkloadStopResponse>
Auto Trait Implementations§
impl !RefUnwindSafe for Host
impl !UnwindSafe for Host
impl Freeze for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnsafeUnpin for Host
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more