pub struct BackendId {
pub backend_id: Rc<str>,
pub address: SocketAddr,
/* private fields */
}Expand description
A backend as the core sees it: the opaque slot, plus the two identity fields the datapath renders.
backend_id and address are copied once, when the session first interns
the backend in its BackendRegistry, and every later dial of it clones
them from there. Both are immutable for the life of a registry entry, so
carrying them is not a cached view of mutable state — no load state
crosses this boundary.
The mutable half (active_connections, active_requests, failures,
connection_time, health, status) stays behind the slot, and the core
reaches it only by emitting a BackendDelta.
backend_id is an Rc<str> so that no step past interning copies it:
rebuilding Position::Client on Connecting -> Connected once per dial,
minting the id for a redial (the registry keeps the Rc<str> it built at
interning, #1564), and stamping a request with the backend it runs on,
dialled or reused, into HttpContext::backend_id and
SessionMetrics::backend_id (#1579) are each a reference-count increment.
A String would make every one of them a heap copy.
Fields§
§backend_id: Rc<str>Backend::backend_id, for log lines and per-backend metric labels.
address: SocketAddrBackend::address, for log lines and push_event payloads.
Implementations§
Source§impl BackendId
impl BackendId
Sourcepub fn new(slot: usize, backend_id: Rc<str>, address: SocketAddr) -> Self
pub fn new(slot: usize, backend_id: Rc<str>, address: SocketAddr) -> Self
An id for the backend at address, named backend_id, in slot of
whichever registry mints it (#1684).
The worker’s mux never calls this: its ids come from the session’s
BackendRegistry, which interns the backend it names and is the only
thing that can resolve a slot back to it. This is for an embedder that
owns its own selector — a simulator implementing
router::BackendSelector — and numbers its backends itself. A slot
means something only to the registry that issued it.
Trait Implementations§
impl Eq for BackendId
impl StructuralPartialEq for BackendId
Auto Trait Implementations§
impl !Send for BackendId
impl !Sync for BackendId
impl Freeze for BackendId
impl RefUnwindSafe for BackendId
impl Unpin for BackendId
impl UnsafeUnpin for BackendId
impl UnwindSafe for BackendId
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.