pub trait NamespacedOrchestrator:
Debug
+ Send
+ Sync {
// Required methods
fn ensure_service(
&self,
id: &str,
config: ServiceConfig,
) -> Result<Box<dyn Service>, Error>;
fn drop_service(&self, id: &str) -> Result<(), Error>;
fn list_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn watch_services(&self) -> BoxStream<'static, Result<ServiceEvent, Error>>;
fn fetch_service_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceProcessMetrics>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_scheduling_config(&self, config: ServiceSchedulingConfig);
}
Expand description
An orchestrator restricted to a single namespace.
Required Methods§
sourcefn ensure_service(
&self,
id: &str,
config: ServiceConfig,
) -> Result<Box<dyn Service>, Error>
fn ensure_service( &self, id: &str, config: ServiceConfig, ) -> Result<Box<dyn Service>, Error>
Ensures that a service with the given configuration is running.
If a service with the same ID already exists, its configuration is
updated to match config
. This may or may not involve restarting the
service, depending on whether the existing service matches config
.
sourcefn drop_service(&self, id: &str) -> Result<(), Error>
fn drop_service(&self, id: &str) -> Result<(), Error>
Drops the identified service, if it exists.
sourcefn list_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists the identifiers of all known services.
sourcefn watch_services(&self) -> BoxStream<'static, Result<ServiceEvent, Error>>
fn watch_services(&self) -> BoxStream<'static, Result<ServiceEvent, Error>>
Watch for status changes of all known services.
sourcefn fetch_service_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceProcessMetrics>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_service_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceProcessMetrics>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets resource usage metrics for all processes associated with a service.
Returns Err
if the entire process failed. Returns Ok(v)
otherwise,
with one element in v
for each process of the service,
even in not all metrics could be collected for all processes.
In such a case, the corresponding fields of ServiceProcessMetrics
will be None
.