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§
- Bootstrap
Error - Captures bootstrap-specific failures.
- Connection
Metadata - Provides ergonomic accessors for connection-oriented cluster metadata.
- Database
Name - A strongly-typed database name for use with lifecycle operations.
- PgEnv
Cfg - Captures
PostgreSQLsettings supplied via environment variables. - Privilege
Error - Captures privilege-management failures.
- Temporary
Database - RAII guard that drops a database when it goes out of scope.
- Test
Bootstrap Environment - Holds filesystem and time zone settings used by the bootstrap tests.
- Test
Bootstrap Settings - Structured settings returned from
bootstrap_for_tests. - Test
Cluster - Embedded
PostgreSQLinstance whose lifecycle follows Rust’s drop semantics. - Test
Cluster Connection - Accessor for connection helpers derived from a
TestCluster.
Enums§
- Bootstrap
Error Kind - Categorises bootstrap failures so callers can branch on structured errors.
- Error
- Top-level error exposed by the crate.
- Execution
Mode - Selects how
PostgreSQLlifecycle commands run when privileged execution is required. - Execution
Privileges - Represents the privileges the process is running with when bootstrapping
PostgreSQL. - PgEmbedded
Error - Top-level error exposed by the crate.
Functions§
- bootstrap_
for_ tests - Bootstraps
PostgreSQLfor 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
direxists, is owned byuser, and hasPostgreSQL-compatible 0700 permissions. - make_
dir_ accessible - Ensures
direxists, is owned byuser, and grants world-readable access. - nobody_
uid - Retrieves the UID of the
nobodyaccount, defaulting to 65534 when absent. - run
- Bootstraps an embedded
PostgreSQLinstance, branching between root and unprivileged flows.
Type Aliases§
- Privilege
Result - Result alias for privilege-management fallible operations.
- Result
- Result alias for operations that may return a
PgEmbeddedError.