Skip to content

Commit 3ce559f

Browse files
committed
Fix rebasing issues
Signed-off-by: Ryan Levick <[email protected]>
1 parent edac482 commit 3ce559f

File tree

15 files changed

+108
-240
lines changed

15 files changed

+108
-240
lines changed

Cargo.lock

Lines changed: 5 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ terminal = { path = "crates/terminal" }
7070
subprocess = "0.2.9"
7171
tempfile = "3.8.0"
7272
tokio = { version = "1.23", features = ["full"] }
73-
toml = "0.6"
73+
toml = "0.8"
7474
tracing = { workspace = true }
7575
url = "2.2.2"
7676
uuid = { version = "^1.0", features = ["v4"] }

crates/factors-derive/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ fn expand_factors(input: &DeriveInput) -> syn::Result<TokenStream> {
211211
)*
212212
}
213213

214+
#[allow(dead_code)]
214215
impl #builders_name {
215216
#(
216217
pub fn #factor_names(&mut self) -> &mut <#factor_types as #Factor>::InstanceBuilder {

crates/factors-executor/src/lib.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use spin_factors::{AsInstanceState, ConfiguredApp, RuntimeFactors, RuntimeFactor
77

88
/// A FactorsExecutor manages execution of a Spin app.
99
///
10-
/// `Factors` is the executor's [`RuntimeFactors`]. `ExecutorInstanceState`
10+
/// It is generic over the executor's [`RuntimeFactors`]. Additionally, it
1111
/// holds any other per-instance state needed by the caller.
1212
pub struct FactorsExecutor<T: RuntimeFactors, U = ()> {
1313
core_engine: spin_core::Engine<InstanceState<T::InstanceState, U>>,
@@ -110,6 +110,9 @@ type InstancePre<T, U> =
110110
spin_core::InstancePre<InstanceState<<T as RuntimeFactors>::InstanceState, U>>;
111111

112112
/// A FactorsExecutorApp represents a loaded Spin app, ready for instantiation.
113+
///
114+
/// It is generic over the executor's [`RuntimeFactors`] and any ad-hoc additional
115+
/// per-instance state needed by the caller.
113116
pub struct FactorsExecutorApp<T: RuntimeFactors, U> {
114117
executor: FactorsExecutor<T, U>,
115118
configured_app: ConfiguredApp<T>,
@@ -173,14 +176,16 @@ impl<T: RuntimeFactors, U: Send + 'static> FactorsExecutorApp<T, U> {
173176
}
174177
}
175178

176-
/// A FactorsInstanceBuilder manages the instantiation of a Spin component
177-
/// instance.
178-
pub struct FactorsInstanceBuilder<'a, T: RuntimeFactors, U> {
179+
/// A FactorsInstanceBuilder manages the instantiation of a Spin component instance.
180+
///
181+
/// It is generic over the executor's [`RuntimeFactors`] and any ad-hoc additional
182+
/// per-instance state needed by the caller.
183+
pub struct FactorsInstanceBuilder<'a, F: RuntimeFactors, U> {
179184
app_component: AppComponent<'a>,
180185
store_builder: spin_core::StoreBuilder,
181-
factor_builders: T::InstanceBuilders,
182-
instance_pre: &'a InstancePre<T, U>,
183-
factors: &'a T,
186+
factor_builders: F::InstanceBuilders,
187+
instance_pre: &'a InstancePre<F, U>,
188+
factors: &'a F,
184189
}
185190

186191
impl<'a, T: RuntimeFactors, U> FactorsInstanceBuilder<'a, T, U> {
@@ -221,6 +226,9 @@ impl<'a, T: RuntimeFactors, U: Send> FactorsInstanceBuilder<'a, T, U> {
221226
}
222227

223228
/// InstanceState is the [`spin_core::Store`] `data` for an instance.
229+
///
230+
/// It is generic over the [`RuntimeFactors::InstanceState`] and any ad-hoc
231+
/// data needed by the caller.
224232
pub struct InstanceState<T, U> {
225233
core: spin_core::State,
226234
factors: T,

crates/factors/src/runtime_factors.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ pub trait RuntimeFactors: Send + Sync + Sized + 'static {
8181
) -> Option<Option<&mut F::InstanceBuilder>>;
8282
}
8383

