Skip to main content

nominal_api/conjure/objects/scout/compute/api/
stale_ranges.rs

1/// Produces a list of ranges for which data does not exist for the specified duration or longer. Increases
2/// window size by the specified staleness threshold on both ends to capture edge cases of data not currently
3/// in view.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    conjure_object::private::DeriveWith
10)]
11#[serde(crate = "conjure_object::serde")]
12#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct StaleRanges {
16    #[builder(custom(type = super::Series, convert = Box::new))]
17    #[serde(rename = "input")]
18    input: Box<super::Series>,
19    #[builder(custom(type = super::DurationConstant, convert = Box::new))]
20    #[serde(rename = "threshold")]
21    threshold: Box<super::DurationConstant>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::TimestampConstant>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
31    start_timestamp: Option<Box<super::TimestampConstant>>,
32    #[builder(
33        default,
34        custom(
35            type = impl
36            Into<Option<super::TimestampConstant>>,
37            convert = |v|v.into().map(Box::new)
38        )
39    )]
40    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
41    end_timestamp: Option<Box<super::TimestampConstant>>,
42}
43impl StaleRanges {
44    /// Constructs a new instance of the type.
45    #[inline]
46    pub fn new(input: super::Series, threshold: super::DurationConstant) -> Self {
47        Self::builder().input(input).threshold(threshold).build()
48    }
49    #[inline]
50    pub fn input(&self) -> &super::Series {
51        &*self.input
52    }
53    #[inline]
54    pub fn threshold(&self) -> &super::DurationConstant {
55        &*self.threshold
56    }
57    /// The start timestamp of the range. If not specified, staleness will automatically use view range start.
58    #[inline]
59    pub fn start_timestamp(&self) -> Option<&super::TimestampConstant> {
60        self.start_timestamp.as_ref().map(|o| &**o)
61    }
62    #[deprecated(note = "No longer used and will be removed")]
63    #[inline]
64    pub fn end_timestamp(&self) -> Option<&super::TimestampConstant> {
65        self.end_timestamp.as_ref().map(|o| &**o)
66    }
67}