(
paths: &PglitePaths,
policy: RuntimeLayoutPolicy,
)
| 1708 | } |
| 1709 | |
| 1710 | fn 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 | |
| 1756 | fn resolve_runtime_layout_kind( |
| 1757 | paths: &PglitePaths, |
no test coverage detected