pub struct PlacementCache { /* private fields */ }Expand description
A short-TTL cache over NamespaceStore::get_namespace’s placement field.
Cheap to clone (shares the inner store handle + map). A miss / expired entry
reads the durable store once and re-caches; a backend error degrades to
NamespacePlacement::Unplaced (the safe default = today’s any-worker
behaviour) rather than failing the dispatch, since placement is a soft
optimization and a row must still dispatch when the registry read hiccups.
Implementations§
Source§impl PlacementCache
impl PlacementCache
Sourcepub fn new(store: Arc<dyn NamespaceStore>, ttl: Duration) -> Self
pub fn new(store: Arc<dyn NamespaceStore>, ttl: Duration) -> Self
Build a cache over the durable namespace store with the given entry TTL.
Sourcepub async fn placement(&self, namespace: &str) -> NamespacePlacement
pub async fn placement(&self, namespace: &str) -> NamespacePlacement
Return the namespace’s placement, serving a fresh cache hit without a store read and refreshing on a miss / expiry.
A poisoned cache lock or a store-read failure falls back to
NamespacePlacement::Unplaced — the dispatch then behaves exactly as the
pre-Phase-2 any-worker path, so a registry hiccup never blocks a dispatch.
Trait Implementations§
Source§impl Clone for PlacementCache
impl Clone for PlacementCache
Source§fn clone(&self) -> PlacementCache
fn clone(&self) -> PlacementCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PlacementCache
impl !UnwindSafe for PlacementCache
impl Freeze for PlacementCache
impl Send for PlacementCache
impl Sync for PlacementCache
impl Unpin for PlacementCache
impl UnsafeUnpin for PlacementCache
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<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>
T in a tonic::Request