Struct GCGatewayController
pub struct GCGatewayController {
realtime_db: GCArcRealtimeDatabase,
message_broker: RwLock<GCMessageBroker>,
plugin_manager: RwLock<GCPluginManager<PluginInstanceHandler>>,
config_db: RwLock<GCConfigDatabase>,
device_config_manager: DeviceConfigManager,
broker_publisher: GCMessagePublisher,
timeseries: Mutex<GCTimeseriesConnection>,
}Expand description
The gateway controller manages the entire gateway and can be used to interact with the different components Any changes to the system should be done through this interface.
It is important to note that the concurrent message is not automatically started, the user must call the GCGatewayController::start_async_broker method
TODO: Make negations tests
Fields§
§realtime_db: GCArcRealtimeDatabase§message_broker: RwLock<GCMessageBroker>§plugin_manager: RwLock<GCPluginManager<PluginInstanceHandler>>§config_db: RwLock<GCConfigDatabase>§device_config_manager: DeviceConfigManager§broker_publisher: GCMessagePublisher§timeseries: Mutex<GCTimeseriesConnection>Implementations§
§impl GCGatewayController
impl GCGatewayController
pub(crate) fn new(
realtime_db: GCArcRealtimeDatabase,
message_broker: GCMessageBroker,
plugin_manager: GCPluginManager<PluginInstanceHandler>,
config_db: GCConfigDatabase,
timeseries: GCTimeseriesConnection,
) -> Self
pub(crate) fn new( realtime_db: GCArcRealtimeDatabase, message_broker: GCMessageBroker, plugin_manager: GCPluginManager<PluginInstanceHandler>, config_db: GCConfigDatabase, timeseries: GCTimeseriesConnection, ) -> Self
Creates a new instance of the gateway controller
The caller is responsible for ensuring the different components are synced between each other, if this is not true may lead to inconsistences (eg: a plugin instance being loaded with a wrong configuration)
pub fn timeseries_ref(&self) -> MutexGuard<'_, GCTimeseriesConnection>
pub fn get_config_db(&self) -> RwLockReadGuard<'_, GCConfigDatabase>
pub fn get_config_db(&self) -> RwLockReadGuard<'_, GCConfigDatabase>
Retrieve the config database, responsible for storing plugins config and datapoint information
pub fn get_message_broker(&self) -> RwLockReadGuard<'_, GCMessageBroker>
pub fn get_message_broker(&self) -> RwLockReadGuard<'_, GCMessageBroker>
Retrieve the message broker, responsible for managing the messaging pipelines
pub fn get_plugin_manager(
&self,
) -> RwLockReadGuard<'_, GCPluginManager<PluginInstanceHandler>>
pub fn get_plugin_manager( &self, ) -> RwLockReadGuard<'_, GCPluginManager<PluginInstanceHandler>>
Retrieve plugin manager, responsible for managing the plugin system
pub fn poll_timeseries(&self)
pub fn poll_timeseries(&self)
Flushes the buffered datapoint values to the timeseries database
Trait Implementations§
§impl GCGatewayInterface for GCGatewayController
impl GCGatewayInterface for GCGatewayController
§fn add_plugin_instance(
&self,
instance_name: &str,
plugin_path: &str,
instance_config: GCControllerPluginInstanceConfig,
) -> Result<(), GCGatewayError>
fn add_plugin_instance( &self, instance_name: &str, plugin_path: &str, instance_config: GCControllerPluginInstanceConfig, ) -> Result<(), GCGatewayError>
TODO: This function will load any DLL specified in the plugin_path, this is a security risk and should be changed
§fn get_buffered_values<T: for<'a> TryFrom<&'a GCDatapointValue>>(
&self,
dp_names: impl Iterator<Item = GCDatapointID>,
) -> HashMap<String, Vec<T>>
fn get_buffered_values<T: for<'a> TryFrom<&'a GCDatapointValue>>( &self, dp_names: impl Iterator<Item = GCDatapointID>, ) -> HashMap<String, Vec<T>>
The intermediate copy is not needed.
§fn start_async_broker(&self)
fn start_async_broker(&self)
§fn start_plugin(&self, plugin_instance_name: &str) -> Result<(), GCGatewayError>
fn start_plugin(&self, plugin_instance_name: &str) -> Result<(), GCGatewayError>
§fn start_all_plugins(&self) -> Vec<String>
fn start_all_plugins(&self) -> Vec<String>
§fn register_plugin_publisher(
&self,
plugin_instance_name: &str,
datapoint_id: GCDatapointID,
) -> Result<(), GCGatewayError>
fn register_plugin_publisher( &self, plugin_instance_name: &str, datapoint_id: GCDatapointID, ) -> Result<(), GCGatewayError>
§fn register_plugin_subscriber(
&self,
plugin_instance_name: &str,
datapoint_id: GCDatapointID,
concurrent: bool,
) -> Result<(), GCGatewayError>
fn register_plugin_subscriber( &self, plugin_instance_name: &str, datapoint_id: GCDatapointID, concurrent: bool, ) -> Result<(), GCGatewayError>
§fn update_datapoint(
&self,
datapoint_id: GCDatapointID,
metadata: GCDatapointMetadata,
) -> Result<Vec<String>, GCGatewayError>
fn update_datapoint( &self, datapoint_id: GCDatapointID, metadata: GCDatapointMetadata, ) -> Result<Vec<String>, GCGatewayError>
§fn add_datapoint(
&self,
datapoint_id: GCDatapointID,
metadata: GCDatapointMetadata,
) -> Result<(), GCGatewayError>
fn add_datapoint( &self, datapoint_id: GCDatapointID, metadata: GCDatapointMetadata, ) -> Result<(), GCGatewayError>
§fn remove_datapoint(
&self,
datapoint_id: GCDatapointID,
) -> Result<(), GCGatewayError>
fn remove_datapoint( &self, datapoint_id: GCDatapointID, ) -> Result<(), GCGatewayError>
§fn remove_plugin_instance(
&self,
plugin_instance_name: &str,
) -> Result<(), GCGatewayError>
fn remove_plugin_instance( &self, plugin_instance_name: &str, ) -> Result<(), GCGatewayError>
§fn publish_datapoint(&self, dpv: GCDatapointValue) -> Result<(), GCGatewayError>
fn publish_datapoint(&self, dpv: GCDatapointValue) -> Result<(), GCGatewayError>
get_broker_publisher for frequent datapoint values.§fn get_datapoints_info<T: Iterator<Item = GCDatapointID>>(
&self,
datapoint_ids: Option<T>,
) -> Vec<(GCDatapointID, GCDatapointConfig)>
fn get_datapoints_info<T: Iterator<Item = GCDatapointID>>( &self, datapoint_ids: Option<T>, ) -> Vec<(GCDatapointID, GCDatapointConfig)>
§fn get_plugins_info(&self) -> Vec<GCPluginInstanceInfo>
fn get_plugins_info(&self) -> Vec<GCPluginInstanceInfo>
§fn stop_plugin_instance(
&self,
plugin_instance_name: &str,
) -> Result<(), GCGatewayError>
fn stop_plugin_instance( &self, plugin_instance_name: &str, ) -> Result<(), GCGatewayError>
§fn update_plugin_instance(
&self,
plugin_instance_name: &str,
config: GCControllerPluginInstanceConfig,
) -> Result<(), GCGatewayError>
fn update_plugin_instance( &self, plugin_instance_name: &str, config: GCControllerPluginInstanceConfig, ) -> Result<(), GCGatewayError>
§fn unregister_publisher(
&self,
plugin_instance_name: &str,
datapoint_id: GCDatapointID,
) -> bool
fn unregister_publisher( &self, plugin_instance_name: &str, datapoint_id: GCDatapointID, ) -> bool
§fn unregister_subscriber(
&self,
plugin_instance_name: &GCSubscriberIdentifier,
datapoint_id: GCDatapointID,
) -> bool
fn unregister_subscriber( &self, plugin_instance_name: &GCSubscriberIdentifier, datapoint_id: GCDatapointID, ) -> bool
§fn get_latest_values<T: for<'a> TryFrom<(String, &'a GCDatapointValue)>>(
&self,
dp_ids: impl Iterator<Item = GCDatapointID>,
) -> Vec<T>
fn get_latest_values<T: for<'a> TryFrom<(String, &'a GCDatapointValue)>>( &self, dp_ids: impl Iterator<Item = GCDatapointID>, ) -> Vec<T>
§fn upsert_runtime_subscription<T: Iterator<Item = GCDatapointID>>(
&self,
subscriber: Arc<dyn GCDatapointSubscriber>,
datapoint_ids: T,
)
fn upsert_runtime_subscription<T: Iterator<Item = GCDatapointID>>( &self, subscriber: Arc<dyn GCDatapointSubscriber>, datapoint_ids: T, )
get_datapoints_info method. Read more