Struct GCSharedRuntimeManager
pub struct GCSharedRuntimeManager {
inner: Arc<RwLock<GCRuntimeManager>>,
health_check_tx: Arc<Sender<()>>,
}Expand description
Shared handle to GCRuntimeManager, cheap to clone.
Spawns a background health-check task on construction that periodically
calls the /health endpoint on every connected runtime and removes any
that fail to respond. The task can also be triggered immediately via
GCSharedRuntimeManager::trigger_health_check.
Fields§
§inner: Arc<RwLock<GCRuntimeManager>>§health_check_tx: Arc<Sender<()>>Send () to trigger an immediate health check outside of the normal interval.
Implementations§
pub fn new(
runner_mode: GCRunnerMode,
runner: Option<Arc<dyn RuntimeRunner>>,
config: &GCConfigDatabase,
) -> GCSharedRuntimeManager
pub fn new( runner_mode: GCRunnerMode, runner: Option<Arc<dyn RuntimeRunner>>, config: &GCConfigDatabase, ) -> GCSharedRuntimeManager
Creates a runtime manager and starts the background health-check task.
Pass Some(Arc::new(runner)) for process or container mode, or None to disable
runner-based start/stop (the manager will still track runtimes that register themselves).
pub fn trigger_health_check(&self)
pub fn trigger_health_check(&self)
Trigger an immediate health check outside the normal 5-second interval.
If a check is already queued the call is silently ignored (channel capacity is 1).
fn spawn_health_check_task(&self, rx: Receiver<()>)
fn spawn_health_check_task(&self, rx: Receiver<()>)
Spawns the background health-check loop.
pub async fn write(&self) -> RwLockWriteGuard<'_, GCRuntimeManager>
pub async fn read(&self) -> RwLockReadGuard<'_, GCRuntimeManager>
pub async fn owned_write(&self) -> OwnedRwLockWriteGuard<GCRuntimeManager>
pub async fn owned_write(&self) -> OwnedRwLockWriteGuard<GCRuntimeManager>
Useful for sending across threads.
pub async fn owned_read(&self) -> OwnedRwLockReadGuard<GCRuntimeManager>
pub async fn owned_read(&self) -> OwnedRwLockReadGuard<GCRuntimeManager>
Useful for sending across threads.
pub async fn stop_all_managed_runtimes(&self)
pub async fn stop_all_managed_runtimes(&self)
Stops all runtimes managed by the runner and removes them from the connected pool
pub async fn start_runtime( &self, runtime_id: &str, config_db: &GCConfigDatabase, ) -> Result<(), StartRuntimeError>
pub async fn connected_runtimes(&self) -> HashSet<String>
pub async fn managed_runtimes(&self) -> HashSet<String>
pub async fn managed_runtimes(&self) -> HashSet<String>
Returns the IDs of runtimes currently managed by the runner This may return runtimes that are not connected (e.g. zombie runtimes)
pub async fn start_multiple_runtimes(
&self,
running_runtimes: HashMap<String, bool>,
)
pub async fn start_multiple_runtimes( &self, running_runtimes: HashMap<String, bool>, )
Starts multiple runtimes in parallel.
running_runtimes is a list of tuples of runtime ID and whether the runtime should be started in host network mode.
pub async fn stop_runtime( &self, runtime_id: &str, ) -> Result<(), StopRuntimeError>
Trait Implementations§
§fn clone(&self) -> GCSharedRuntimeManager
fn clone(&self) -> GCSharedRuntimeManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more