Skip to main content

nominal_api_conjure/conjure/objects/ingest/manifest/
manifest_output.rs

1/// Describes a single output file from a containerized extractor.
2/// This is written by the container in manifest.json.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct ManifestOutput {
18    #[serde(rename = "ingestType")]
19    ingest_type: super::ManifestIngestType,
20    #[builder(into)]
21    #[serde(rename = "relativePath")]
22    relative_path: String,
23    #[builder(default, map(key(type = String, into), value(type = String, into)))]
24    #[serde(
25        rename = "tagColumns",
26        skip_serializing_if = "std::collections::BTreeMap::is_empty",
27        default
28    )]
29    tag_columns: std::collections::BTreeMap<String, String>,
30    #[builder(default, into)]
31    #[serde(rename = "channelPrefix", skip_serializing_if = "Option::is_none", default)]
32    channel_prefix: Option<String>,
33    #[builder(
34        default,
35        custom(
36            type = impl
37            Into<Option<super::ManifestTimestampMetadata>>,
38            convert = |v|v.into().map(Box::new)
39        )
40    )]
41    #[serde(
42        rename = "timestampMetadata",
43        skip_serializing_if = "Option::is_none",
44        default
45    )]
46    timestamp_metadata: Option<Box<super::ManifestTimestampMetadata>>,
47}
48impl ManifestOutput {
49    /// Constructs a new instance of the type.
50    #[inline]
51    pub fn new(
52        ingest_type: super::ManifestIngestType,
53        relative_path: impl Into<String>,
54    ) -> Self {
55        Self::builder().ingest_type(ingest_type).relative_path(relative_path).build()
56    }
57    /// The type of ingestion for this output file
58    #[inline]
59    pub fn ingest_type(&self) -> &super::ManifestIngestType {
60        &self.ingest_type
61    }
62    /// Relative path to the output file within OUTPUT_DIR.
63    /// Example: "telemetry.csv" or "data/sensor_readings.parquet"
64    #[inline]
65    pub fn relative_path(&self) -> &str {
66        &*self.relative_path
67    }
68    /// Optional mapping of tag names to column names for CSV/Parquet ingestion.
69    /// Example: {"vehicle_id": "veh_id", "mission_id": "msn_id"}
70    #[inline]
71    pub fn tag_columns(&self) -> &std::collections::BTreeMap<String, String> {
72        &self.tag_columns
73    }
74    /// Optional prefix to prepend to channel names during ingestion.
75    /// Example: "telemetry/" would create channels like "telemetry/speed", "telemetry/altitude"
76    #[inline]
77    pub fn channel_prefix(&self) -> Option<&str> {
78        self.channel_prefix.as_ref().map(|o| &**o)
79    }
80    /// Optional per-output timestamp metadata. When present it overrides the job-level
81    /// timestamp metadata for this output, letting outputs of different formats (e.g. a CSV
82    /// and a JSON_L file in the same job) use different timestamp fields. When absent the
83    /// job-level timestamp metadata is used, preserving existing behavior.
84    #[inline]
85    pub fn timestamp_metadata(&self) -> Option<&super::ManifestTimestampMetadata> {
86        self.timestamp_metadata.as_ref().map(|o| &**o)
87    }
88}