pub struct UnresolvedWorkload { /* private fields */ }Expand description
An unresolved workload that has been initialized but not yet bound to plugins.
An UnresolvedWorkload represents a workload that has been validated and compiled
but has not yet been bound to host plugins or had its dependencies resolved.
This is an intermediate state in the workload lifecycle before becoming a
ResolvedWorkload that can be executed.
§Lifecycle
- Creation: Built from a [
Workload] specification via [Engine::initialize_workload] - Plugin Binding: Components are bound to required host plugins
- Resolution: Dependencies are resolved and the workload becomes
ResolvedWorkload - Execution: The resolved workload can create component instances and handle requests
§Plugin Resolution
During resolution, the workload will:
- Match required interfaces with available plugins
- Configure component linkers with plugin implementations
- Validate that all dependencies can be satisfied
- Create the final executable workload representation
Implementations§
Source§impl UnresolvedWorkload
impl UnresolvedWorkload
Sourcepub fn new(
id: impl Into<Arc<str>>,
name: impl Into<Arc<str>>,
namespace: impl Into<Arc<str>>,
service: Option<WorkloadService>,
components: impl IntoIterator<Item = WorkloadComponent>,
host_interfaces: Vec<WitInterface>,
) -> Self
pub fn new( id: impl Into<Arc<str>>, name: impl Into<Arc<str>>, namespace: impl Into<Arc<str>>, service: Option<WorkloadService>, components: impl IntoIterator<Item = WorkloadComponent>, host_interfaces: Vec<WitInterface>, ) -> Self
Creates a new unresolved workload from its constituent parts.
§Arguments
id- Unique identifier for this workload instancename- Human-readable name of the workloadnamespace- Namespace for workload organizationengine- The WebAssembly engine for compilation and executionservice- Optional long-running service componentcomponents- Iterator of components that make up this workloadhost_interfaces- Required WIT interfaces that must be provided by host plugins
§Returns
A new UnresolvedWorkload ready for plugin binding and resolution.
Sourcepub async fn bind_plugins(
&mut self,
plugins: &HashMap<&'static str, Arc<dyn HostPlugin + 'static>>,
) -> Result<Vec<(Arc<dyn HostPlugin + 'static>, Vec<String>)>>
pub async fn bind_plugins( &mut self, plugins: &HashMap<&'static str, Arc<dyn HostPlugin + 'static>>, ) -> Result<Vec<(Arc<dyn HostPlugin + 'static>, Vec<String>)>>
Bind this workload to the host plugins based on the requested interfaces. Returns a list of plugins and the component IDs they were bound to.
Sourcepub async fn resolve(
self,
plugins: Option<&HashMap<&'static str, Arc<dyn HostPlugin + 'static>>>,
) -> Result<ResolvedWorkload>
pub async fn resolve( self, plugins: Option<&HashMap<&'static str, Arc<dyn HostPlugin + 'static>>>, ) -> Result<ResolvedWorkload>
Resolves the workload by binding it to host plugins and creating the final executable workload.
This method performs the final resolution step that transforms an unresolved workload
into a ResolvedWorkload ready for execution. It:
- Binds components to matching host plugins based on required interfaces
- Configures component linkers with plugin implementations
- Validates that all component dependencies are satisfied
- Creates the final resolved workload representation
- Notifies plugins that the workload has been resolved
§Arguments
plugins- Optional map of available host plugins for binding
§Returns
A ResolvedWorkload ready for component instantiation and execution.
§Errors
Returns an error if:
- Required interfaces cannot be satisfied by available plugins
- Plugin binding fails
- Component linking fails
- Plugin notification fails
Auto Trait Implementations§
impl !RefUnwindSafe for UnresolvedWorkload
impl !UnwindSafe for UnresolvedWorkload
impl Freeze for UnresolvedWorkload
impl Send for UnresolvedWorkload
impl Sync for UnresolvedWorkload
impl Unpin for UnresolvedWorkload
impl UnsafeUnpin for UnresolvedWorkload
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