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