Commit bc6fe15
authored
Optionally call main() in WASI reactors as a convenience. (proxy-wasm#133)
WASI reactors differ from WASI commands in that they have multiple
entrypoints (i.e. proxy_on_* callbacks) instead of only main().
Currently, each Proxy-Wasm SDK uses different approch to startup:
- AssemblyScript SDK uses Wasm's start function.
- C++ SDK creates WASI reactor with global C++ constructors taking
care of early initialization and registration of plugins.
- Rust SDK creates Wasm library, and suggests (via examples) using
_start() function called at startup to do early initialization.
Unfortunately, this is the same function name that WASI commands
are using, which means that WASI constructors cannot be injected
and executed at startup.
- TinyGo SDK creates WASI command and calls main() at startup, but
it doesn't exit after main() function returns.
Calling main() in WASI reactors would allow us to prepare for when
they are stablized in Rust, and to have a non-breaking fallback in
case TinyGo decides to exit after main() function returns.
Signed-off-by: Piotr Sikora <[email protected]>1 parent 5ea92c8 commit bc6fe15
3 files changed
+21
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 199 | + | |
| 200 | + | |
202 | 201 | | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
170 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
284 | 287 | | |
285 | 288 | | |
286 | 289 | | |
| 290 | + | |
287 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
288 | 300 | | |
| 301 | + | |
289 | 302 | | |
290 | | - | |
291 | | - | |
292 | 303 | | |
293 | 304 | | |
294 | 305 | | |
| |||
0 commit comments