Skip to main content

nominal_api_proto/proto/
nominal.modules.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CompileUdfRequest {
4    #[prost(string, optional, tag = "1")]
5    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
6    #[prost(message, repeated, tag = "2")]
7    pub inputs: ::prost::alloc::vec::Vec<UdfParameter>,
8    #[prost(enumeration = "UdfOutputType", tag = "3")]
9    pub output: i32,
10    #[prost(enumeration = "UdfOutputShape", tag = "4")]
11    pub output_shape: i32,
12    #[prost(message, optional, tag = "5")]
13    pub source: ::core::option::Option<UdfSource>,
14}
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct CompileUdfResponse {
17    #[prost(string, tag = "1")]
18    pub compile_key: ::prost::alloc::string::String,
19}
20#[derive(Clone, Copy, PartialEq, ::prost::Message)]
21pub struct UdfParameter {
22    #[prost(enumeration = "UdfDataType", tag = "1")]
23    pub r#type: i32,
24    #[prost(enumeration = "UdfCardinality", tag = "2")]
25    pub cardinality: i32,
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct UdfSource {
29    #[prost(oneof = "udf_source::UdfSource", tags = "1")]
30    pub udf_source: ::core::option::Option<udf_source::UdfSource>,
31}
32/// Nested message and enum types in `UdfSource`.
33pub mod udf_source {
34    #[derive(Clone, PartialEq, ::prost::Oneof)]
35    pub enum UdfSource {
36        #[prost(message, tag = "1")]
37        Rust(super::RustUdfSource),
38    }
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct RustUdfSource {
42    #[prost(string, tag = "1")]
43    pub source_code: ::prost::alloc::string::String,
44}
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
46#[repr(i32)]
47pub enum UdfDataType {
48    Unspecified = 0,
49    F64 = 1,
50    I64 = 2,
51    String = 3,
52}
53impl UdfDataType {
54    /// String value of the enum field names used in the ProtoBuf definition.
55    ///
56    /// The values are not transformed in any way and thus are considered stable
57    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
58    pub fn as_str_name(&self) -> &'static str {
59        match self {
60            Self::Unspecified => "UDF_DATA_TYPE_UNSPECIFIED",
61            Self::F64 => "UDF_DATA_TYPE_F64",
62            Self::I64 => "UDF_DATA_TYPE_I64",
63            Self::String => "UDF_DATA_TYPE_STRING",
64        }
65    }
66    /// Creates an enum from field names used in the ProtoBuf definition.
67    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
68        match value {
69            "UDF_DATA_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
70            "UDF_DATA_TYPE_F64" => Some(Self::F64),
71            "UDF_DATA_TYPE_I64" => Some(Self::I64),
72            "UDF_DATA_TYPE_STRING" => Some(Self::String),
73            _ => None,
74        }
75    }
76}
77#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
78#[repr(i32)]
79pub enum UdfCardinality {
80    Unspecified = 0,
81    Value = 1,
82    Vector = 2,
83}
84impl UdfCardinality {
85    /// String value of the enum field names used in the ProtoBuf definition.
86    ///
87    /// The values are not transformed in any way and thus are considered stable
88    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
89    pub fn as_str_name(&self) -> &'static str {
90        match self {
91            Self::Unspecified => "UDF_CARDINALITY_UNSPECIFIED",
92            Self::Value => "UDF_CARDINALITY_VALUE",
93            Self::Vector => "UDF_CARDINALITY_VECTOR",
94        }
95    }
96    /// Creates an enum from field names used in the ProtoBuf definition.
97    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
98        match value {
99            "UDF_CARDINALITY_UNSPECIFIED" => Some(Self::Unspecified),
100            "UDF_CARDINALITY_VALUE" => Some(Self::Value),
101            "UDF_CARDINALITY_VECTOR" => Some(Self::Vector),
102            _ => None,
103        }
104    }
105}
106#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
107#[repr(i32)]
108pub enum UdfOutputType {
109    Unspecified = 0,
110    Numeric = 1,
111    Enum = 2,
112}
113impl UdfOutputType {
114    /// String value of the enum field names used in the ProtoBuf definition.
115    ///
116    /// The values are not transformed in any way and thus are considered stable
117    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
118    pub fn as_str_name(&self) -> &'static str {
119        match self {
120            Self::Unspecified => "UDF_OUTPUT_TYPE_UNSPECIFIED",
121            Self::Numeric => "UDF_OUTPUT_TYPE_NUMERIC",
122            Self::Enum => "UDF_OUTPUT_TYPE_ENUM",
123        }
124    }
125    /// Creates an enum from field names used in the ProtoBuf definition.
126    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
127        match value {
128            "UDF_OUTPUT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
129            "UDF_OUTPUT_TYPE_NUMERIC" => Some(Self::Numeric),
130            "UDF_OUTPUT_TYPE_ENUM" => Some(Self::Enum),
131            _ => None,
132        }
133    }
134}
135#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
136#[repr(i32)]
137pub enum UdfOutputShape {
138    Unspecified = 0,
139    Scalar = 1,
140    TimestampedValue = 2,
141    TimestampedValues = 3,
142}
143impl UdfOutputShape {
144    /// String value of the enum field names used in the ProtoBuf definition.
145    ///
146    /// The values are not transformed in any way and thus are considered stable
147    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
148    pub fn as_str_name(&self) -> &'static str {
149        match self {
150            Self::Unspecified => "UDF_OUTPUT_SHAPE_UNSPECIFIED",
151            Self::Scalar => "UDF_OUTPUT_SHAPE_SCALAR",
152            Self::TimestampedValue => "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUE",
153            Self::TimestampedValues => "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUES",
154        }
155    }
156    /// Creates an enum from field names used in the ProtoBuf definition.
157    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
158        match value {
159            "UDF_OUTPUT_SHAPE_UNSPECIFIED" => Some(Self::Unspecified),
160            "UDF_OUTPUT_SHAPE_SCALAR" => Some(Self::Scalar),
161            "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUE" => Some(Self::TimestampedValue),
162            "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUES" => Some(Self::TimestampedValues),
163            _ => None,
164        }
165    }
166}
167/// Generated client implementations.
168pub mod udf_service_client {
169    #![allow(
170        unused_variables,
171        dead_code,
172        missing_docs,
173        clippy::wildcard_imports,
174        clippy::let_unit_value,
175    )]
176    use tonic::codegen::*;
177    use tonic::codegen::http::Uri;
178    #[derive(Debug, Clone)]
179    pub struct UdfServiceClient<T> {
180        inner: tonic::client::Grpc<T>,
181    }
182    impl UdfServiceClient<tonic::transport::Channel> {
183        /// Attempt to create a new client by connecting to a given endpoint.
184        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
185        where
186            D: TryInto<tonic::transport::Endpoint>,
187            D::Error: Into<StdError>,
188        {
189            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
190            Ok(Self::new(conn))
191        }
192    }
193    impl<T> UdfServiceClient<T>
194    where
195        T: tonic::client::GrpcService<tonic::body::Body>,
196        T::Error: Into<StdError>,
197        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
198        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
199    {
200        pub fn new(inner: T) -> Self {
201            let inner = tonic::client::Grpc::new(inner);
202            Self { inner }
203        }
204        pub fn with_origin(inner: T, origin: Uri) -> Self {
205            let inner = tonic::client::Grpc::with_origin(inner, origin);
206            Self { inner }
207        }
208        pub fn with_interceptor<F>(
209            inner: T,
210            interceptor: F,
211        ) -> UdfServiceClient<InterceptedService<T, F>>
212        where
213            F: tonic::service::Interceptor,
214            T::ResponseBody: Default,
215            T: tonic::codegen::Service<
216                http::Request<tonic::body::Body>,
217                Response = http::Response<
218                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
219                >,
220            >,
221            <T as tonic::codegen::Service<
222                http::Request<tonic::body::Body>,
223            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
224        {
225            UdfServiceClient::new(InterceptedService::new(inner, interceptor))
226        }
227        /// Compress requests with the given encoding.
228        ///
229        /// This requires the server to support it otherwise it might respond with an
230        /// error.
231        #[must_use]
232        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
233            self.inner = self.inner.send_compressed(encoding);
234            self
235        }
236        /// Enable decompressing responses.
237        #[must_use]
238        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
239            self.inner = self.inner.accept_compressed(encoding);
240            self
241        }
242        /// Limits the maximum size of a decoded message.
243        ///
244        /// Default: `4MB`
245        #[must_use]
246        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
247            self.inner = self.inner.max_decoding_message_size(limit);
248            self
249        }
250        /// Limits the maximum size of an encoded message.
251        ///
252        /// Default: `usize::MAX`
253        #[must_use]
254        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
255            self.inner = self.inner.max_encoding_message_size(limit);
256            self
257        }
258        pub async fn compile_udf(
259            &mut self,
260            request: impl tonic::IntoRequest<super::CompileUdfRequest>,
261        ) -> std::result::Result<
262            tonic::Response<super::CompileUdfResponse>,
263            tonic::Status,
264        > {
265            self.inner
266                .ready()
267                .await
268                .map_err(|e| {
269                    tonic::Status::unknown(
270                        format!("Service was not ready: {}", e.into()),
271                    )
272                })?;
273            let codec = tonic::codec::ProstCodec::default();
274            let path = http::uri::PathAndQuery::from_static(
275                "/nominal.modules.v1.UdfService/CompileUdf",
276            );
277            let mut req = request.into_request();
278            req.extensions_mut()
279                .insert(GrpcMethod::new("nominal.modules.v1.UdfService", "CompileUdf"));
280            self.inner.unary(req, path, codec).await
281        }
282    }
283}