Construct an in-memory instance of `database` running `program`, initialize it, then immediately destroy it. This is used during an initial, fresh publish operation in order to check the `program`'s validity as a module, since some validity checks we'd like to do (e.g. typechecking RLS filters) require a fully instantiated database. This is not necessary during hotswap publishes, as the automigr
(&self, database: Database, program: Program)
| 356 | /// This is not necessary during hotswap publishes, |
| 357 | /// as the automigration planner and executor accomplish the same validity checks. |
| 358 | pub async fn check_module_validity(&self, database: Database, program: Program) -> anyhow::Result<Arc<ModuleInfo>> { |
| 359 | let (program, launched) = Host::try_init_in_memory_to_check( |
| 360 | &self.runtimes, |
| 361 | self.page_pool.clone(), |
| 362 | database, |
| 363 | program, |
| 364 | // This takes a db core to check validity, and we will later take |
| 365 | // another core to actually run the module. Due to the round-robin |
| 366 | // algorithm that JobCores uses, that will likely just be the same |
| 367 | // core - there's not a concern that we'll only end up using 1/2 |
| 368 | // of the actual cores. |
| 369 | self.db_cores.take(), |
| 370 | self.bsatn_rlb_pool.clone(), |
| 371 | ) |
| 372 | .await?; |
| 373 | |
| 374 | let call_result = launched.module_host.init_database(program).await?; |
| 375 | if let Some(call_result) = call_result { |
| 376 | Result::from(call_result)?; |
| 377 | } |
| 378 | |
| 379 | Ok(launched.module_host.info) |
| 380 | } |
| 381 | |
| 382 | /// Update the [`ModuleHost`] identified by `replica_id` to the given |
| 383 | /// program. |
no test coverage detected