Skip to content

Commit a5be415

Browse files
committed
factors: Make Factor::configure_app required
Signed-off-by: Lann Martin <[email protected]>
1 parent 413256a commit a5be415

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

crates/factor-wasi/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ impl Factor for WasiFactor {
7070
Ok(())
7171
}
7272

73+
fn configure_app<T: RuntimeFactors>(
74+
&self,
75+
_ctx: spin_factors::ConfigureAppContext<T, Self>,
76+
) -> anyhow::Result<Self::AppState> {
77+
Ok(())
78+
}
79+
7380
fn prepare<T: RuntimeFactors>(
7481
ctx: PrepareContext<Self>,
7582
_builders: &mut InstanceBuilders<T>,

crates/factor-wasi/src/preview1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ impl Factor for WasiPreview1Factor {
1515
ctx.link_module_bindings(wasmtime_wasi::preview1::add_to_linker_async)
1616
}
1717

18+
fn configure_app<T: RuntimeFactors>(
19+
&self,
20+
_ctx: spin_factors::ConfigureAppContext<T, Self>,
21+
) -> anyhow::Result<Self::AppState> {
22+
Ok(())
23+
}
24+
1825
fn prepare<T: RuntimeFactors>(
1926
_ctx: spin_factors::PrepareContext<Self>,
2027
_builders: &mut spin_factors::InstanceBuilders<T>,

crates/factors/src/factor.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
pub trait Factor: Any + Sized {
1111
type RuntimeConfig: FactorRuntimeConfig;
1212

13-
type AppState: Default;
13+
type AppState;
1414

1515
type InstanceBuilder: FactorInstanceBuilder;
1616

@@ -29,10 +29,7 @@ pub trait Factor: Any + Sized {
2929
fn configure_app<T: RuntimeFactors>(
3030
&self,
3131
ctx: ConfigureAppContext<T, Self>,
32-
) -> anyhow::Result<Self::AppState> {
33-
_ = ctx;
34-
Ok(Default::default())
35-
}
32+
) -> anyhow::Result<Self::AppState>;
3633

3734
fn prepare<T: RuntimeFactors>(
3835
ctx: PrepareContext<Self>,

0 commit comments

Comments
 (0)