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

Function split_initdb_root_filesystem

src/pglite/postgres_mod.rs:2345–2370  ·  view source on GitHub ↗
(
    paths: &PglitePaths,
    runtime_layout: &RuntimeLayout,
)

Source from the content-addressed store, hash-verified

2343}
2344
2345fn split_initdb_root_filesystem(
2346 paths: &PglitePaths,
2347 runtime_layout: &RuntimeLayout,
2348) -> Result<Arc<dyn virtual_fs::FileSystem + Send + Sync>> {
2349 let root: Arc<dyn virtual_fs::FileSystem + Send + Sync> =
2350 if runtime_layout.uses_shared_overlay() {
2351 let upper = virtual_fs::ArcFileSystem::new(maybe_trace_filesystem(host_filesystem(
2352 &paths.runtime_root(),
2353 )?));
2354 let lower = virtual_fs::ArcFileSystem::new(maybe_trace_filesystem(host_filesystem(
2355 &runtime_layout.module_root,
2356 )?));
2357 Arc::new(virtual_fs::OverlayFileSystem::new(upper, [lower]))
2358 } else {
2359 maybe_trace_filesystem(host_filesystem(&paths.runtime_root())?)
2360 };
2361
2362 let pgdata = maybe_trace_filesystem(host_filesystem(&paths.pgdata)?);
2363 // initdb execs a child postgres command during bootstrap. Keep PGDATA inside
2364 // the root filesystem view so both commands inherit the same /base mount.
2365 let root = wasi_root_with_pgdata_mount(root, pgdata)?;
2366 // Wasmer's runner normally starts from a temporary root that provides WASIX
2367 // device files. Keep the real runtime/PGDATA root mounted for database
2368 // writes, but route device paths such as /dev/urandom to virtual devices.
2369 Ok(wasi_root_with_devices(root)?)
2370}
2371
2372fn run_package_command_with_root(
2373 runner: &WasiRunner,

Callers 1

run_split_initdbFunction · 0.85

Calls 6

maybe_trace_filesystemFunction · 0.85
host_filesystemFunction · 0.85
wasi_root_with_devicesFunction · 0.85
uses_shared_overlayMethod · 0.80
runtime_rootMethod · 0.80

Tested by

no test coverage detected