Skip to content

Commit

Permalink
shim: organize code to different modules
Browse files Browse the repository at this point in the history
this commit organized code to different modules:
- constants: to handling constants across entire crate
- engine: the execution engine
- source: manages application sources
- stdio_hook: a trigger hook for stdio
- trigger: manages spin triggers
- utils: utility functions

it also removes ResolvedAppSource as it's not needed

Signed-off-by: jiaxiao zhou <[email protected]>
  • Loading branch information
Mossaka committed Sep 10, 2024
1 parent 378917c commit 7e35184
Show file tree
Hide file tree
Showing 7 changed files with 539 additions and 528 deletions.
22 changes: 22 additions & 0 deletions containerd-shim-spin/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// SPIN_ADDR_DEFAULT is the default address and port that the Spin HTTP trigger
/// listens on.
pub(crate) const SPIN_ADDR_DEFAULT: &str = "0.0.0.0:80";
/// SPIN_HTTP_LISTEN_ADDR_ENV is the environment variable that can be used to
/// override the default address and port that the Spin HTTP trigger listens on.
pub(crate) const SPIN_HTTP_LISTEN_ADDR_ENV: &str = "SPIN_HTTP_LISTEN_ADDR";
/// RUNTIME_CONFIG_PATH specifies the expected location and name of the runtime
/// config for a Spin application. The runtime config should be loaded into the
/// root `/` of the container.
pub(crate) const RUNTIME_CONFIG_PATH: &str = "/runtime-config.toml";
/// Describes an OCI layer with Wasm content
pub(crate) const OCI_LAYER_MEDIA_TYPE_WASM: &str = "application/vnd.wasm.content.layer.v1+wasm";
/// Expected location of the Spin manifest when loading from a file rather than
/// an OCI image
pub(crate) const SPIN_MANIFEST_FILE_PATH: &str = "/spin.toml";
/// Known prefix for the Spin application variables environment variable
/// provider: https://github.com/fermyon/spin/blob/436ad589237c02f7aa4693e984132808fd80b863/crates/variables/src/provider/env.rs#L9
pub(crate) const SPIN_APPLICATION_VARIABLE_PREFIX: &str = "SPIN_VARIABLE";
/// Working directory for Spin applications
pub(crate) const SPIN_TRIGGER_WORKING_DIR: &str = "/";
/// Name of the Spin lock file
pub(crate) const SPIN_LOCK_FILE_NAME: &str = "spin.lock";
Loading

0 comments on commit 7e35184

Please sign in to comment.