Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the concept of a WASM manifest; use cacache for local stora…
…ge (#39) This PR reworks the agent API and the cli to support a new concept of a "manifest". This is a toml specification of a WASM job type. It includes a name, a namespace, a path to a binary, and some human-readable descriptions. Here's an example manifest: ```toml name = "loudify" namespace = "sh.serval" binary = "../../wasm-samples/build/loudify.wasm" version = "1" description = "SHOUT SHOUT LET IT ALL OUT" required_extensions = ["birdfeeder"] ``` Once a WASM manifest + executable has been stored in the system, you can execute that wasm using the name in the manifest: `pounce run sh.serval.loudify inputfile.txt` The local blob storage has been reimplemented to use the [cacache](https://lib.rs/crates/cacache) crate. This is a content-adddressable store that *also* allows lookup of items by key. In our case we store manifests with keys like `name.manifest.toml` and wasm executables with names like `name.wasm`. Execution of jobs is now more indirect than it was, in that we look up the manifest by name, and from that look up where the binary is by version. This indirection allows us to support versioning more fully in the long term. This PR also significantly reworks the agent API and changes the CLI to support this new API. The agent endpoints now look like this: - `GET /monitor/ping`: cheap health check - `POST /v1/jobs/:name/run`: body is interpreted as job input - `GET /v1/storage/manifests`: fetch a list of manifests - `POST /v1/storage/manifests`: store a new manifest - `GET /v1/storage/manifests/:name`: get a manifest by name - `HEAD /v1/storage/manifests/:name`: 404s if manifest not found - `PUT /v1/storage/manifests/:name/executable/:version`: store a new wasm executable associated with the named task manifest - `GET /v1/storage/manifests/:name/executable/:version`: get a wasm executable by manifest name & version - `GET /v1/monitor/history`: very cheap run history; to be deleted - `GET /v1/jobs`: list all running jobs; not implemented Also, take a few minor updates to crates; revert change to the workspace syntax because it is making VSCode angry. * Clean up error -> status mapping. * WASM paths are now relative to the manifest path. As is right and proper. * better cargo run hint!
- Loading branch information
Showing
15 changed files
with
1,083 additions
and
453 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Oops, something went wrong.