mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-14 19:58:24 -04:00
3f1de9e096
# Description of Changes This commit builds support for executing procedures in WASM modules. This includes an HTTP endpoint, `/v1/database/:name_or_address/procedure/:name POST`, as well as an extension to the WS protocol. These new APIs are not wired up to the CLI or SDKs, but I have manually tested the HTTP endpoint via `curl`. The new WS extensions are completely untested. Several TODOs are scattered throughout the new code, most notably for sensibly tracking procedure execution time in the metrics. I also expect that we will want to remove the `procedure_sleep_until` syscall and the `ProcedureContext::sleep_until` method prior to release. # API and ABI breaking changes Adds new APIs and ABIs. # Expected complexity level and risk 3? 4? Unlikely to break existing stuff, 'cause it's mostly additive, but adds plenty of potentially-fragile new stuff. Notably is the first time we're doing anything actually `async`hronous on a database core Tokio worker, and we don't yet have strong evidence of how that will affect reducer execution. # Testing - [x] Manually published `modules/module-test` and executed procedures with the following `curl` invocations: - `curl -X POST -H "Content-Type:application/json" -d '[]' http://localhost:3000/v1/database/module-test/procedure/sleep_one_second` - `curl -X POST -H "Content-Type:application/json" -d '[1223]' http://localhost:3000/v1/database/module-test/procedure/return_value` - [ ] Need to write automated tests. --------- Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>