ih_muse_core/
transport.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// crates/ih-muse-core/src/transport.rs

use std::net::SocketAddr;

use async_trait::async_trait;

pub use crate::errors::MuseResult;
pub use ih_muse_proto::{
    types::*, ElementKindRegistration, ElementRegistration, MetricDefinition, MetricPayload,
    MetricQuery, NodeElementRange, NodeState, TimestampResolution,
};

#[async_trait]
pub trait Transport {
    async fn health_check(&self) -> MuseResult<()>;
    async fn get_node_state(&self) -> MuseResult<NodeState>;
    async fn get_finest_resolution(&self) -> MuseResult<TimestampResolution>;
    async fn register_element_kinds(
        &self,
        element_kinds: &[ElementKindRegistration],
    ) -> MuseResult<()>;
    async fn register_elements(
        &self,
        elements: &[ElementRegistration],
    ) -> MuseResult<Vec<MuseResult<ElementId>>>;
    async fn get_node_elem_ranges(
        &self,
        ini: Option<u64>,
        end: Option<u64>,
    ) -> MuseResult<Vec<NodeElementRange>>;
    async fn register_metrics(&self, payload: &[MetricDefinition]) -> MuseResult<()>;
    async fn get_metric_order(&self) -> MuseResult<Vec<MetricDefinition>>;
    async fn get_metrics(
        &self,
        query: &MetricQuery,
        node_addr: Option<SocketAddr>,
    ) -> MuseResult<Vec<MetricPayload>>;
    async fn send_metrics(
        &self,
        payload: Vec<MetricPayload>,
        node_addr: Option<SocketAddr>,
    ) -> MuseResult<()>;
}