Skip to main content

nominal_api/proto/
nominal.direct_channel_writer.v2.rs

1// This file is @generated by prost-build.
2/// Public-facing write request. Used by external clients via the Conjure HTTP API.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct WriteBatchesRequest {
5    #[prost(message, repeated, tag = "1")]
6    pub batches: ::prost::alloc::vec::Vec<RecordsBatch>,
7    #[prost(string, tag = "2")]
8    pub data_source_rid: ::prost::alloc::string::String,
9}
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct StreamingSessionSourceInfo {
12    #[prost(oneof = "streaming_session_source_info::Source", tags = "1, 2, 3")]
13    pub source: ::core::option::Option<streaming_session_source_info::Source>,
14}
15/// Nested message and enum types in `StreamingSessionSourceInfo`.
16pub mod streaming_session_source_info {
17    #[derive(Clone, PartialEq, ::prost::Oneof)]
18    pub enum Source {
19        #[prost(message, tag = "1")]
20        Mesh(super::MeshStreamingSessionSourceInfo),
21        #[prost(message, tag = "2")]
22        DataConnector(super::DataConnectorStreamingSessionSourceInfo),
23        #[prost(message, tag = "3")]
24        Custom(super::CustomStreamingSessionSourceInfo),
25    }
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct MeshStreamingSessionSourceInfo {
29    #[prost(string, tag = "1")]
30    pub source_dataset_rid: ::prost::alloc::string::String,
31    #[prost(string, tag = "2")]
32    pub source_org_rid: ::prost::alloc::string::String,
33    #[prost(string, tag = "3")]
34    pub origin_streaming_session_source: ::prost::alloc::string::String,
35}
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct DataConnectorStreamingSessionSourceInfo {
38    #[prost(string, tag = "1")]
39    pub data_connector_rid: ::prost::alloc::string::String,
40}
41#[derive(Clone, PartialEq, ::prost::Message)]
42pub struct CustomStreamingSessionSourceInfo {
43    #[prost(string, tag = "1")]
44    pub source_name: ::prost::alloc::string::String,
45}
46/// Internal write request. Used internally by the channel writer, Kafka consumers, and mesh.
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct InternalWriteBatchesRequest {
49    #[prost(message, repeated, tag = "1")]
50    pub batches: ::prost::alloc::vec::Vec<RecordsBatch>,
51    #[prost(string, tag = "2")]
52    pub data_source_rid: ::prost::alloc::string::String,
53    #[prost(message, optional, tag = "3")]
54    pub source: ::core::option::Option<StreamingSessionSourceInfo>,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct ArrayPoints {
58    #[prost(oneof = "array_points::ArrayType", tags = "1, 2")]
59    pub array_type: ::core::option::Option<array_points::ArrayType>,
60}
61/// Nested message and enum types in `ArrayPoints`.
62pub mod array_points {
63    #[derive(Clone, PartialEq, ::prost::Oneof)]
64    pub enum ArrayType {
65        #[prost(message, tag = "1")]
66        DoubleArrayPoints(super::DoubleArrayPoints),
67        #[prost(message, tag = "2")]
68        StringArrayPoints(super::StringArrayPoints),
69    }
70}
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct StringArrayPoints {
73    #[prost(message, repeated, tag = "1")]
74    pub points: ::prost::alloc::vec::Vec<StringArrayPoint>,
75}
76#[derive(Clone, PartialEq, ::prost::Message)]
77pub struct StringArrayPoint {
78    #[prost(string, repeated, tag = "2")]
79    pub value: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
80}
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct DoubleArrayPoints {
83    #[prost(message, repeated, tag = "1")]
84    pub points: ::prost::alloc::vec::Vec<DoubleArrayPoint>,
85}
86#[derive(Clone, PartialEq, ::prost::Message)]
87pub struct DoubleArrayPoint {
88    #[prost(double, repeated, tag = "2")]
89    pub value: ::prost::alloc::vec::Vec<f64>,
90}
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct LogPoints {
93    #[prost(message, repeated, tag = "1")]
94    pub points: ::prost::alloc::vec::Vec<LogPoint>,
95}
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct LogPoint {
98    #[prost(message, optional, tag = "2")]
99    pub value: ::core::option::Option<LogValue>,
100}
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct StructPoints {
103    #[prost(string, repeated, tag = "1")]
104    pub points: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
105}
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct LogValue {
108    #[prost(string, tag = "1")]
109    pub message: ::prost::alloc::string::String,
110    #[prost(map = "string, string", tag = "2")]
111    pub args: ::std::collections::HashMap<
112        ::prost::alloc::string::String,
113        ::prost::alloc::string::String,
114    >,
115}
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct StringPoints {
118    #[prost(string, repeated, tag = "1")]
119    pub points: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
120}
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct DoublePoints {
123    #[prost(double, repeated, tag = "1")]
124    pub points: ::prost::alloc::vec::Vec<f64>,
125}
126#[derive(Clone, PartialEq, ::prost::Message)]
127pub struct IntPoints {
128    #[prost(int64, repeated, tag = "1")]
129    pub points: ::prost::alloc::vec::Vec<i64>,
130}
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct Uint64Points {
133    #[prost(uint64, repeated, tag = "1")]
134    pub points: ::prost::alloc::vec::Vec<u64>,
135}
136#[derive(Clone, PartialEq, ::prost::Message)]
137pub struct Points {
138    #[prost(message, repeated, tag = "1")]
139    pub timestamps: ::prost::alloc::vec::Vec<super::super::types::time::Timestamp>,
140    #[prost(oneof = "points::Points", tags = "2, 3, 4, 5, 6, 7, 8")]
141    pub points: ::core::option::Option<points::Points>,
142}
143/// Nested message and enum types in `Points`.
144pub mod points {
145    #[derive(Clone, PartialEq, ::prost::Oneof)]
146    pub enum Points {
147        #[prost(message, tag = "2")]
148        DoublePoints(super::DoublePoints),
149        #[prost(message, tag = "3")]
150        StringPoints(super::StringPoints),
151        #[prost(message, tag = "4")]
152        LogPoints(super::LogPoints),
153        #[prost(message, tag = "5")]
154        IntPoints(super::IntPoints),
155        #[prost(message, tag = "6")]
156        ArrayPoints(super::ArrayPoints),
157        #[prost(message, tag = "7")]
158        StructPoints(super::StructPoints),
159        #[prost(message, tag = "8")]
160        Uint64Points(super::Uint64Points),
161    }
162}
163#[derive(Clone, PartialEq, ::prost::Message)]
164pub struct RecordsBatch {
165    #[prost(string, tag = "1")]
166    pub channel: ::prost::alloc::string::String,
167    #[prost(map = "string, string", tag = "2")]
168    pub tags: ::std::collections::HashMap<
169        ::prost::alloc::string::String,
170        ::prost::alloc::string::String,
171    >,
172    #[prost(message, optional, tag = "3")]
173    pub points: ::core::option::Option<Points>,
174}
175#[derive(Clone, PartialEq, ::prost::Message)]
176pub struct ChannelSeriesMetadata {
177    #[prost(string, tag = "1")]
178    pub series_id: ::prost::alloc::string::String,
179    #[prost(map = "string, string", tag = "2")]
180    pub tags: ::std::collections::HashMap<
181        ::prost::alloc::string::String,
182        ::prost::alloc::string::String,
183    >,
184}
185#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct ChannelSeriesMetadataBatch {
187    #[prost(message, repeated, tag = "1")]
188    pub series_metadata: ::prost::alloc::vec::Vec<ChannelSeriesMetadata>,
189}
190#[derive(Clone, Copy, PartialEq, ::prost::Message)]
191pub struct WriteBatchesResponse {}
192/// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
193#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
194#[repr(i32)]
195pub enum NominalDirectChannelWriterError {
196    DataSourceNotFound = 0,
197    DataSourcesNotFound = 1,
198    InvalidNominalDataSource = 2,
199    /// The requested data source already exists.
200    NominalDataSourceConflict = 3,
201    /// Array size exceeds maximum allowed length.
202    ArrayTooLarge = 4,
203    /// Found two different data types for the same series in the request.
204    ConflictingDataTypes = 5,
205    /// The nominal data source or dataset provided is invalid.
206    InvalidDataSource = 6,
207    InvalidTelegrafTimestamp = 7,
208    InvalidTimestamp = 8,
209    /// Columnar streaming request contains different numbers of timestamps and values
210    MismatchedTimestampsAndValues = 9,
211    /// Unsupported dataset for streaming.
212    StreamingDisabledOnDataset = 10,
213    /// The provided Range is invalid because the start time is greater than the end time.
214    InvalidRange = 11,
215    /// The provided Points type is not set.
216    PointsTypeNotSet = 12,
217    /// The provided ArrayPoints type is not set.
218    ArrayPointsTypeNotSet = 13,
219    /// Not authorized to write to the specified data source.
220    NotAuthorized = 14,
221}
222impl NominalDirectChannelWriterError {
223    /// String value of the enum field names used in the ProtoBuf definition.
224    ///
225    /// The values are not transformed in any way and thus are considered stable
226    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
227    pub fn as_str_name(&self) -> &'static str {
228        match self {
229            Self::DataSourceNotFound => {
230                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCE_NOT_FOUND"
231            }
232            Self::DataSourcesNotFound => {
233                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCES_NOT_FOUND"
234            }
235            Self::InvalidNominalDataSource => {
236                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_NOMINAL_DATA_SOURCE"
237            }
238            Self::NominalDataSourceConflict => {
239                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOMINAL_DATA_SOURCE_CONFLICT"
240            }
241            Self::ArrayTooLarge => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_TOO_LARGE",
242            Self::ConflictingDataTypes => {
243                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_CONFLICTING_DATA_TYPES"
244            }
245            Self::InvalidDataSource => {
246                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_DATA_SOURCE"
247            }
248            Self::InvalidTelegrafTimestamp => {
249                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TELEGRAF_TIMESTAMP"
250            }
251            Self::InvalidTimestamp => {
252                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TIMESTAMP"
253            }
254            Self::MismatchedTimestampsAndValues => {
255                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_MISMATCHED_TIMESTAMPS_AND_VALUES"
256            }
257            Self::StreamingDisabledOnDataset => {
258                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_STREAMING_DISABLED_ON_DATASET"
259            }
260            Self::InvalidRange => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_RANGE",
261            Self::PointsTypeNotSet => {
262                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_POINTS_TYPE_NOT_SET"
263            }
264            Self::ArrayPointsTypeNotSet => {
265                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_POINTS_TYPE_NOT_SET"
266            }
267            Self::NotAuthorized => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOT_AUTHORIZED",
268        }
269    }
270    /// Creates an enum from field names used in the ProtoBuf definition.
271    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
272        match value {
273            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCE_NOT_FOUND" => {
274                Some(Self::DataSourceNotFound)
275            }
276            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCES_NOT_FOUND" => {
277                Some(Self::DataSourcesNotFound)
278            }
279            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_NOMINAL_DATA_SOURCE" => {
280                Some(Self::InvalidNominalDataSource)
281            }
282            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOMINAL_DATA_SOURCE_CONFLICT" => {
283                Some(Self::NominalDataSourceConflict)
284            }
285            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_TOO_LARGE" => {
286                Some(Self::ArrayTooLarge)
287            }
288            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_CONFLICTING_DATA_TYPES" => {
289                Some(Self::ConflictingDataTypes)
290            }
291            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_DATA_SOURCE" => {
292                Some(Self::InvalidDataSource)
293            }
294            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TELEGRAF_TIMESTAMP" => {
295                Some(Self::InvalidTelegrafTimestamp)
296            }
297            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TIMESTAMP" => {
298                Some(Self::InvalidTimestamp)
299            }
300            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_MISMATCHED_TIMESTAMPS_AND_VALUES" => {
301                Some(Self::MismatchedTimestampsAndValues)
302            }
303            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_STREAMING_DISABLED_ON_DATASET" => {
304                Some(Self::StreamingDisabledOnDataset)
305            }
306            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_RANGE" => {
307                Some(Self::InvalidRange)
308            }
309            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_POINTS_TYPE_NOT_SET" => {
310                Some(Self::PointsTypeNotSet)
311            }
312            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_POINTS_TYPE_NOT_SET" => {
313                Some(Self::ArrayPointsTypeNotSet)
314            }
315            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOT_AUTHORIZED" => {
316                Some(Self::NotAuthorized)
317            }
318            _ => None,
319        }
320    }
321}
322/// Generated client implementations.
323pub mod direct_nominal_channel_writer_service_client {
324    #![allow(
325        unused_variables,
326        dead_code,
327        missing_docs,
328        clippy::wildcard_imports,
329        clippy::let_unit_value,
330    )]
331    use tonic::codegen::*;
332    use tonic::codegen::http::Uri;
333    /// Writes data points directly to Nominal's managed database offering.
334    #[derive(Debug, Clone)]
335    pub struct DirectNominalChannelWriterServiceClient<T> {
336        inner: tonic::client::Grpc<T>,
337    }
338    impl DirectNominalChannelWriterServiceClient<tonic::transport::Channel> {
339        /// Attempt to create a new client by connecting to a given endpoint.
340        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
341        where
342            D: TryInto<tonic::transport::Endpoint>,
343            D::Error: Into<StdError>,
344        {
345            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
346            Ok(Self::new(conn))
347        }
348    }
349    impl<T> DirectNominalChannelWriterServiceClient<T>
350    where
351        T: tonic::client::GrpcService<tonic::body::Body>,
352        T::Error: Into<StdError>,
353        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
354        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
355    {
356        pub fn new(inner: T) -> Self {
357            let inner = tonic::client::Grpc::new(inner);
358            Self { inner }
359        }
360        pub fn with_origin(inner: T, origin: Uri) -> Self {
361            let inner = tonic::client::Grpc::with_origin(inner, origin);
362            Self { inner }
363        }
364        pub fn with_interceptor<F>(
365            inner: T,
366            interceptor: F,
367        ) -> DirectNominalChannelWriterServiceClient<InterceptedService<T, F>>
368        where
369            F: tonic::service::Interceptor,
370            T::ResponseBody: Default,
371            T: tonic::codegen::Service<
372                http::Request<tonic::body::Body>,
373                Response = http::Response<
374                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
375                >,
376            >,
377            <T as tonic::codegen::Service<
378                http::Request<tonic::body::Body>,
379            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
380        {
381            DirectNominalChannelWriterServiceClient::new(
382                InterceptedService::new(inner, interceptor),
383            )
384        }
385        /// Compress requests with the given encoding.
386        ///
387        /// This requires the server to support it otherwise it might respond with an
388        /// error.
389        #[must_use]
390        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
391            self.inner = self.inner.send_compressed(encoding);
392            self
393        }
394        /// Enable decompressing responses.
395        #[must_use]
396        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
397            self.inner = self.inner.accept_compressed(encoding);
398            self
399        }
400        /// Limits the maximum size of a decoded message.
401        ///
402        /// Default: `4MB`
403        #[must_use]
404        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
405            self.inner = self.inner.max_decoding_message_size(limit);
406            self
407        }
408        /// Limits the maximum size of an encoded message.
409        ///
410        /// Default: `usize::MAX`
411        #[must_use]
412        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
413            self.inner = self.inner.max_encoding_message_size(limit);
414            self
415        }
416        /// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
417        /// Synchronously writes batches of records to a Nominal data source. This endpoint bypasses the
418        /// Channel Writer service entirely, and should only be used if the implications are well understood.
419        ///
420        /// If you call this endpoint, writes will go directly into Nominal DB and will not be placed in Nominal's
421        /// durable queue. This results in lower latency, but also consequently lower durability.
422        pub async fn write_batches(
423            &mut self,
424            request: impl tonic::IntoRequest<super::InternalWriteBatchesRequest>,
425        ) -> std::result::Result<
426            tonic::Response<super::WriteBatchesResponse>,
427            tonic::Status,
428        > {
429            self.inner
430                .ready()
431                .await
432                .map_err(|e| {
433                    tonic::Status::unknown(
434                        format!("Service was not ready: {}", e.into()),
435                    )
436                })?;
437            let codec = tonic::codec::ProstCodec::default();
438            let path = http::uri::PathAndQuery::from_static(
439                "/nominal.direct_channel_writer.v2.DirectNominalChannelWriterService/WriteBatches",
440            );
441            let mut req = request.into_request();
442            req.extensions_mut()
443                .insert(
444                    GrpcMethod::new(
445                        "nominal.direct_channel_writer.v2.DirectNominalChannelWriterService",
446                        "WriteBatches",
447                    ),
448                );
449            self.inner.unary(req, path, codec).await
450        }
451    }
452}