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, Copy, PartialEq, ::prost::Message)]
122pub struct WriteBatchesResponse {}
123/// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
124#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
125#[repr(i32)]
126pub enum NominalDirectChannelWriterError {
127    DataSourceNotFound = 0,
128    DataSourcesNotFound = 1,
129    InvalidNominalDataSource = 2,
130    /// The requested data source already exists.
131    NominalDataSourceConflict = 3,
132    /// Array size exceeds maximum allowed length.
133    ArrayTooLarge = 4,
134    /// Found two different data types for the same series in the request.
135    ConflictingDataTypes = 5,
136    /// The nominal data source or dataset provided is invalid.
137    InvalidDataSource = 6,
138    InvalidTelegrafTimestamp = 7,
139    InvalidTimestamp = 8,
140    /// Columnar streaming request contains different numbers of timestamps and values
141    MismatchedTimestampsAndValues = 9,
142    /// Unsupported dataset for streaming.
143    StreamingDisabledOnDataset = 10,
144    /// The provided Range is invalid because the start time is greater than the end time.
145    InvalidRange = 11,
146    /// The provided Points type is not set.
147    PointsTypeNotSet = 12,
148    /// The provided ArrayPoints type is not set.
149    ArrayPointsTypeNotSet = 13,
150    /// Not authorized to write to the specified data source.
151    NotAuthorized = 14,
152}
153impl NominalDirectChannelWriterError {
154    /// String value of the enum field names used in the ProtoBuf definition.
155    ///
156    /// The values are not transformed in any way and thus are considered stable
157    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
158    pub fn as_str_name(&self) -> &'static str {
159        match self {
160            Self::DataSourceNotFound => {
161                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCE_NOT_FOUND"
162            }
163            Self::DataSourcesNotFound => {
164                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCES_NOT_FOUND"
165            }
166            Self::InvalidNominalDataSource => {
167                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_NOMINAL_DATA_SOURCE"
168            }
169            Self::NominalDataSourceConflict => {
170                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOMINAL_DATA_SOURCE_CONFLICT"
171            }
172            Self::ArrayTooLarge => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_TOO_LARGE",
173            Self::ConflictingDataTypes => {
174                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_CONFLICTING_DATA_TYPES"
175            }
176            Self::InvalidDataSource => {
177                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_DATA_SOURCE"
178            }
179            Self::InvalidTelegrafTimestamp => {
180                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TELEGRAF_TIMESTAMP"
181            }
182            Self::InvalidTimestamp => {
183                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TIMESTAMP"
184            }
185            Self::MismatchedTimestampsAndValues => {
186                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_MISMATCHED_TIMESTAMPS_AND_VALUES"
187            }
188            Self::StreamingDisabledOnDataset => {
189                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_STREAMING_DISABLED_ON_DATASET"
190            }
191            Self::InvalidRange => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_RANGE",
192            Self::PointsTypeNotSet => {
193                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_POINTS_TYPE_NOT_SET"
194            }
195            Self::ArrayPointsTypeNotSet => {
196                "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_POINTS_TYPE_NOT_SET"
197            }
198            Self::NotAuthorized => "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOT_AUTHORIZED",
199        }
200    }
201    /// Creates an enum from field names used in the ProtoBuf definition.
202    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
203        match value {
204            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCE_NOT_FOUND" => {
205                Some(Self::DataSourceNotFound)
206            }
207            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_DATA_SOURCES_NOT_FOUND" => {
208                Some(Self::DataSourcesNotFound)
209            }
210            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_NOMINAL_DATA_SOURCE" => {
211                Some(Self::InvalidNominalDataSource)
212            }
213            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOMINAL_DATA_SOURCE_CONFLICT" => {
214                Some(Self::NominalDataSourceConflict)
215            }
216            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_TOO_LARGE" => {
217                Some(Self::ArrayTooLarge)
218            }
219            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_CONFLICTING_DATA_TYPES" => {
220                Some(Self::ConflictingDataTypes)
221            }
222            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_DATA_SOURCE" => {
223                Some(Self::InvalidDataSource)
224            }
225            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TELEGRAF_TIMESTAMP" => {
226                Some(Self::InvalidTelegrafTimestamp)
227            }
228            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_TIMESTAMP" => {
229                Some(Self::InvalidTimestamp)
230            }
231            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_MISMATCHED_TIMESTAMPS_AND_VALUES" => {
232                Some(Self::MismatchedTimestampsAndValues)
233            }
234            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_STREAMING_DISABLED_ON_DATASET" => {
235                Some(Self::StreamingDisabledOnDataset)
236            }
237            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_INVALID_RANGE" => {
238                Some(Self::InvalidRange)
239            }
240            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_POINTS_TYPE_NOT_SET" => {
241                Some(Self::PointsTypeNotSet)
242            }
243            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_ARRAY_POINTS_TYPE_NOT_SET" => {
244                Some(Self::ArrayPointsTypeNotSet)
245            }
246            "NOMINAL_DIRECT_CHANNEL_WRITER_ERROR_NOT_AUTHORIZED" => {
247                Some(Self::NotAuthorized)
248            }
249            _ => None,
250        }
251    }
252}
253/// Generated client implementations.
254pub mod direct_nominal_channel_writer_service_client {
255    #![allow(
256        unused_variables,
257        dead_code,
258        missing_docs,
259        clippy::wildcard_imports,
260        clippy::let_unit_value,
261    )]
262    use tonic::codegen::*;
263    use tonic::codegen::http::Uri;
264    /// Writes data points directly to Nominal's managed database offering.
265    #[derive(Debug, Clone)]
266    pub struct DirectNominalChannelWriterServiceClient<T> {
267        inner: tonic::client::Grpc<T>,
268    }
269    impl DirectNominalChannelWriterServiceClient<tonic::transport::Channel> {
270        /// Attempt to create a new client by connecting to a given endpoint.
271        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
272        where
273            D: TryInto<tonic::transport::Endpoint>,
274            D::Error: Into<StdError>,
275        {
276            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
277            Ok(Self::new(conn))
278        }
279    }
280    impl<T> DirectNominalChannelWriterServiceClient<T>
281    where
282        T: tonic::client::GrpcService<tonic::body::Body>,
283        T::Error: Into<StdError>,
284        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
285        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
286    {
287        pub fn new(inner: T) -> Self {
288            let inner = tonic::client::Grpc::new(inner);
289            Self { inner }
290        }
291        pub fn with_origin(inner: T, origin: Uri) -> Self {
292            let inner = tonic::client::Grpc::with_origin(inner, origin);
293            Self { inner }
294        }
295        pub fn with_interceptor<F>(
296            inner: T,
297            interceptor: F,
298        ) -> DirectNominalChannelWriterServiceClient<InterceptedService<T, F>>
299        where
300            F: tonic::service::Interceptor,
301            T::ResponseBody: Default,
302            T: tonic::codegen::Service<
303                http::Request<tonic::body::Body>,
304                Response = http::Response<
305                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
306                >,
307            >,
308            <T as tonic::codegen::Service<
309                http::Request<tonic::body::Body>,
310            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
311        {
312            DirectNominalChannelWriterServiceClient::new(
313                InterceptedService::new(inner, interceptor),
314            )
315        }
316        /// Compress requests with the given encoding.
317        ///
318        /// This requires the server to support it otherwise it might respond with an
319        /// error.
320        #[must_use]
321        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
322            self.inner = self.inner.send_compressed(encoding);
323            self
324        }
325        /// Enable decompressing responses.
326        #[must_use]
327        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
328            self.inner = self.inner.accept_compressed(encoding);
329            self
330        }
331        /// Limits the maximum size of a decoded message.
332        ///
333        /// Default: `4MB`
334        #[must_use]
335        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
336            self.inner = self.inner.max_decoding_message_size(limit);
337            self
338        }
339        /// Limits the maximum size of an encoded message.
340        ///
341        /// Default: `usize::MAX`
342        #[must_use]
343        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
344            self.inner = self.inner.max_encoding_message_size(limit);
345            self
346        }
347        /// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
348        /// Synchronously writes batches of records to a Nominal data source. This endpoint bypasses the
349        /// Channel Writer service entirely, and should only be used if the implications are well understood.
350        ///
351        /// If you call this endpoint, writes will go directly into Nominal DB and will not be placed in Nominal's
352        /// durable queue. This results in lower latency, but also consequently lower durability.
353        pub async fn write_batches(
354            &mut self,
355            request: impl tonic::IntoRequest<super::WriteBatchesRequest>,
356        ) -> std::result::Result<
357            tonic::Response<super::WriteBatchesResponse>,
358            tonic::Status,
359        > {
360            self.inner
361                .ready()
362                .await
363                .map_err(|e| {
364                    tonic::Status::unknown(
365                        format!("Service was not ready: {}", e.into()),
366                    )
367                })?;
368            let codec = tonic::codec::ProstCodec::default();
369            let path = http::uri::PathAndQuery::from_static(
370                "/nominal.direct_channel_writer.v2.DirectNominalChannelWriterService/WriteBatches",
371            );
372            let mut req = request.into_request();
373            req.extensions_mut()
374                .insert(
375                    GrpcMethod::new(
376                        "nominal.direct_channel_writer.v2.DirectNominalChannelWriterService",
377                        "WriteBatches",
378                    ),
379                );
380            self.inner.unary(req, path, codec).await
381        }
382    }
383}