pub struct State { /* private fields */ }
Implementations§
Source§impl State
impl State
pub fn new(default_resolution: TimestampResolution) -> Self
Sourcepub async fn update_nodes(&self, new_nodes: HashMap<Uuid, NodeInfo>)
pub async fn update_nodes(&self, new_nodes: HashMap<Uuid, NodeInfo>)
Update the nodes
pub async fn get_nodes(&self) -> HashMap<Uuid, NodeInfo>
Sourcepub async fn init_element_kinds(
&self,
element_kinds: &[ElementKindRegistration],
)
pub async fn init_element_kinds( &self, element_kinds: &[ElementKindRegistration], )
Inits element_kinds
only once. Subsequent calls will return an error.
Sourcepub fn is_valid_element_kind_code(&self, element_kind_code: &str) -> bool
pub fn is_valid_element_kind_code(&self, element_kind_code: &str) -> bool
Check if an element kind code is valid.
Sourcepub async fn init_metrics(&self, metric_definitions: &[MetricDefinition])
pub async fn init_metrics(&self, metric_definitions: &[MetricDefinition])
Inits registered_metrics
only once. Subsequent calls will return an error.
Sourcepub fn is_valid_metric_code(&self, metric_code: &str) -> bool
pub fn is_valid_metric_code(&self, metric_code: &str) -> bool
Check if a metric code is valid.
Sourcepub async fn update_metric_order(&self, metric_order: Vec<MetricDefinition>)
pub async fn update_metric_order(&self, metric_order: Vec<MetricDefinition>)
Update metric_order
atomically with a new order.
! This is only updated in one tasks, no concurrency issues
- It can safely being read from multiple threads
Sourcepub fn get_metric_order(&self) -> Arc<Vector<Arc<MetricDefinition>>>
pub fn get_metric_order(&self) -> Arc<Vector<Arc<MetricDefinition>>>
Returns a reference to the ordered metric definitions as a slice.
Sourcepub async fn update_min_max_element_id(&self, element_id: ElementId)
pub async fn update_min_max_element_id(&self, element_id: ElementId)
Updates min_element_id
and max_element_id
based on the provided element_id
.
If either is None
, it will set both to the element_id
.
Otherwise, it updates min_element_id
if element_id
is smaller,
and max_element_id
if element_id
is larger.
pub async fn get_element_id_range( &self, ) -> (Option<ElementId>, Option<ElementId>)
pub async fn update_node_elem_ranges(&self, ranges: &[NodeElementRange])
pub async fn get_node_elem_ranges(&self) -> OrdMap<OrdRangeInc, Uuid>
Sourcepub fn find_node(&self, element_id: u64) -> Option<Uuid>
pub fn find_node(&self, element_id: u64) -> Option<Uuid>
Find the node ID corresponding to a given element ID
Sourcepub fn find_element_node_addr(&self, element_id: u64) -> Option<SocketAddr>
pub fn find_element_node_addr(&self, element_id: u64) -> Option<SocketAddr>
Find the node address corresponding to a given element ID
Sourcepub async fn update_finest_resolution(
&self,
finest_resolution: TimestampResolution,
)
pub async fn update_finest_resolution( &self, finest_resolution: TimestampResolution, )
Update finest_resolution
atomically.
Sourcepub fn get_finest_resolution(&self) -> TimestampResolution
pub fn get_finest_resolution(&self) -> TimestampResolution
Retrieve the current finest_resolution
as TimestampResolution
.