11mod launch_metadata;
2+ mod sqlite_statements;
23mod summary;
34
45use std:: future:: Future ;
@@ -13,6 +14,7 @@ use spin_common::{arg_parser::parse_kv, sloth};
1314use spin_core:: async_trait;
1415use spin_factors_executor:: { ComponentLoader , FactorsExecutor } ;
1516use spin_runtime_config:: { ResolvedRuntimeConfig , UserProvidedPath } ;
17+ use sqlite_statements:: SqlStatementExecutorHook ;
1618use summary:: KeyValueDefaultStoreSummaryHook ;
1719
1820use crate :: factors:: { TriggerFactors , TriggerFactorsRuntimeConfig } ;
@@ -198,6 +200,7 @@ impl<T: Trigger> FactorsTriggerCommand<T> {
198200 state_dir : self . state_dir . as_deref ( ) ,
199201 local_app_dir : local_app_dir. as_deref ( ) ,
200202 initial_key_values : self . key_values ,
203+ sqlite_statements : self . sqlite_statements ,
201204 allow_transient_write : self . allow_transient_write ,
202205 follow_components,
203206 log_dir : self . log ,
@@ -277,6 +280,8 @@ pub struct TriggerAppOptions<'a> {
277280 local_app_dir : Option < & ' a str > ,
278281 /// Initial key/value pairs to set in the app's default store.
279282 initial_key_values : Vec < ( String , String ) > ,
283+ /// SQLite statements to run.
284+ sqlite_statements : Vec < String > ,
280285 /// Whether to allow transient writes to mounted files
281286 allow_transient_write : bool ,
282287 /// Which components should have their logs followed.
@@ -351,8 +356,6 @@ impl<T: Trigger> TriggerAppBuilder<T> {
351356 )
352357 . context ( "failed to create factors" ) ?;
353358
354- // TODO(factors): handle: self.sqlite_statements
355-
356359 // TODO: port the rest of the component loader logic
357360 struct SimpleComponentLoader ;
358361
@@ -421,6 +424,7 @@ impl<T: Trigger> TriggerAppBuilder<T> {
421424 // TODO:
422425 // builder.hooks(SummariseRuntimeConfigHook::new(&self.runtime_config_file));
423426 executor. add_hooks ( KeyValueDefaultStoreSummaryHook ) ;
427+ executor. add_hooks ( SqlStatementExecutorHook :: new ( options. sqlite_statements ) ) ;
424428 // builder.hooks(SqlitePersistenceMessageHook);
425429
426430 let configured_app = {
0 commit comments