(
sources: &SourcesManifest,
runtime_module: &Path,
initdb_module: &Path,
archive: &Path,
manifest: &Path,
)
| 9191 | } |
| 9192 | |
| 9193 | fn pgdata_template_asset_out( |
| 9194 | sources: &SourcesManifest, |
| 9195 | runtime_module: &Path, |
| 9196 | initdb_module: &Path, |
| 9197 | archive: &Path, |
| 9198 | manifest: &Path, |
| 9199 | ) -> Result<PgDataTemplateAssetOut> { |
| 9200 | ensure_file(archive)?; |
| 9201 | ensure_file(manifest)?; |
| 9202 | let manifest_text = |
| 9203 | fs::read_to_string(manifest).with_context(|| format!("read {}", manifest.display()))?; |
| 9204 | let manifest_json: serde_json::Value = serde_json::from_str(&manifest_text) |
| 9205 | .with_context(|| format!("parse {}", manifest.display()))?; |
| 9206 | Ok(PgDataTemplateAssetOut { |
| 9207 | archive: "prepopulated/pgdata-template.tar.zst".to_owned(), |
| 9208 | manifest: "prepopulated/pgdata-template.json".to_owned(), |
| 9209 | sha256: sha256_file(archive)?, |
| 9210 | size: fs::metadata(archive) |
| 9211 | .with_context(|| format!("metadata {}", archive.display()))? |
| 9212 | .len(), |
| 9213 | runtime_module_sha256: sha256_file(runtime_module)?, |
| 9214 | initdb_module_sha256: sha256_file(initdb_module)?, |
| 9215 | source_pins_sha256: source_pins_sha256(sources)?, |
| 9216 | postgres_version: "17".to_owned(), |
| 9217 | catalog_version: manifest_json |
| 9218 | .get("catalogVersion") |
| 9219 | .and_then(serde_json::Value::as_str) |
| 9220 | .unwrap_or("unknown") |
| 9221 | .to_owned(), |
| 9222 | init_profile: default_initdb_profile().to_owned(), |
| 9223 | wasmer_version: sources.toolchain.wasmer.clone(), |
| 9224 | }) |
| 9225 | } |
| 9226 | |
| 9227 | fn source_pins_sha256(sources: &SourcesManifest) -> Result<String> { |
| 9228 | let pins = serde_json::to_vec(&sources.sources).context("serialize source pins")?; |
no test coverage detected