nominal_api/proto/
nominal.connections.v1.rs

1// This file is @generated by prost-build.
2/// Picosecond precision timestamp type, represented by an epoch time in seconds, a nanosecond offset, and optional
3/// picosecond offset. The nanosecond offset is from the start of the epoch second, so must be less than 1 billion. The
4/// optional picosecond offset is only used for picosecond-precision data sources and is from the start of the
5/// nanosecond, so must be less than 1000.
6#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7pub struct Timestamp {
8    #[prost(int64, tag = "1")]
9    pub seconds: i64,
10    #[prost(int64, tag = "2")]
11    pub nanos: i64,
12    #[prost(int32, tag = "3")]
13    pub picos: i32,
14}
15#[derive(Clone, Copy, PartialEq, ::prost::Message)]
16pub struct Range {
17    #[prost(message, optional, tag = "1")]
18    pub start_time_inclusive: ::core::option::Option<Timestamp>,
19    #[prost(message, optional, tag = "2")]
20    pub end_time_exclusive: ::core::option::Option<Timestamp>,
21}
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct TagValues {
24    /// All the allowed values the tag can have. Tag values are opaque and will be passed back to the server in future
25    /// calls. The values are expected to be unique.
26    #[prost(string, repeated, tag = "1")]
27    pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
28}
29#[derive(Clone, PartialEq, ::prost::Message)]
30pub struct ChannelMetadata {
31    /// Channels are opaque values that will be passed back to the server in future calls.
32    #[prost(string, tag = "1")]
33    pub channel: ::prost::alloc::string::String,
34    /// Every value in the channel is expected to have the same type.
35    #[prost(enumeration = "DataType", tag = "2")]
36    pub data_type: i32,
37    /// All the possible tags and their values associated with the channel.
38    #[prost(map = "string, message", tag = "3")]
39    pub all_tag_values: ::std::collections::HashMap<
40        ::prost::alloc::string::String,
41        TagValues,
42    >,
43}
44#[derive(Clone, PartialEq, ::prost::Message)]
45pub struct ListChannelsRequest {
46    /// The max number of elements returned in the response, the actual number can be lower but should never exceed this.
47    #[prost(int32, tag = "1")]
48    pub page_size: i32,
49    /// The time range for which we want to see channels which exist
50    #[prost(message, optional, tag = "2")]
51    pub range: ::core::option::Option<Range>,
52    /// Where to continue paging from in subsequent requests. This will be empty on the first call.
53    #[prost(string, optional, tag = "3")]
54    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct ListChannelsResponse {
58    #[prost(message, repeated, tag = "1")]
59    pub channels: ::prost::alloc::vec::Vec<ChannelMetadata>,
60    #[prost(string, optional, tag = "2")]
61    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
62}
63#[derive(Clone, PartialEq, ::prost::Message)]
64pub struct QueryChannelRequest {
65    /// The channel should be a value that was previously returned by a ListChannels call.
66    #[prost(string, tag = "1")]
67    pub channel: ::prost::alloc::string::String,
68    /// The tag name/value pairs to filter on.
69    #[prost(map = "string, string", tag = "2")]
70    pub tags: ::std::collections::HashMap<
71        ::prost::alloc::string::String,
72        ::prost::alloc::string::String,
73    >,
74    /// The time range to filter on.
75    #[prost(message, optional, tag = "3")]
76    pub range: ::core::option::Option<Range>,
77}
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct IntPoints {
80    #[prost(message, repeated, tag = "1")]
81    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
82    #[prost(int64, repeated, tag = "2")]
83    pub values: ::prost::alloc::vec::Vec<i64>,
84}
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct DoublePoints {
87    #[prost(message, repeated, tag = "1")]
88    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
89    #[prost(double, repeated, tag = "2")]
90    pub values: ::prost::alloc::vec::Vec<f64>,
91}
92#[derive(Clone, PartialEq, ::prost::Message)]
93pub struct StringPoints {
94    #[prost(message, repeated, tag = "1")]
95    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
96    #[prost(string, repeated, tag = "2")]
97    pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
98}
99#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct QueryChannelResponse {
101    #[prost(oneof = "query_channel_response::Values", tags = "1, 2, 3")]
102    pub values: ::core::option::Option<query_channel_response::Values>,
103}
104/// Nested message and enum types in `QueryChannelResponse`.
105pub mod query_channel_response {
106    #[derive(Clone, PartialEq, ::prost::Oneof)]
107    pub enum Values {
108        #[prost(message, tag = "1")]
109        Ints(super::IntPoints),
110        #[prost(message, tag = "2")]
111        Doubles(super::DoublePoints),
112        #[prost(message, tag = "3")]
113        Strings(super::StringPoints),
114    }
115}
116#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
117#[repr(i32)]
118pub enum DataType {
119    Unspecified = 0,
120    Int = 1,
121    Double = 2,
122    String = 3,
123}
124impl DataType {
125    /// String value of the enum field names used in the ProtoBuf definition.
126    ///
127    /// The values are not transformed in any way and thus are considered stable
128    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
129    pub fn as_str_name(&self) -> &'static str {
130        match self {
131            Self::Unspecified => "DATA_TYPE_UNSPECIFIED",
132            Self::Int => "DATA_TYPE_INT",
133            Self::Double => "DATA_TYPE_DOUBLE",
134            Self::String => "DATA_TYPE_STRING",
135        }
136    }
137    /// Creates an enum from field names used in the ProtoBuf definition.
138    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
139        match value {
140            "DATA_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
141            "DATA_TYPE_INT" => Some(Self::Int),
142            "DATA_TYPE_DOUBLE" => Some(Self::Double),
143            "DATA_TYPE_STRING" => Some(Self::String),
144            _ => None,
145        }
146    }
147}
148/// Generated client implementations.
149pub mod connections_service_client {
150    #![allow(
151        unused_variables,
152        dead_code,
153        missing_docs,
154        clippy::wildcard_imports,
155        clippy::let_unit_value,
156    )]
157    use tonic::codegen::*;
158    use tonic::codegen::http::Uri;
159    /// *
160    /// Defines the interface for how Nominal expects to interact with custom connection implementations. All sources of
161    /// time series data is abstracted by a channel identifier, allowing for flexibility of the underlying data source
162    /// implementations.
163    ///
164    /// The authorization credentials are passed as http headers as:
165    ///     "Authorization: Bearer <token>"
166    #[derive(Debug, Clone)]
167    pub struct ConnectionsServiceClient<T> {
168        inner: tonic::client::Grpc<T>,
169    }
170    impl ConnectionsServiceClient<tonic::transport::Channel> {
171        /// Attempt to create a new client by connecting to a given endpoint.
172        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
173        where
174            D: TryInto<tonic::transport::Endpoint>,
175            D::Error: Into<StdError>,
176        {
177            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
178            Ok(Self::new(conn))
179        }
180    }
181    impl<T> ConnectionsServiceClient<T>
182    where
183        T: tonic::client::GrpcService<tonic::body::Body>,
184        T::Error: Into<StdError>,
185        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
186        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
187    {
188        pub fn new(inner: T) -> Self {
189            let inner = tonic::client::Grpc::new(inner);
190            Self { inner }
191        }
192        pub fn with_origin(inner: T, origin: Uri) -> Self {
193            let inner = tonic::client::Grpc::with_origin(inner, origin);
194            Self { inner }
195        }
196        pub fn with_interceptor<F>(
197            inner: T,
198            interceptor: F,
199        ) -> ConnectionsServiceClient<InterceptedService<T, F>>
200        where
201            F: tonic::service::Interceptor,
202            T::ResponseBody: Default,
203            T: tonic::codegen::Service<
204                http::Request<tonic::body::Body>,
205                Response = http::Response<
206                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
207                >,
208            >,
209            <T as tonic::codegen::Service<
210                http::Request<tonic::body::Body>,
211            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
212        {
213            ConnectionsServiceClient::new(InterceptedService::new(inner, interceptor))
214        }
215        /// Compress requests with the given encoding.
216        ///
217        /// This requires the server to support it otherwise it might respond with an
218        /// error.
219        #[must_use]
220        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
221            self.inner = self.inner.send_compressed(encoding);
222            self
223        }
224        /// Enable decompressing responses.
225        #[must_use]
226        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
227            self.inner = self.inner.accept_compressed(encoding);
228            self
229        }
230        /// Limits the maximum size of a decoded message.
231        ///
232        /// Default: `4MB`
233        #[must_use]
234        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
235            self.inner = self.inner.max_decoding_message_size(limit);
236            self
237        }
238        /// Limits the maximum size of an encoded message.
239        ///
240        /// Default: `usize::MAX`
241        #[must_use]
242        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
243            self.inner = self.inner.max_encoding_message_size(limit);
244            self
245        }
246        /// *
247        /// Paging endpoint to list all the channels and their allowed tag values. Callers should expect that more results are
248        /// available as long as ListChannelsResponse continues to return a pageToken and will pass in this pageToken in the
249        /// next ListChannelsRequest.
250        pub async fn list_channels(
251            &mut self,
252            request: impl tonic::IntoRequest<super::ListChannelsRequest>,
253        ) -> std::result::Result<
254            tonic::Response<super::ListChannelsResponse>,
255            tonic::Status,
256        > {
257            self.inner
258                .ready()
259                .await
260                .map_err(|e| {
261                    tonic::Status::unknown(
262                        format!("Service was not ready: {}", e.into()),
263                    )
264                })?;
265            let codec = tonic::codec::ProstCodec::default();
266            let path = http::uri::PathAndQuery::from_static(
267                "/nominal.connections.v1.ConnectionsService/ListChannels",
268            );
269            let mut req = request.into_request();
270            req.extensions_mut()
271                .insert(
272                    GrpcMethod::new(
273                        "nominal.connections.v1.ConnectionsService",
274                        "ListChannels",
275                    ),
276                );
277            self.inner.unary(req, path, codec).await
278        }
279        /// *
280        /// Endpoint to query a given channel for time series data for a given set of tags and time range. The response is a
281        /// stream of points.
282        pub async fn query_channel(
283            &mut self,
284            request: impl tonic::IntoRequest<super::QueryChannelRequest>,
285        ) -> std::result::Result<
286            tonic::Response<tonic::codec::Streaming<super::QueryChannelResponse>>,
287            tonic::Status,
288        > {
289            self.inner
290                .ready()
291                .await
292                .map_err(|e| {
293                    tonic::Status::unknown(
294                        format!("Service was not ready: {}", e.into()),
295                    )
296                })?;
297            let codec = tonic::codec::ProstCodec::default();
298            let path = http::uri::PathAndQuery::from_static(
299                "/nominal.connections.v1.ConnectionsService/QueryChannel",
300            );
301            let mut req = request.into_request();
302            req.extensions_mut()
303                .insert(
304                    GrpcMethod::new(
305                        "nominal.connections.v1.ConnectionsService",
306                        "QueryChannel",
307                    ),
308                );
309            self.inner.server_streaming(req, path, codec).await
310        }
311    }
312}