pub struct RdsConfig {
pub url_file: Option<PathBuf>,
pub root_cert_file: Option<PathBuf>,
pub cell_id: String,
}Expand description
Records/repository RDS (Multi-AZ Postgres) configuration.
The effective binding is resolved by RdsConfig::resolved_from_env:
explicit TOML values win; otherwise the records role’s scoped environment
variables carry the paths (HYPRSTREAM_RECORDS_URL_FILE,
HYPRSTREAM_RECORDS_SSLROOTCERT_FILE — metal RDS runtime contract v1.1);
as a last resort the shared credentials directory is consulted
($HYPRSTREAM_POSTGRES_CREDENTIALS_PATH/records-url and rds-ca.pem),
but only when the records-url file actually exists there, so a
credentials-role-only deployment never silently activates the records
backend. An env var carries only the path to a secret file — the
password-bearing URL itself never transits the process environment.
The URL file contains one newline-terminated libpq URL. It is file-backed so rotation/repointing is a deployment-side file swap, not a secret-bearing config or environment value.
cell_id stamps the cell (single-writer consistency domain) this node
belongs to — the honorable-mention guard from the arch verdict so no code
path assumes it is the only cell in the universe. For the demo leaf this is
the one provider/region cell; it becomes the placement key at Stage 2.
Fields§
§url_file: Option<PathBuf>Path to the records role’s Postgres URL file. When None (and no
env binding resolves), the local backend (RocksDB) is used; deployed
records services resolve this to the records role’s URL file.
root_cert_file: Option<PathBuf>Path to the records role’s PEM CA file. Mandatory whenever
url_file is configured; the connector pins this trust store for the
RDS connection.
cell_id: StringCell identifier (consistency-domain label). Stamped into the schema; the demo leaf has exactly one cell. Honorable-mention guard from the recursive-federation arch verdict.
Implementations§
Source§impl RdsConfig
impl RdsConfig
Sourcepub const RECORDS_URL_FILE_ENV: &'static str = "HYPRSTREAM_RECORDS_URL_FILE"
pub const RECORDS_URL_FILE_ENV: &'static str = "HYPRSTREAM_RECORDS_URL_FILE"
Records-role env var carrying the PATH to the Postgres URL file (metal RDS runtime contract v1.1). Never the URL itself.
Sourcepub const RECORDS_SSLROOTCERT_FILE_ENV: &'static str = "HYPRSTREAM_RECORDS_SSLROOTCERT_FILE"
pub const RECORDS_SSLROOTCERT_FILE_ENV: &'static str = "HYPRSTREAM_RECORDS_SSLROOTCERT_FILE"
Records-role env var carrying the PATH to the pinned RDS CA PEM.
Sourcepub const POSTGRES_CREDENTIALS_PATH_ENV: &'static str = "HYPRSTREAM_POSTGRES_CREDENTIALS_PATH"
pub const POSTGRES_CREDENTIALS_PATH_ENV: &'static str = "HYPRSTREAM_POSTGRES_CREDENTIALS_PATH"
Shared Postgres credentials directory env var (metal renders the
per-role URL files and rds-ca.pem under it).
Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
True when a Postgres URL is configured (the deployed posture).
Sourcepub fn resolved_from_env(&self) -> Result<Self>
pub fn resolved_from_env(&self) -> Result<Self>
Resolve the effective records-role binding. Explicit TOML values win;
otherwise the records role’s scoped env vars; otherwise the shared
credentials directory — consulted only when records-url actually
exists there, so a credentials-role-only deployment does not activate
the records backend. The cell_id is preserved as configured.
Fails closed when the directory fallback’s records-url candidate is
rendered-but-broken: a stat failure other than NotFound (e.g. an
unreadable parent) is itself an error, and a dangling symlink still
binds so the later URL read fails loudly. Only a genuinely absent
candidate leaves the local backend selected — a broken binding must
never silently become “not rendered”.
Sourcepub fn root_cert_file(&self) -> Option<&Path>
pub fn root_cert_file(&self) -> Option<&Path>
Return the explicit records CA-file path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RdsConfig
impl<'de> Deserialize<'de> for RdsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RdsConfig
impl RefUnwindSafe for RdsConfig
impl Send for RdsConfig
impl Sync for RdsConfig
impl Unpin for RdsConfig
impl UnsafeUnpin for RdsConfig
impl UnwindSafe for RdsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more