nominal_api/proto/
nominal.direct_channel_writer.v2.rs

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