pub struct DevProxyRegistry {
routes: Arc<RwLock<HashMap<String, Route>>>,
}Expand description
"<project>-<agent_id>" → the container’s internal ip:port its dev
server is actually listening on. Cleared per-agent when that agent’s
container stops (ContainerManager::stop/remove in container.rs
call unregister_agent — see that module’s cleanup_dev_proxy_routes).
Cheap to clone (one Arc inside) — held directly by AppState and
passed to the proxy’s own axum router as state.
Fields§
§routes: Arc<RwLock<HashMap<String, Route>>>Implementations§
Source§impl DevProxyRegistry
impl DevProxyRegistry
pub fn new() -> Self
Sourcepub fn routing_key(project: &str, agent_id: &str) -> String
pub fn routing_key(project: &str, agent_id: &str) -> String
The exact routing key both register and the Host-header lookup
use — kept as one function so the two can never drift apart.
Lowercased: hostnames are case-insensitive, and a browser may send
whatever case the URL bar has, so registration and lookup must
agree regardless of how either side capitalized project/agent_id.
pub async fn register(&self, project: &str, agent_id: &str, addr: SocketAddr)
Sourcepub async fn unregister_agent(&self, agent_id: &str)
pub async fn unregister_agent(&self, agent_id: &str)
Removes every registration belonging to agent_id, regardless of
project name — called when that agent’s container stops so a dead
container never keeps serving (stale) proxy traffic.
Matches on the stored agent_id field, NOT a key.ends_with(...)
string check — agent ids can themselves contain hyphens (e.g. a
named identity like korp-asaf), so a suffix match on the combined
"<project>-<agent_id>" key could wrongly match a different
agent’s registration whose id happens to end in the same substring.
pub async fn lookup(&self, key: &str) -> Option<SocketAddr>
Trait Implementations§
Source§impl Clone for DevProxyRegistry
impl Clone for DevProxyRegistry
Source§fn clone(&self) -> DevProxyRegistry
fn clone(&self) -> DevProxyRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for DevProxyRegistry
impl Default for DevProxyRegistry
Source§fn default() -> DevProxyRegistry
fn default() -> DevProxyRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for DevProxyRegistry
impl !UnwindSafe for DevProxyRegistry
impl Freeze for DevProxyRegistry
impl Send for DevProxyRegistry
impl Sync for DevProxyRegistry
impl Unpin for DevProxyRegistry
impl UnsafeUnpin for DevProxyRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§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