-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from andrzejressel/docs
More docs
- Loading branch information
Showing
5 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Outputs | ||
|
||
## Types of Output | ||
|
||
Pulumi WASM has 4 types of outputs: | ||
1. Done | ||
2. Mapped | ||
3. Func | ||
4. Unknown | ||
|
||
### Done | ||
|
||
This is output for which value is known. Internally it's represented as MessagePack's `Value`. | ||
|
||
### Mapped | ||
|
||
This is output which wait to be mapped by host. More details are in [Mapping](#Mapping) section. Internally it's represented as tuple of function name and output which will values will be it's argument. | ||
|
||
### Func | ||
|
||
This is output that is a function. As opposed to `Mapped` this function in executed internally in Pulumi WASM. Currently these are | ||
functions that creates resources. Internally it's tuple of list of outputs and function that handles their values. | ||
|
||
### Unknown | ||
|
||
This is output for which value will never be known. This is used in Pulumi's preview stage. | ||
|
||
## Mapping | ||
|
||
One of Pulumi features is allowing transforming values in programming languages as opposed to | ||
configuration language like in Terraform. While it's obvious how to do that when everything is written in one language | ||
in Pulumi WASM it's not the case - internals are written in Rust compiled to WASM, while user code | ||
can be written in any language that can be compiled to WASM. | ||
|
||
To handle it mapping value has 2 stages: | ||
|
||
1. Save function in global map (in functional languages it may be monad) | ||
2. Iterating over all values that be mapped and invoking function on it. | ||
|
||
Simplified sequence diagram of this process: | ||
|
||
```mermaid | ||
sequenceDiagram | ||
User --> User: Create function | ||
User --> User: Assign ID to function | ||
User -> Pulumi_WASM: Map given output with function "ID" | ||
Note left of User: Other computations | ||
loop While there are still outputs to map (1) | ||
User -> Pulumi_WASM: Get output values with function ids | ||
User --> User: Compute results | ||
User -> Pulumi_WASM: Return values | ||
end | ||
``` | ||
|
||
(1) Outputs ready to be mapped are of type `Func` for which input is type `Done` | ||
|
||
Currently due to single threaded nature of WASM this operation is done at the end of the program. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# WIT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Crates | ||
|
||
### Pulumi WASM | ||
|
||
Main WASM component. Currently implements Output handling, send and handles requests to Pulumi. | ||
|
||
### Pulumi WASM runner | ||
|
||
x64 application that runs the WASM component. | ||
Implements `component:[email protected]/external-world` and `component:[email protected]/log` interfaces. | ||
|
||
### Pulumi WASM Rust | ||
|
||
Rust library that provides a high-level and typesafe API for Pulumi WASM. It's a wrapper around `pulumi-wasm` interfaces. | ||
Also provides `pulumi_main` macro via `pub use` from `Pulumi WASM Rust Macro`. | ||
|
||
### Pulumi WASM Rust Macro | ||
|
||
Rust library with `pulumi_main` macro. Addon to `Pulumi WASM Rust` | ||
|
||
### WASM Common | ||
|
||
Library used in WASM components of Pulumi providers. Currently provides logging facilities. | ||
|
||
### Pulumi WASM Provider Random | ||
|
||
WASM component for Pulumi's Random provider. Currently handwritten - | ||
after [#5](https://github.com/andrzejressel/pulumi-wasm/issues/5) generated. | ||
|
||
### Pulumi WASM Provider Random Rust | ||
|
||
Rust library that provides a high-level and typesafe API for `Pulumi WASM Provider Random` WASM component. | ||
Currently handwritten - after [#5](https://github.com/andrzejressel/pulumi-wasm/issues/5) generated. | ||
|
||
### examples/simple | ||
|
||
Currently the only example. It's a simple Pulumi program that uses `Pulumi WASM Provider Random Rust` to generate random numbers. | ||
In future will be one of integration tests. |