pub struct SecretSnapshot { /* private fields */ }Expand description
What a host needs to give the engine its secrets.
A host builds a SecretProviderRegistry holding the backends this build
carries and installs it with PolicyEngine::set_secret_providers before
initialize(). SecretProviderFactory is what a host implements to add a
backend of its own, and SecretRef is the handle a consumer keeps so a
later refresh reaches it. A consumer that rebuilds something on rotation
reads SecretRef::snapshot, which pairs the value with the generation it
belongs to.
env and file are always registered by
SecretProviderRegistry::with_builtin_backends. Vault KV v2 is behind
the secrets-vault feature: the host constructs VaultSecretProviderFactory
with its HttpTransport and registers it (or calls registry_with_vault).
Nothing here spawns a Vault session ticker; token renewal is lazy on
the next read.
There is no handle here that reads every declared value. A host drives
refresh with PolicyEngine::refresh_secrets and watches for staleness with
PolicyEngine::secrets_last_success, neither of which yields secret
material.
One value together with the generation it was read at.
A consumer that has to act on rotation rather than just read the new bytes records the generation beside whatever it built from the value, and rebuilds when the generation moves. That pairing has to come from one load: a value and a generation read separately can straddle a refresh and pair the old bytes with the new generation, and the consumer then holds a resource built from a credential it believes it has already rebuilt against. Nothing moves the generation again until the value changes once more, so that resource is never rebuilt.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecretSnapshot
impl RefUnwindSafe for SecretSnapshot
impl Send for SecretSnapshot
impl Sync for SecretSnapshot
impl Unpin for SecretSnapshot
impl UnsafeUnpin for SecretSnapshot
impl UnwindSafe for SecretSnapshot
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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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