pub struct ResourceKey {
pub adapter: String,
pub fields: BTreeMap<String, String>,
}Expand description
Structural value identity for a shared resource.
Two adapters that build equal ResourceKeys receive the
same instance under Shared policy. The internal
BTreeMap is sorted so equality is deterministic, and
Hash is derived structurally for HashMap lookup. The
pool never asks adapters to produce a “key digest”; the
contract is value equality on the public type.
Adapters populate fields with only the params that
distinguish one instance from another. Per-statement and
per-phase shaping (timeouts, trace rates, dynamic
controls) MUST NOT appear in the key — see SRD-35
§“Instance-shaping vs shell-shaping params”.
Fields§
§adapter: StringAdapter name ("cql", "http", …) — the
adapter-name surface, not the engine-specific driver
identifier (which the adapter folds into the fields
when meaningful).
fields: BTreeMap<String, String>Identity-bearing param values, sorted so equality is independent of insertion order.
Implementations§
Source§impl ResourceKey
impl ResourceKey
Sourcepub fn new(adapter: impl Into<String>) -> Self
pub fn new(adapter: impl Into<String>) -> Self
Construct a key for the given adapter with no fields
yet. Chain Self::with to populate.
Sourcepub fn with(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set or replace the value for one identity-bearing
field, returning self for chaining.
Sourcepub fn fmt_for_log(&self) -> String
pub fn fmt_for_log(&self) -> String
Render the key for a single line of log output
(adapter{k1=v1,k2=v2}). Stable shape — the
lifecycle-event surface relies on this format being
consistent across log consumers.
Sourcepub fn render_key(&self) -> String
pub fn render_key(&self) -> String
SRD-104 — the canonical fingerprint rendering of this key to a
stable string, used as the accessor lookup key
(polydat::ResourceAccessor::lookup). Unlike Self::fmt_for_log
this rendering is identity-preserving: two keys that differ
only in an identity-bearing field (e.g. password) MUST render to
different strings or they would collide in the accessor. A secret
field (password, _secret_*) contributes a SHA-256 digest of its
value rather than the value itself, so the fingerprint keeps its
identity without ever carrying the cleartext into a kernel binding
or a diagnostic. The BTreeMap makes the field order
deterministic, so equal keys always render identically.
This is the single rendering shared by both sides of the SRD-104
bridge: the resource pool renders each live entry’s key with it when
resolving a lookup, and a consumer node builds the same string from
the fingerprint in scope. Shape: adapter{k1=v1,k2=v2}.
Trait Implementations§
Source§impl Clone for ResourceKey
impl Clone for ResourceKey
Source§impl Debug for ResourceKey
impl Debug for ResourceKey
Source§impl Default for ResourceKey
impl Default for ResourceKey
impl Eq for ResourceKey
Source§impl Hash for ResourceKey
impl Hash for ResourceKey
Source§impl PartialEq for ResourceKey
impl PartialEq for ResourceKey
impl StructuralPartialEq for ResourceKey
Auto Trait Implementations§
impl Freeze for ResourceKey
impl RefUnwindSafe for ResourceKey
impl Send for ResourceKey
impl Sync for ResourceKey
impl Unpin for ResourceKey
impl UnsafeUnpin for ResourceKey
impl UnwindSafe for ResourceKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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