pub struct SharedResourceRegistry { /* private fields */ }Expand description
Thread-safe registry for resource types.
This is a concurrent version of ResourceRegistry that can be safely
shared across threads without external synchronization.
Uses DashMap internally for lock-free reads and efficient concurrent writes.
§Example
use xds_core::{SharedResourceRegistry, TypeUrl};
use std::sync::Arc;
let registry = Arc::new(SharedResourceRegistry::with_envoy_types());
// Can be shared across threads safely
assert!(registry.contains(TypeUrl::CLUSTER));
assert!(registry.contains(TypeUrl::LISTENER));Implementations§
Sourcepub fn with_envoy_types() -> Self
pub fn with_envoy_types() -> Self
Create a thread-safe registry pre-populated with standard Envoy types.
Sourcepub fn register(&self, info: ResourceTypeInfo)
pub fn register(&self, info: ResourceTypeInfo)
Register a new resource type.
This is safe to call from multiple threads concurrently.
Sourcepub fn get(&self, type_url: &str) -> Option<ResourceTypeInfo>
pub fn get(&self, type_url: &str) -> Option<ResourceTypeInfo>
Get information about a resource type by type URL.
Returns None if the type is not registered.
Trait Implementations§
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request