ih_muse_core::prelude

Struct State

Source
pub struct State { /* private fields */ }

Implementations§

Source§

impl State

Source

pub fn new(default_resolution: TimestampResolution) -> Self

Source

pub async fn update_nodes(&self, new_nodes: HashMap<Uuid, NodeInfo>)

Update the nodes

Source

pub async fn get_nodes(&self) -> HashMap<Uuid, NodeInfo>

Source

pub async fn init_element_kinds( &self, element_kinds: &[ElementKindRegistration], )

Inits element_kinds only once. Subsequent calls will return an error.

Source

pub fn is_valid_element_kind_code(&self, element_kind_code: &str) -> bool

Check if an element kind code is valid.

Source

pub async fn init_metrics(&self, metric_definitions: &[MetricDefinition])

Inits registered_metrics only once. Subsequent calls will return an error.

Source

pub fn is_valid_metric_code(&self, metric_code: &str) -> bool

Check if a metric code is valid.

Source

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
Source

pub fn get_metric_order(&self) -> Arc<Vector<Arc<MetricDefinition>>>

Returns a reference to the ordered metric definitions as a slice.

Source

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.

Source

pub async fn get_element_id_range( &self, ) -> (Option<ElementId>, Option<ElementId>)

Source

pub async fn update_node_elem_ranges(&self, ranges: &[NodeElementRange])

Source

pub async fn get_node_elem_ranges(&self) -> OrdMap<OrdRangeInc, Uuid>

Source

pub fn find_node(&self, element_id: u64) -> Option<Uuid>

Find the node ID corresponding to a given element ID

Source

pub fn find_element_node_addr(&self, element_id: u64) -> Option<SocketAddr>

Find the node address corresponding to a given element ID

Source

pub async fn update_finest_resolution( &self, finest_resolution: TimestampResolution, )

Update finest_resolution atomically.

Source

pub fn get_finest_resolution(&self) -> TimestampResolution

Retrieve the current finest_resolution as TimestampResolution.

Source

pub async fn update_element_id( &self, local_id: LocalElementId, element_id: ElementId, )

Source

pub fn get_element_id(&self, local_id: &LocalElementId) -> Option<ElementId>

Trait Implementations§

Source§

impl Default for State

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V