Skip to content

Commit 76e7c2d

Browse files
committed
Update codebase based on previous changes
Signed-off-by: Ryan Levick <[email protected]>
1 parent 662ffbf commit 76e7c2d

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

crates/factors-executor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ mod tests {
315315
let executor = Arc::new(FactorsExecutor::new(engine_builder, env.factors)?);
316316

317317
let factors_app = executor
318-
.load_app(app, Default::default(), &mut DummyComponentLoader)
318+
.load_app(app, Default::default(), &DummyComponentLoader)
319319
.await?;
320320

321321
let mut instance_builder = factors_app.prepare("empty")?;

crates/trigger-http/src/wasi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl HttpExecutor for WasiHttpExecutor {
5353
}));
5454

5555
let mut wasi_http = spin_factor_outbound_http::OutboundHttpFactor::get_wasi_http_impl(
56-
store.data_mut().factors_instance_state(),
56+
store.data_mut().factors_instance_state_mut(),
5757
)
5858
.context("missing OutboundHttpFactor")?;
5959

crates/trigger/src/cli.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ mod sqlite_statements;
44
mod stdio;
55
mod summary;
66

7-
use std::future::Future;
87
use std::path::PathBuf;
8+
use std::{future::Future, sync::Arc};
99

1010
use anyhow::{Context, Result};
1111
use clap::{Args, IntoApp, Parser};
@@ -345,7 +345,7 @@ impl<T: Trigger<B::Factors>, B: RuntimeFactorsBuilder> TriggerAppBuilder<T, B> {
345345
#[async_trait]
346346
impl ComponentLoader for SimpleComponentLoader {
347347
async fn load_component(
348-
&mut self,
348+
&self,
349349
engine: &spin_core::wasmtime::Engine,
350350
component: &spin_factors::AppComponent,
351351
) -> anyhow::Result<spin_core::Component> {
@@ -373,11 +373,12 @@ impl<T: Trigger<B::Factors>, B: RuntimeFactorsBuilder> TriggerAppBuilder<T, B> {
373373

374374
let mut executor = FactorsExecutor::new(core_engine_builder, factors)?;
375375
B::configure_app(&mut executor, &runtime_config, &common_options, &options)?;
376+
let executor = Arc::new(executor);
376377

377378
let configured_app = {
378379
let _sloth_guard = warn_if_wasm_build_slothful();
379380
executor
380-
.load_app(app, runtime_config.into(), SimpleComponentLoader)
381+
.load_app(app, runtime_config.into(), &SimpleComponentLoader)
381382
.await?
382383
};
383384

crates/trigger/src/cli/initial_kv_setter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DEFAULT_KEY_VALUE_STORE_LABEL: &str = "default";
2020
#[async_trait]
2121
impl<F: RuntimeFactors, U> ExecutorHooks<F, U> for InitialKvSetterHook {
2222
async fn configure_app(
23-
&mut self,
23+
&self,
2424
configured_app: &spin_factors::ConfiguredApp<F>,
2525
) -> anyhow::Result<()> {
2626
if self.kv_pairs.is_empty() {

crates/trigger/src/cli/sqlite_statements.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ impl SqlStatementExecutorHook {
3131
let get_database = |label| async move {
3232
sqlite
3333
.get_connection(label)
34+
.await
3435
.transpose()
3536
.with_context(|| format!("failed connect to database with label '{label}'"))
3637
};
@@ -70,7 +71,7 @@ where
7071
F: RuntimeFactors,
7172
{
7273
async fn configure_app(
73-
&mut self,
74+
&self,
7475
configured_app: &spin_factors::ConfiguredApp<F>,
7576
) -> anyhow::Result<()> {
7677
let Some(sqlite) = configured_app.app_state::<SqliteFactor>().ok() else {
@@ -175,8 +176,13 @@ mod tests {
175176
}
176177
}
177178

179+
#[async_trait]
178180
impl ConnectionCreator for MockCreator {
179-
fn create_connection(&self) -> Result<Box<dyn Connection + 'static>, v2::Error> {
181+
async fn create_connection(
182+
&self,
183+
label: &str,
184+
) -> Result<Box<dyn Connection + 'static>, v2::Error> {
185+
let _ = label;
180186
Ok(Box::new(MockConnection {
181187
tx: self.tx.clone(),
182188
}))

crates/trigger/src/cli/stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl StdioLoggingExecutorHooks {
9191
#[async_trait]
9292
impl<F: RuntimeFactors, U> ExecutorHooks<F, U> for StdioLoggingExecutorHooks {
9393
async fn configure_app(
94-
&mut self,
94+
&self,
9595
configured_app: &spin_factors::ConfiguredApp<F>,
9696
) -> anyhow::Result<()> {
9797
self.validate_follows(configured_app.app())?;

crates/trigger/src/cli/summary.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct KeyValueDefaultStoreSummaryHook;
1010
#[async_trait]
1111
impl<F: RuntimeFactors, U> ExecutorHooks<F, U> for KeyValueDefaultStoreSummaryHook {
1212
async fn configure_app(
13-
&mut self,
13+
&self,
1414
configured_app: &spin_factors::ConfiguredApp<F>,
1515
) -> anyhow::Result<()> {
1616
let Ok(kv_app_state) = configured_app.app_state::<KeyValueFactor>() else {
@@ -33,7 +33,7 @@ pub struct SqliteDefaultStoreSummaryHook;
3333
#[async_trait]
3434
impl<F: RuntimeFactors, U> ExecutorHooks<F, U> for SqliteDefaultStoreSummaryHook {
3535
async fn configure_app(
36-
&mut self,
36+
&self,
3737
configured_app: &spin_factors::ConfiguredApp<F>,
3838
) -> anyhow::Result<()> {
3939
let Ok(sqlite_app_state) = configured_app.app_state::<SqliteFactor>() else {
@@ -45,6 +45,7 @@ impl<F: RuntimeFactors, U> ExecutorHooks<F, U> for SqliteDefaultStoreSummaryHook
4545
}
4646
if let Some(default_database_summary) = sqlite_app_state
4747
.get_connection("default")
48+
.await
4849
.and_then(Result::ok)
4950
.and_then(|conn| conn.summary())
5051
{

0 commit comments

Comments
 (0)