Skip to main content

nominal_api/conjure/objects/persistent/compute/api/
streaming_compute_node_request.rs

1/// A templatized version of `ComputeNodeRequest` where the end of the range will track the current time and
2/// the start of the range tracks `windowWidth` time ago.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct StreamingComputeNodeRequest {
15    #[builder(
16        custom(
17            type = super::super::super::super::scout::compute::api::ComputableNode,
18            convert = Box::new
19        )
20    )]
21    #[serde(rename = "node")]
22    node: Box<super::super::super::super::scout::compute::api::ComputableNode>,
23    #[builder(
24        custom(
25            type = super::super::super::super::scout::run::api::Duration,
26            convert = Box::new
27        )
28    )]
29    #[serde(rename = "windowWidth")]
30    window_width: Box<super::super::super::super::scout::run::api::Duration>,
31    #[builder(
32        custom(
33            type = super::super::super::super::scout::compute::api::Context,
34            convert = Box::new
35        )
36    )]
37    #[serde(rename = "context")]
38    context: Box<super::super::super::super::scout::compute::api::Context>,
39    #[builder(default, into)]
40    #[serde(rename = "sourceRid", skip_serializing_if = "Option::is_none", default)]
41    source_rid: Option<conjure_object::ResourceIdentifier>,
42}
43impl StreamingComputeNodeRequest {
44    /// Constructs a new instance of the type.
45    #[inline]
46    pub fn new(
47        node: super::super::super::super::scout::compute::api::ComputableNode,
48        window_width: super::super::super::super::scout::run::api::Duration,
49        context: super::super::super::super::scout::compute::api::Context,
50    ) -> Self {
51        Self::builder().node(node).window_width(window_width).context(context).build()
52    }
53    #[inline]
54    pub fn node(
55        &self,
56    ) -> &super::super::super::super::scout::compute::api::ComputableNode {
57        &*self.node
58    }
59    #[inline]
60    pub fn window_width(
61        &self,
62    ) -> &super::super::super::super::scout::run::api::Duration {
63        &*self.window_width
64    }
65    #[inline]
66    pub fn context(&self) -> &super::super::super::super::scout::compute::api::Context {
67        &*self.context
68    }
69    /// Optional RID identifying the resource that initiated this query (e.g. workbook/notebook RID, checklist RID).
70    /// Used for observability only — trusted as-is, no permission checks are performed on this value.
71    #[inline]
72    pub fn source_rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
73        self.source_rid.as_ref().map(|o| &*o)
74    }
75}