Struct GCRuntimeHandler
pub struct GCRuntimeHandler {
rest_client: GCRuntimeRestClient,
host: IpAddr,
rest_port: u16,
tcp_port: u16,
runtime_id: String,
is_fail_fast: bool,
}Fields§
§rest_client: GCRuntimeRestClient§host: IpAddr§rest_port: u16§tcp_port: u16§runtime_id: String§is_fail_fast: boolIf true, whenever there is an error while pushing the configuration to the runtime, the process will fail immediately without trying to push the rest of the configuration.
Implementations§
§impl GCRuntimeHandler
impl GCRuntimeHandler
pub fn new( host: IpAddr, rest_port: u16, tcp_port: u16, runtime_id: String, is_fail_fast: bool, ) -> Self
pub fn runtime_id(&self) -> &String
pub fn runtime_id(&self) -> &String
Gets the runtime identifier.
pub fn rest_client(&self) -> &GCRuntimeRestClient
pub fn rest_client(&self) -> &GCRuntimeRestClient
Get runtime client
pub async fn sync(
&self,
db: &GCConfigDatabase,
) -> Result<(), RuntimeManagerError>
pub async fn sync( &self, db: &GCConfigDatabase, ) -> Result<(), RuntimeManagerError>
Synchronizes the runtime configuration with the configuration database.
pub async fn get_remote_config_state(
&self,
config_builder: GCConfigStateBuilder<'_, '_>,
) -> Result<GCConfigState, RuntimeManagerError>
pub async fn get_remote_config_state( &self, config_builder: GCConfigStateBuilder<'_, '_>, ) -> Result<GCConfigState, RuntimeManagerError>
Gets the current state of the runtime configuration.
async fn push_additions( &self, diff: &GCRuntimeDifference<'_>, ) -> Result<(), RuntimeManagerError>
async fn push_updates( &self, diff: &GCRuntimeDifference<'_>, ) -> Result<(), RuntimeManagerError>
async fn push_removals( &self, diff: &GCRuntimeDifference<'_>, ) -> Result<(), RuntimeManagerError>
pub async fn push_configuration(
&self,
diff: GCRuntimeDifference<'_>,
) -> Result<(), RuntimeManagerError>
pub async fn push_configuration( &self, diff: GCRuntimeDifference<'_>, ) -> Result<(), RuntimeManagerError>
Pushes the runtime configuration to the runtime.
If an error occurs, the function will return immediately if is_fail_fast is set to true.
pub async fn push_device_config(
&self,
device_config: &DBDeviceConfig,
) -> Result<(), RuntimeManagerError>
pub async fn push_device_config( &self, device_config: &DBDeviceConfig, ) -> Result<(), RuntimeManagerError>
Push device configuration to the runtime This is a separate operation from push_configuration and loads directly from filesystem
pub async fn restart(&self) -> Result<(), RestartRuntimeError>
pub async fn restart(&self) -> Result<(), RestartRuntimeError>
Restarts this runtime with retry logic.
Attempts to restart up to 3 times with 3-second delays between attempts.
Returns Ok(()) on success, or Err(RestartRuntimeError::RestartFailed) if all attempts fail.