pub struct CloudSubscriber {
ctrl_tx: UnboundedSender<CtrlMsg>,
agents: Arc<Mutex<HashSet<String>>>,
}Fields§
§ctrl_tx: UnboundedSender<CtrlMsg>§agents: Arc<Mutex<HashSet<String>>>In-memory copy of subscribed agents, kept in sync with the WS loop so add_agent/remove_agent can be called before the WS connects.
Implementations§
Source§impl CloudSubscriber
impl CloudSubscriber
Sourcepub fn init_global(mstore: Arc<Store>)
pub fn init_global(mstore: Arc<Store>)
Initialize the global subscriber and start the background WS loop. Should be called once at startup. No-op if already initialized.
Sourcepub fn add_agent(&self, agent_id: &str)
pub fn add_agent(&self, agent_id: &str)
Notify the WS loop that a new agent is registered locally. Normalizes to lowercase and skips the WS send if already subscribed, so calling this on every COMMAND_AGENT_INPUT turn is safe.
Sourcepub fn remove_agent(&self, agent_id: &str)
pub fn remove_agent(&self, agent_id: &str)
Notify the WS loop that an agent has been unregistered.
Sourcepub fn drop_if_orphaned(
&self,
agent_id: &str,
is_live: impl Fn(&str) -> bool,
) -> bool
pub fn drop_if_orphaned( &self, agent_id: &str, is_live: impl Fn(&str) -> bool, ) -> bool
Unsubscribe agent_id if no live block holds it (is_live), and
say whether it did. The check, the removal and the RemoveAgent
send all happen under the agents lock, which add_agent also
takes: a respawn either registered first (the check sees it live and
nothing is dropped) or its add_agent waits, then finds the key gone
and queues AddAgent after this RemoveAgent — the WS loop applies
them in order and it ends subscribed (Codex P2 ×2 on #3897).
is_live must not take the agents lock; it may take the reactive
handler’s (which never takes this one).
Sourceasync fn release_now(
&self,
agent_id: &str,
base: &str,
token: impl Future<Output = String>,
) -> RelayRelease
async fn release_now( &self, agent_id: &str, base: &str, token: impl Future<Output = String>, ) -> RelayRelease
release_agent_now’s body, with the relay and token injectable.
The removal and its RemoveAgent are queued together under the
agents lock, like Self::remove_agent — so an agent re-added
while the release is awaited queues AddAgent after it and ends
subscribed (ReAgent P1 on #3899). The awaited release then runs
under wan_lease’s per-agent lock, serialized with the RemoveAgent
arm’s own: when this returns, whichever of the two ran has finished,
and neither releases an agent that was subscribed again.
Sourcepub fn reload_token(&self)
pub fn reload_token(&self)
Called after muxbus.login completes — trigger a fresh WS connection with the newly stored token.
Sourcepub fn subscribed_agents(&self) -> Vec<String>
pub fn subscribed_agents(&self) -> Vec<String>
Snapshot of the agents this sidecar has subscribed to the cloud relay (Tier-4), sorted for stable output. Empty when no MUXBUS_TOKEN is set (cloud disabled). Read-only; used by the discovery endpoint.
Auto Trait Implementations§
impl Freeze for CloudSubscriber
impl RefUnwindSafe for CloudSubscriber
impl Send for CloudSubscriber
impl Sync for CloudSubscriber
impl Unpin for CloudSubscriber
impl UnsafeUnpin for CloudSubscriber
impl UnwindSafe for CloudSubscriber
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<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