pub struct WriteAudience(/* private fields */);Expand description
The authenticated write audience a request ingests under. Always a real audience – a credential that carries none resolves to the deployment default at the HTTP edge rather than staying a distinct, unstamped third state.
Per rust/CLAUDE.md’s Rust-API stance, every process-insert call site must state its
audience explicitly – there is no Default impl, so a call site with nothing of its own to
pass must pass the resolved deployment default, and the compiler enumerates every site that
needs updating when this type’s callers change.
Implementations§
Source§impl WriteAudience
impl WriteAudience
Sourcepub fn new(audience: &str) -> Result<WriteAudience, Error>
pub fn new(audience: &str) -> Result<WriteAudience, Error>
Builds a WriteAudience from an audience label.
Rejects a malformed label: ingestion_api_keys.audience is already CHECK-constrained
to [A-Za-z0-9_-]{1,255}, so this is defence in depth against a future producer of
bound_audience that doesn’t go through that column. The HTTP-edge caller
(micromegas::servers::write_audience::resolve_write_audience) does not treat this
Err as a rejection – it warns and degrades to the deployment default instead, since
that caller has no Result to propagate the failure through. This is also the validating
constructor for the deployment default itself, called once at startup. The charset check
duplicates micromegas_auth::policy::is_valid_audience (policy.rs) rather than
depending on micromegas-auth from micromegas-ingestion – the same crate-boundary
trade-off read_scope.rs’s is_well_formed_audience already makes for
micromegas-analytics. Keep the three copies in step if the charset ever changes.
Sourcepub fn id_namespace<'a>(&'a self, default: &WriteAudience) -> Option<&'a str>
pub fn id_namespace<'a>(&'a self, default: &WriteAudience) -> Option<&'a str>
The OTLP id-derivation namespace self occupies, relative to default. default is the
deployment’s resolved default audience: it keeps the un-salted NS_OTEL_PROCESS_V1
namespace, so a resolved-to-default caller and one explicitly bound to a label equal to
the default derive the same ids. Every other audience gets its own salted namespace.
Returns None (the un-salted default namespace) when self == default, Some(self)
(a per-audience salted namespace) otherwise. Named and pulled out here, rather than
inlined at each of the five IdentityContext construction sites, so the rule has exactly
one home.
Trait Implementations§
Source§impl Clone for WriteAudience
impl Clone for WriteAudience
Source§fn clone(&self) -> WriteAudience
fn clone(&self) -> WriteAudience
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WriteAudience
impl Debug for WriteAudience
impl Eq for WriteAudience
Source§impl PartialEq for WriteAudience
impl PartialEq for WriteAudience
impl StructuralPartialEq for WriteAudience
Auto Trait Implementations§
impl Freeze for WriteAudience
impl RefUnwindSafe for WriteAudience
impl Send for WriteAudience
impl Sync for WriteAudience
impl Unpin for WriteAudience
impl UnsafeUnpin for WriteAudience
impl UnwindSafe for WriteAudience
Blanket Implementations§
impl<T> Allocation for T
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].