pub struct DevProxyRegistry { /* private fields */ }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_container — 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.
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, target: impl Into<Target>, )
Sourcepub async fn register_from(
&self,
project: &str,
agent_id: &str,
container: Option<&str>,
target: impl Into<Target>,
)
pub async fn register_from( &self, project: &str, agent_id: &str, container: Option<&str>, target: impl Into<Target>, )
register for a dev server in container, so that container stopping or being removed
clears the route (unregister_container).
Sourcepub async fn unregister_container(&self, container: &str)
pub async fn unregister_container(&self, container: &str)
Removes every registration made from container. A container is named from its definition’s uuid and
a route from the agent’s id, which are not the same string, so this is how a stopped container’s routes go.
pub async fn lookup(&self, key: &str) -> Option<Target>
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