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