Skip to main content

UnresolvedWorkload

Struct UnresolvedWorkload 

Source
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

  1. Creation: Built from a [Workload] specification via [Engine::initialize_workload]
  2. Plugin Binding: Components are bound to required host plugins
  3. Resolution: Dependencies are resolved and the workload becomes ResolvedWorkload
  4. 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

Source

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 instance
  • name - Human-readable name of the workload
  • namespace - Namespace for workload organization
  • engine - The WebAssembly engine for compilation and execution
  • service - Optional long-running service component
  • components - Iterator of components that make up this workload
  • host_interfaces - Required WIT interfaces that must be provided by host plugins
§Returns

A new UnresolvedWorkload ready for plugin binding and resolution.

Source

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.

Source

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:

  1. Binds components to matching host plugins based on required interfaces
  2. Configures component linkers with plugin implementations
  3. Validates that all component dependencies are satisfied
  4. Creates the final resolved workload representation
  5. 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
Source

pub fn id(&self) -> &str

Gets the unique identifier of the workload

Source

pub fn name(&self) -> &str

Gets the name of the workload

Source

pub fn namespace(&self) -> &str

Gets the namespace of the workload

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetSetFdFlags for T

Source§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
Source§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: Sized + AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more