Struct GCRuntimeRunnerManager
pub struct GCRuntimeRunnerManager {
runner: Arc<dyn RuntimeRunner>,
start_attempts: Arc<Mutex<HashMap<String, Instant>>>,
}Expand description
Wraps a RuntimeRunner with higher-level lifecycle management:
- Duplicate-start debounce: start calls within
START_DEBOUNCEare silently ignored. - Stale-instance restart: when the debounce window has elapsed the existing instance is stopped before starting a new one.
- Already-running guard: on a fresh start (no prior attempt recorded) the runner’s local runtime list is queried; if the runtime is already running the start is skipped.
start_attemptstracking: last-start timestamps shared across clones viaArc.
All clone instances share the same start_attempts map.
Fields§
§runner: Arc<dyn RuntimeRunner>§start_attempts: Arc<Mutex<HashMap<String, Instant>>>Implementations§
§impl GCRuntimeRunnerManager
impl GCRuntimeRunnerManager
pub fn new(runner: Arc<dyn RuntimeRunner>) -> Self
pub async fn start(
&self,
runtime_id: &str,
host_network: bool,
) -> Result<(), RunnerError>
pub async fn start( &self, runtime_id: &str, host_network: bool, ) -> Result<(), RunnerError>
Start a runtime with debounce protection and an already-running guard.
§Behaviour
| Condition | Action |
|---|---|
| Last attempt < START_DEBOUNCE s ago | Silently ignored (start is in progress) |
| Last attempt ≥ START_DEBOUNCE s ago | Stop existing instance, then start |
| No prior attempt, already running | Silently skipped |
| No prior attempt, not running | Start |
pub async fn stop(&self, runtime_id: &str) -> Result<(), RunnerError>
pub async fn stop(&self, runtime_id: &str) -> Result<(), RunnerError>
Stop a runtime via the underlying runner.
pub async fn start_multiple(&self, runtime_ids: HashMap<String, bool>)
pub async fn start_multiple(&self, runtime_ids: HashMap<String, bool>)
Start multiple runtimes
pub async fn stop_all(&self) -> Vec<String>
pub async fn stop_all(&self) -> Vec<String>
Stop all locally-running runtimes managed by this runner. Returning the IDs of the runtimes that were stopped.
pub async fn fetch_running(&self) -> Vec<String>
pub async fn fetch_running(&self) -> Vec<String>
Returns the IDs of all locally-running runtimes.
Trait Implementations§
§impl Clone for GCRuntimeRunnerManager
impl Clone for GCRuntimeRunnerManager
§fn clone(&self) -> GCRuntimeRunnerManager
fn clone(&self) -> GCRuntimeRunnerManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GCRuntimeRunnerManager
impl !RefUnwindSafe for GCRuntimeRunnerManager
impl Send for GCRuntimeRunnerManager
impl Sync for GCRuntimeRunnerManager
impl Unpin for GCRuntimeRunnerManager
impl UnsafeUnpin for GCRuntimeRunnerManager
impl !UnwindSafe for GCRuntimeRunnerManager
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
Mutably borrows from an owned value. Read more