Stream: cargo-component

Topic: how to image the instantiate process of a component setup?


view this post on Zulip 林子篆 (Jan 10 2024 at 03:22):

The concept about core:module have no dependency, so is clear; but this is not the case about a component, if a component required some others, but been assigned as default to load, which will not working, but what should do in such case? If a component should be a start point, does it must have start function?

view this post on Zulip Peter Huene (Jan 15 2024 at 22:40):

Hi @林子篆. I'm not entirely sure I understand the question, so I'll try my best to answer you.

With components, a component may have a dependency on (i.e. import) another component one of two ways: by an _instance_ of a component (i.e. instance type) or by a component itself (i.e. component type).

When importing an instance, the importing component has no control over how its dependency is instantiated; it is simply provided when the component is itself instantiated.

When importing a component, the importing component has complete control over how the dependency is instantiated and can satisfy the dependency's dependencies however it sees fit.

Like modules, components may have a start section that defines what function to call and what values to pass the start function; however, that functionality relies on supporting importing of values, which is not currently implemented in Wasmtime (in fact, components with a start section will trigger an unimplemented! panic in Wasmtime at the moment).

At this time, most of the component model ecosystem is relying on the wasi:cli/run interface as the common, known start function to call to to "begin" a WASI CLI application.


Last updated: Nov 25 2024 at 19:03 UTC