Crate pg_embedded_setup_unpriv

Crate pg_embedded_setup_unpriv 

Source
Expand description

Facilitates preparing an embedded PostgreSQL instance while dropping root privileges.

The library owns the lifecycle for configuring paths, permissions, and process identity so the bundled PostgreSQL binaries can initialise safely under an unprivileged account.

Structs§

BootstrapError
Captures bootstrap-specific failures.
ConnectionMetadata
Provides ergonomic accessors for connection-oriented cluster metadata.
DatabaseName
A strongly-typed database name for use with lifecycle operations.
PgEnvCfg
Captures PostgreSQL settings supplied via environment variables.
PrivilegeError
Captures privilege-management failures.
TemporaryDatabase
RAII guard that drops a database when it goes out of scope.
TestBootstrapEnvironment
Holds filesystem and time zone settings used by the bootstrap tests.
TestBootstrapSettings
Structured settings returned from bootstrap_for_tests.
TestCluster
Embedded PostgreSQL instance whose lifecycle follows Rust’s drop semantics.
TestClusterConnection
Accessor for connection helpers derived from a TestCluster.

Enums§

BootstrapErrorKind
Categorises bootstrap failures so callers can branch on structured errors.
Error
Top-level error exposed by the crate.
ExecutionMode
Selects how PostgreSQL lifecycle commands run when privileged execution is required.
ExecutionPrivileges
Represents the privileges the process is running with when bootstrapping PostgreSQL.
PgEmbeddedError
Top-level error exposed by the crate.

Functions§

bootstrap_for_tests
Bootstraps PostgreSQL for integration tests and surfaces the prepared settings.
default_paths_for
Computes default installation and data directories for a given uid.
detect_execution_privileges
Detects whether the process is running with root privileges.
find_timezone_dir
Probes common Unix paths for the time zone database directory.
make_data_dir_private
Ensures dir exists, is owned by user, and has PostgreSQL-compatible 0700 permissions.
make_dir_accessible
Ensures dir exists, is owned by user, and grants world-readable access.
nobody_uid
Retrieves the UID of the nobody account, defaulting to 65534 when absent.
run
Bootstraps an embedded PostgreSQL instance, branching between root and unprivileged flows.

Type Aliases§

PrivilegeResult
Result alias for privilege-management fallible operations.
Result
Result alias for operations that may return a PgEmbeddedError.