Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
streaming_source.rs

1/// Aggregate view of the streaming sessions sharing a single (source, dataset) pair.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct StreamingSource {
17    #[builder(
18        default,
19        custom(
20            type = impl
21            Into<Option<super::StreamingSessionSource>>,
22            convert = |v|v.into().map(Box::new)
23        )
24    )]
25    #[serde(rename = "source", skip_serializing_if = "Option::is_none", default)]
26    source: Option<Box<super::StreamingSessionSource>>,
27    #[serde(rename = "datasetRid")]
28    dataset_rid: super::super::super::api::rids::DatasetRid,
29    #[serde(rename = "sessionCount")]
30    session_count: conjure_object::SafeLong,
31    #[serde(rename = "totalPointsCount")]
32    total_points_count: conjure_object::SafeLong,
33    #[builder(custom(type = super::super::super::api::Timestamp, convert = Box::new))]
34    #[serde(rename = "earliestCreatedAt")]
35    earliest_created_at: Box<super::super::super::api::Timestamp>,
36    #[builder(custom(type = super::super::super::api::Timestamp, convert = Box::new))]
37    #[serde(rename = "latestLastSeenAt")]
38    latest_last_seen_at: Box<super::super::super::api::Timestamp>,
39    #[builder(
40        default,
41        custom(
42            type = impl
43            Into<Option<super::super::super::api::Range>>,
44            convert = |v|v.into().map(Box::new)
45        )
46    )]
47    #[serde(rename = "mergedBounds", skip_serializing_if = "Option::is_none", default)]
48    merged_bounds: Option<Box<super::super::super::api::Range>>,
49    #[serde(rename = "anyInProgress")]
50    any_in_progress: bool,
51}
52impl StreamingSource {
53    /// The source attribution shared by the aggregated sessions. Absent for unattributed sessions.
54    #[inline]
55    pub fn source(&self) -> Option<&super::StreamingSessionSource> {
56        self.source.as_ref().map(|o| &**o)
57    }
58    #[inline]
59    pub fn dataset_rid(&self) -> &super::super::super::api::rids::DatasetRid {
60        &self.dataset_rid
61    }
62    /// Number of sessions aggregated into this group.
63    #[inline]
64    pub fn session_count(&self) -> conjure_object::SafeLong {
65        self.session_count
66    }
67    /// Sum of the points counts across the aggregated sessions.
68    #[inline]
69    pub fn total_points_count(&self) -> conjure_object::SafeLong {
70        self.total_points_count
71    }
72    /// Creation time of the oldest aggregated session.
73    #[inline]
74    pub fn earliest_created_at(&self) -> &super::super::super::api::Timestamp {
75        &*self.earliest_created_at
76    }
77    /// Most recent heartbeat time across the aggregated sessions.
78    #[inline]
79    pub fn latest_last_seen_at(&self) -> &super::super::super::api::Timestamp {
80        &*self.latest_last_seen_at
81    }
82    /// Union of the data bounds across the aggregated sessions, if any session has bounds.
83    #[inline]
84    pub fn merged_bounds(&self) -> Option<&super::super::super::api::Range> {
85        self.merged_bounds.as_ref().map(|o| &**o)
86    }
87    /// True if at least one aggregated session is in progress.
88    #[inline]
89    pub fn any_in_progress(&self) -> bool {
90        self.any_in_progress
91    }
92}