MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / verify_pgdata_template_hash

Function verify_pgdata_template_hash

xtask/src/main.rs:5689–5707  ·  view source on GitHub ↗
(pgdata_archive: &Path)

Source from the content-addressed store, hash-verified

5687}
5688
5689fn verify_pgdata_template_hash(pgdata_archive: &Path) -> Result<()> {
5690 let manifest_path = Path::new(GENERATED_ASSETS_DIR).join("prepopulated/pgdata-template.json");
5691 ensure!(
5692 manifest_path.exists() && pgdata_archive.exists(),
5693 "generated assets must include the bundled PGDATA template required by the default runtime; expected both {} and {}",
5694 manifest_path.display(),
5695 pgdata_archive.display()
5696 );
5697 let text = fs::read_to_string(&manifest_path)
5698 .with_context(|| format!("read {}", manifest_path.display()))?;
5699 let manifest: serde_json::Value = serde_json::from_str(&text)
5700 .with_context(|| format!("parse {}", manifest_path.display()))?;
5701 let expected = manifest
5702 .get("archiveSha256")
5703 .and_then(serde_json::Value::as_str)
5704 .ok_or_else(|| anyhow!("{} is missing archiveSha256", manifest_path.display()))?;
5705 verify_file_sha256(pgdata_archive, expected, "PGDATA template archive")?;
5706 Ok(())
5707}
5708
5709fn verify_root_asset_metadata(
5710 manifest: &AssetManifestOut,

Callers 1

Calls 2

verify_file_sha256Function · 0.85
joinMethod · 0.45

Tested by

no test coverage detected