pub struct ServiceRegistry { /* private fields */ }Expand description
Holds the daemon’s registered services and routes control-socket envelopes
to them by name.
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
Sourcepub fn register(&mut self, service: Arc<dyn DaemonService>)
pub fn register(&mut self, service: Arc<dyn DaemonService>)
Adds a service. Lookups match by DaemonService::name and the first
registration wins; a second service sharing a name would be dead code
for routing and would double-count in status/menu iteration, so it is
rejected with a warning rather than silently kept.
Sourcepub fn get(&self, name: &str) -> Option<&Arc<dyn DaemonService>>
pub fn get(&self, name: &str) -> Option<&Arc<dyn DaemonService>>
Returns the registered service with the given name, if any.
Sourcepub fn services(&self) -> &[Arc<dyn DaemonService>]
pub fn services(&self) -> &[Arc<dyn DaemonService>]
All registered services, in registration order.
Sourcepub fn set_github_rate_limit(&mut self, cache: Arc<RateLimitCache>)
pub fn set_github_rate_limit(&mut self, cache: Arc<RateLimitCache>)
Wires in the GitHub rate-limit monitor’s cache (#1375), so the built-in
status op can surface budget usage. Called once at daemon start with the
same Arc the worktrees service’s poller writes.
Sourcepub fn github_rate_limit(&self) -> Option<RateLimitSnapshot>
pub fn github_rate_limit(&self) -> Option<RateLimitSnapshot>
The latest GitHub rate-limit snapshot, or None when the monitor is
unwired or has not polled successfully yet.
Sourcepub async fn dispatch(
&self,
service: &str,
op: &str,
payload: Value,
) -> Result<Value>
pub async fn dispatch( &self, service: &str, op: &str, payload: Value, ) -> Result<Value>
Routes an operation to the named service, erroring if no such service is registered.
Sourcepub fn subscribe(
&self,
service: &str,
op: &str,
payload: &Value,
) -> Option<Box<dyn ServiceStream>>
pub fn subscribe( &self, service: &str, op: &str, payload: &Value, ) -> Option<Box<dyn ServiceStream>>
Opens a push subscription on the named service for a streaming op, or
None when the service is unknown or does not stream that op — in which
case the caller falls back to the normal dispatch
request→reply path (#1267).
Sourcepub async fn statuses(&self) -> Vec<ServiceStatus>
pub async fn statuses(&self) -> Vec<ServiceStatus>
Collects status from every service, in registration order.
Sourcepub async fn shutdown_all(&self)
pub async fn shutdown_all(&self)
Gracefully shuts down every service, in registration order.
Trait Implementations§
Source§impl Clone for ServiceRegistry
impl Clone for ServiceRegistry
Source§fn clone(&self) -> ServiceRegistry
fn clone(&self) -> ServiceRegistry
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 ServiceRegistry
impl Default for ServiceRegistry
Source§fn default() -> ServiceRegistry
fn default() -> ServiceRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceRegistry
impl !UnwindSafe for ServiceRegistry
impl Freeze for ServiceRegistry
impl Send for ServiceRegistry
impl Sync for ServiceRegistry
impl Unpin for ServiceRegistry
impl UnsafeUnpin for ServiceRegistry
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,
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> 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