MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / launch_module

Method launch_module

crates/core/src/host/host_controller.rs:766–808  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

764
765impl<F: Fn() + Send + Sync + 'static> ModuleLauncher<F> {
766 async fn launch_module(self) -> anyhow::Result<(Program, LaunchedModule)> {
767 let db_identity = self.database.database_identity;
768 info!(
769 "launching module db={} replica={} program={} host_type={}",
770 db_identity,
771 self.replica_id,
772 self.program.hash,
773 HostType::from(self.program.kind)
774 );
775
776 let replica_ctx = make_replica_ctx(
777 self.module_logs,
778 self.database,
779 self.replica_id,
780 self.relational_db,
781 self.bsatn_rlb_pool,
782 )
783 .await
784 .map(Arc::new)?;
785 let (scheduler, scheduler_starter) = Scheduler::open(replica_ctx.relational_db().clone());
786 let (program, module_host) = make_module_host(
787 self.runtimes.clone(),
788 replica_ctx.clone(),
789 scheduler.clone(),
790 self.program,
791 self.energy_monitor,
792 self.on_panic,
793 self.core,
794 )
795 .await?;
796
797 trace!("launched database {} with program {}", db_identity, program.hash);
798
799 Ok((
800 program,
801 LaunchedModule {
802 replica_ctx,
803 module_host,
804 scheduler,
805 scheduler_starter,
806 },
807 ))
808 }
809}
810
811fn repair_stale_view_backing_tables_on_launch(launched: &LaunchedModule) -> anyhow::Result<()> {

Callers 2

try_initMethod · 0.80

Calls 7

make_replica_ctxFunction · 0.85
make_module_hostFunction · 0.85
openFunction · 0.50
OkFunction · 0.50
mapMethod · 0.45
cloneMethod · 0.45
relational_dbMethod · 0.45

Tested by

no test coverage detected