Struct GCRuntimeManager
pub struct GCRuntimeManager {
runtimes: HashMap<String, GCRuntimeHandler>,
systemd_runner_enable: bool,
}Expand description
The runtime manager is responsible for managing the runtimes. Runtimes are only added if they are present in the configuration database.
The runtime manager should never write to the configuration database. It should sync instead.
Fields§
§runtimes: HashMap<String, GCRuntimeHandler>§systemd_runner_enable: boolImplementations§
§impl GCRuntimeManager
impl GCRuntimeManager
pub fn new( systemd_runner_enable: bool, config: &GCConfigDatabase, ) -> GCRuntimeManager
pub async fn new_runtime( &mut self, id: String, host: IpAddr, rest_port: u16, tcp_port: u16, config: &GCConfigDatabase, ) -> Result<(), RuntimeManagerError>
pub async fn clear(&mut self, config: &mut GCConfigDatabase)
pub async fn sync(
&mut self,
config: &GCConfigDatabase,
) -> Result<(), RuntimeManagerError>
pub async fn sync( &mut self, config: &GCConfigDatabase, ) -> Result<(), RuntimeManagerError>
Syncs all the runtimes in parallel with the configuration database. If a runtime is not present in the configuration database, it will be removed.
If there there runtimes in the database that do not exist in the runtime manager, they will NOT be added. New runtimes need to be added using the new_runtime method.
pub fn get_runtime_handler(&self, id: &str) -> Option<&GCRuntimeHandler>
pub fn get_rest_client(&self, id: &str) -> Option<&GCRuntimeRestClient>
pub fn get_runtimes(&self) -> impl Iterator<Item = &String>
pub fn remove_runtime(&mut self, id: &str) -> Option<GCRuntimeHandler>
pub fn stop_orphaned_runtimes(&self, config: &GCConfigDatabase)
pub fn stop_orphaned_runtimes(&self, config: &GCConfigDatabase)
Stops all gc_runtime@* systemd services whose IDs are not present in the configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GCRuntimeManager
impl !RefUnwindSafe for GCRuntimeManager
impl Send for GCRuntimeManager
impl Sync for GCRuntimeManager
impl Unpin for GCRuntimeManager
impl UnsafeUnpin for GCRuntimeManager
impl !UnwindSafe for GCRuntimeManager
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