Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Brian H <brian.hardock@fermyon.com>
  • Loading branch information
fibonacci1729 committed Jul 23, 2024
1 parent 5d028fb commit 3ee065c
Show file tree
Hide file tree
Showing 43 changed files with 22,138 additions and 144 deletions.
120 changes: 100 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async-trait = "0.1"
ouroboros = "0.18.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
spin-common = { path = "../common" }
spin-core = { path = "../core" }
spin-locked-app = { path = "../locked-app" }
spin-serde = { path = "../serde" }
thiserror = "1.0"
12 changes: 7 additions & 5 deletions crates/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ pub trait Loader {
/// representation of a [`LockedApp`], which will be loaded.
async fn load_app(&self, uri: &str) -> anyhow::Result<LockedApp>;

/// Called with a [`LockedComponentSource`] pointing to a Wasm component
/// binary, which will be loaded.
/// Called with an [`AppComponent`] the Wasm component binary specified
/// by source will be componentized and composed with each of its
/// dependencies.
async fn load_component(
&self,
engine: &wasmtime::Engine,
source: &LockedComponentSource,
component: &AppComponent,
) -> anyhow::Result<spin_core::Component>;

/// Called with a [`LockedComponentSource`] pointing to a Wasm module
Expand Down Expand Up @@ -282,7 +283,8 @@ impl App<'static, InertLoader> {
pub struct AppComponent<'a, L = AppLoader> {
/// The app this component belongs to.
pub app: &'a App<'a, L>,
locked: &'a LockedComponent,
/// The locked component.
pub locked: &'a LockedComponent,
}

impl<'a, L> AppComponent<'a, L> {
Expand Down Expand Up @@ -337,7 +339,7 @@ impl<'a> AppComponent<'a> {
self.app
.loader
.inner
.load_component(engine.as_ref(), &self.locked.source)
.load_component(engine.as_ref(), self)
.await
.map_err(Error::LoaderError)
}
Expand Down
6 changes: 5 additions & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ edition = { workspace = true }

[dependencies]
anyhow = "1.0"
dirs = "4.0"
base64 = "0.22.1"
dirs = "5.0.1"
serde = "1.0.189"
sha2 = "0.10"
semver = { version = "1.0", features = ["serde"] }
tempfile = "3.5"
tokio = { version = "1", features = ["rt", "time"] }
url = "2"
wasm-pkg-common = "0.4.1"
Loading

0 comments on commit 3ee065c

Please sign in to comment.