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

Function prepare_runtime_layout

src/pglite/base.rs:1710–1754  ·  view source on GitHub ↗
(
    paths: &PglitePaths,
    policy: RuntimeLayoutPolicy,
)

Source from the content-addressed store, hash-verified

1708}
1709
1710fn prepare_runtime_layout(
1711 paths: &PglitePaths,
1712 policy: RuntimeLayoutPolicy,
1713) -> Result<(RuntimeLayout, bool)> {
1714 match resolve_runtime_layout_kind(paths, policy)? {
1715 RuntimeLayoutKind::FullLocal => {
1716 let unpacked_runtime = ensure_full_runtime(paths)?;
1717 let (module_path, _) = locate_runtime_module(paths).ok_or_else(|| {
1718 anyhow!(
1719 "runtime missing: could not locate module under {} after install",
1720 paths.pgroot.display()
1721 )
1722 })?;
1723 let module_root = module_path
1724 .parent()
1725 .and_then(Path::parent)
1726 .map(Path::to_path_buf)
1727 .unwrap_or_else(|| paths.runtime_root());
1728 Ok((
1729 RuntimeLayout {
1730 kind: RuntimeLayoutKind::FullLocal,
1731 #[cfg(feature = "extensions")]
1732 local_root: module_root.clone(),
1733 module_root,
1734 pgdata_template_root: None,
1735 },
1736 unpacked_runtime,
1737 ))
1738 }
1739 RuntimeLayoutKind::SharedRuntimeOverlay => {
1740 let cached_runtime = runtime_cache()?;
1741 prepare_shared_runtime_upper_root(&cached_runtime.runtime_root, paths)?;
1742 Ok((
1743 RuntimeLayout {
1744 kind: RuntimeLayoutKind::SharedRuntimeOverlay,
1745 #[cfg(feature = "extensions")]
1746 local_root: paths.runtime_root(),
1747 module_root: cached_runtime.runtime_root.clone(),
1748 pgdata_template_root: None,
1749 },
1750 false,
1751 ))
1752 }
1753 }
1754}
1755
1756fn resolve_runtime_layout_kind(
1757 paths: &PglitePaths,

Calls 6

ensure_full_runtimeFunction · 0.85
locate_runtime_moduleFunction · 0.85
runtime_cacheFunction · 0.85
runtime_rootMethod · 0.80

Tested by

no test coverage detected