84+
/// Allows querying an `InstanceBuilders` for a particular `Factor`'s `InstanceBuilder`.
8485
pub trait HasInstanceBuilder {
86+
/// Get the instance builder of a particular factor.
8587
fn for_factor<F: Factor>(&mut self) -> Option<&mut F::InstanceBuilder>;
8688
}
8789

crates/runtime-config/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ where
118118
sqlite_resolver: sqlite_config_resolver,
119119
state_dir: toml_resolver.state_dir()?,
120120
log_dir: toml_resolver.log_dir()?,
121-
toml,
121+
toml: toml_resolver.toml(),
122122
})
123123
}
124124

@@ -262,6 +262,10 @@ impl<'a> TomlResolver<'a> {
262262
pub fn validate_all_keys_used(&self) -> spin_factors::Result<()> {
263263
self.table.validate_all_keys_used()
264264
}
265+
266+
fn toml(&self) -> toml::Table {
267+
self.table.as_ref().clone()
268+
}
265269
}
266270

267271
/// The TOML based runtime configuration source Spin CLI.

crates/trigger-http/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ pub use tls::TlsConfig;
3030

3131
pub(crate) use wasmtime_wasi_http::body::HyperIncomingBody as Body;
3232

33+
/// A [`spin_trigger::TriggerApp`] for the HTTP trigger.
3334
pub(crate) type TriggerApp<F> = spin_trigger::TriggerApp<HttpTrigger, F>;
35+
36+
/// A [`spin_trigger::TriggerInstanceBuilder`] for the HTTP trigger.
3437
pub(crate) type TriggerInstanceBuilder<'a, F> =
3538
spin_trigger::TriggerInstanceBuilder<'a, HttpTrigger, F>;
3639

crates/trigger-http/src/wagi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl HttpExecutor for WagiHttpExecutor {
7979
.factor_builders()
8080
.for_factor::<WasiFactor>()
8181
{
82-
// // Set up Wagi environment
82+
// Set up Wagi environment
8383
wasi_builder.args(argv.split(' '));
8484
wasi_builder.env(headers);
8585
wasi_builder.stdin_pipe(Cursor::new(body));

crates/trigger/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ spin-factor-sqlite = { path = "../factor-sqlite" }
2626
spin-factor-wasi = { path = "../factor-wasi" }
2727
spin-factors = { path = "../factors" }
2828
spin-factors-executor = { path = "../factors-executor" }
29-
spin-runtime-config = { path = "../runtime-config" }
3029
spin-telemetry = { path = "../telemetry" }
3130
tokio = { version = "1.23", features = ["fs", "rt"] }
3231
toml = "0.8"

crates/trigger/src/cli.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub use launch_metadata::LaunchMetadata;
2323
pub use sqlite_statements::SqlStatementExecutorHook;
2424
use stdio::FollowComponents;
2525
pub use stdio::StdioLoggingExecutorHooks;
26-
pub use summary::KeyValueDefaultStoreSummaryHook;
26+
pub use summary::{KeyValueDefaultStoreSummaryHook, SqliteDefaultStoreSummaryHook};
2727

2828
pub const APP_LOG_DIR: &str = "APP_LOG_DIR";
2929
pub const DISABLE_WASMTIME_CACHE: &str = "DISABLE_WASMTIME_CACHE";
@@ -398,8 +398,11 @@ impl<T: Trigger<B::Factors>, B: RuntimeFactorsBuilder> TriggerAppBuilder<T, B> {
398398

399399
/// A builder for runtime factors.
400400
pub trait RuntimeFactorsBuilder {
401-
type Options: clap::Args;
401+
/// The factors type to build.
402402
type Factors: RuntimeFactors;
403+
/// CLI arguments not included in [`CommonTriggerOptions`] needed to build the [`RuntimeFactors`].
404+
type Options: clap::Args;
405+
/// The wrapped runtime config type.
403406
type RuntimeConfig: Into<<Self::Factors as RuntimeFactors>::RuntimeConfig>;
404407

405408
/// Build the factors and runtime config from the given options.

0 commit comments

Comments
 (0)