mz_storage_client/mnt/build/debug/build/mz-storage-client-5a9c457b271815d4/out/
mz_storage_client.client.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ProtoCompaction {
4    #[prost(message, optional, tag = "1")]
5    pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
6    #[prost(message, optional, tag = "2")]
7    pub frontier: ::core::option::Option<::mz_repr::antichain::ProtoU64Antichain>,
8}
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct ProtoAllowCompaction {
11    #[prost(message, repeated, tag = "1")]
12    pub collections: ::prost::alloc::vec::Vec<ProtoCompaction>,
13}
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct ProtoRunIngestionCommand {
16    #[prost(message, optional, tag = "1")]
17    pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
18    #[prost(message, optional, tag = "2")]
19    pub description: ::core::option::Option<
20        ::mz_storage_types::sources::ProtoIngestionDescription,
21    >,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct ProtoRunOneshotIngestion {
25    #[prost(message, optional, tag = "1")]
26    pub ingestion_id: ::core::option::Option<::mz_proto::ProtoU128>,
27    #[prost(message, optional, tag = "2")]
28    pub collection_id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
29    #[prost(message, optional, tag = "3")]
30    pub storage_metadata: ::core::option::Option<
31        ::mz_storage_types::controller::ProtoCollectionMetadata,
32    >,
33    #[prost(message, optional, tag = "4")]
34    pub request: ::core::option::Option<
35        ::mz_storage_types::oneshot_sources::ProtoOneshotIngestionRequest,
36    >,
37}
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct ProtoRunOneshotIngestionsCommand {
40    #[prost(message, repeated, tag = "1")]
41    pub ingestions: ::prost::alloc::vec::Vec<ProtoRunOneshotIngestion>,
42}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct ProtoCancelOneshotIngestionsCommand {
45    #[prost(message, repeated, tag = "1")]
46    pub ingestions: ::prost::alloc::vec::Vec<::mz_proto::ProtoU128>,
47}
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct ProtoCreateSources {
50    #[prost(message, repeated, tag = "1")]
51    pub sources: ::prost::alloc::vec::Vec<ProtoRunIngestionCommand>,
52}
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct ProtoRunSinkCommand {
55    #[prost(message, optional, tag = "1")]
56    pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
57    #[prost(message, optional, tag = "2")]
58    pub description: ::core::option::Option<
59        ::mz_storage_types::sinks::ProtoStorageSinkDesc,
60    >,
61}
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct ProtoRunSinks {
64    #[prost(message, repeated, tag = "1")]
65    pub sinks: ::prost::alloc::vec::Vec<ProtoRunSinkCommand>,
66}
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct ProtoFrontierUppersKind {
69    #[prost(message, repeated, tag = "1")]
70    pub traces: ::prost::alloc::vec::Vec<ProtoTrace>,
71}
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct ProtoTrace {
74    #[prost(message, optional, tag = "1")]
75    pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
76    #[prost(message, optional, tag = "2")]
77    pub upper: ::core::option::Option<::mz_repr::antichain::ProtoU64Antichain>,
78}
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct ProtoStorageCommand {
81    #[prost(oneof = "proto_storage_command::Kind", tags = "6, 1, 2, 3, 7, 4, 5, 10, 11")]
82    pub kind: ::core::option::Option<proto_storage_command::Kind>,
83}
84/// Nested message and enum types in `ProtoStorageCommand`.
85pub mod proto_storage_command {
86    #[derive(Clone, PartialEq, ::prost::Message)]
87    pub struct ProtoCreateTimely {
88        #[prost(message, optional, tag = "1")]
89        pub config: ::core::option::Option<
90            ::mz_cluster_client::client::ProtoTimelyConfig,
91        >,
92        #[prost(message, optional, tag = "2")]
93        pub epoch: ::core::option::Option<
94            ::mz_cluster_client::client::ProtoClusterStartupEpoch,
95        >,
96    }
97    #[derive(Clone, PartialEq, ::prost::Oneof)]
98    pub enum Kind {
99        #[prost(message, tag = "6")]
100        CreateTimely(ProtoCreateTimely),
101        #[prost(message, tag = "1")]
102        CreateSources(super::ProtoCreateSources),
103        #[prost(message, tag = "2")]
104        AllowCompaction(super::ProtoAllowCompaction),
105        #[prost(message, tag = "3")]
106        InitializationComplete(()),
107        #[prost(message, tag = "7")]
108        AllowWrites(()),
109        #[prost(message, tag = "4")]
110        RunSinks(super::ProtoRunSinks),
111        #[prost(message, tag = "5")]
112        UpdateConfiguration(::mz_storage_types::parameters::ProtoStorageParameters),
113        #[prost(message, tag = "10")]
114        RunOneshotIngestions(super::ProtoRunOneshotIngestionsCommand),
115        #[prost(message, tag = "11")]
116        CancelOneshotIngestions(super::ProtoCancelOneshotIngestionsCommand),
117    }
118}
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct ProtoStorageResponse {
121    #[prost(oneof = "proto_storage_response::Kind", tags = "1, 2, 3, 4, 5")]
122    pub kind: ::core::option::Option<proto_storage_response::Kind>,
123}
124/// Nested message and enum types in `ProtoStorageResponse`.
125pub mod proto_storage_response {
126    #[derive(Clone, PartialEq, ::prost::Message)]
127    pub struct ProtoStatisticsUpdates {
128        #[prost(message, repeated, tag = "1")]
129        pub source_updates: ::prost::alloc::vec::Vec<
130            super::super::statistics::ProtoSourceStatisticsUpdate,
131        >,
132        #[prost(message, repeated, tag = "2")]
133        pub sink_updates: ::prost::alloc::vec::Vec<
134            super::super::statistics::ProtoSinkStatisticsUpdate,
135        >,
136    }
137    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
138    pub struct ProtoStatus {
139        #[prost(oneof = "proto_status::Kind", tags = "1, 2, 3, 4, 5, 6")]
140        pub kind: ::core::option::Option<proto_status::Kind>,
141    }
142    /// Nested message and enum types in `ProtoStatus`.
143    pub mod proto_status {
144        #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
145        pub enum Kind {
146            #[prost(message, tag = "1")]
147            Starting(()),
148            #[prost(message, tag = "2")]
149            Running(()),
150            #[prost(message, tag = "3")]
151            Paused(()),
152            #[prost(message, tag = "4")]
153            Stalled(()),
154            #[prost(message, tag = "5")]
155            Ceased(()),
156            #[prost(message, tag = "6")]
157            Dropped(()),
158        }
159    }
160    #[derive(Clone, PartialEq, ::prost::Message)]
161    pub struct ProtoStatusUpdate {
162        #[prost(message, optional, tag = "1")]
163        pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
164        #[prost(message, optional, tag = "2")]
165        pub status: ::core::option::Option<ProtoStatus>,
166        #[prost(message, optional, tag = "3")]
167        pub timestamp: ::core::option::Option<::mz_proto::chrono::ProtoNaiveDateTime>,
168        #[prost(string, optional, tag = "4")]
169        pub error: ::core::option::Option<::prost::alloc::string::String>,
170        #[prost(string, repeated, tag = "5")]
171        pub hints: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
172        #[prost(btree_map = "string, string", tag = "6")]
173        pub namespaced_errors: ::prost::alloc::collections::BTreeMap<
174            ::prost::alloc::string::String,
175            ::prost::alloc::string::String,
176        >,
177        #[prost(string, optional, tag = "7")]
178        pub replica_id: ::core::option::Option<::prost::alloc::string::String>,
179    }
180    #[derive(Clone, PartialEq, ::prost::Message)]
181    pub struct ProtoStatusUpdates {
182        #[prost(message, repeated, tag = "1")]
183        pub updates: ::prost::alloc::vec::Vec<ProtoStatusUpdate>,
184    }
185    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
186    pub struct ProtoDroppedId {
187        #[prost(message, optional, tag = "1")]
188        pub id: ::core::option::Option<::mz_repr::global_id::ProtoGlobalId>,
189    }
190    #[derive(Clone, PartialEq, ::prost::Message)]
191    pub struct ProtoStagedBatches {
192        #[prost(message, repeated, tag = "1")]
193        pub batches: ::prost::alloc::vec::Vec<proto_staged_batches::Inner>,
194    }
195    /// Nested message and enum types in `ProtoStagedBatches`.
196    pub mod proto_staged_batches {
197        #[derive(Clone, PartialEq, ::prost::Message)]
198        pub struct BatchResult {
199            #[prost(oneof = "batch_result::Value", tags = "1, 2")]
200            pub value: ::core::option::Option<batch_result::Value>,
201        }
202        /// Nested message and enum types in `BatchResult`.
203        pub mod batch_result {
204            #[derive(Clone, PartialEq, ::prost::Oneof)]
205            pub enum Value {
206                #[prost(message, tag = "1")]
207                Batch(::mz_persist_client::batch::ProtoBatch),
208                #[prost(string, tag = "2")]
209                Error(::prost::alloc::string::String),
210            }
211        }
212        #[derive(Clone, PartialEq, ::prost::Message)]
213        pub struct Inner {
214            #[prost(message, optional, tag = "1")]
215            pub id: ::core::option::Option<::mz_proto::ProtoU128>,
216            #[prost(message, repeated, tag = "2")]
217            pub batches: ::prost::alloc::vec::Vec<BatchResult>,
218        }
219    }
220    #[derive(Clone, PartialEq, ::prost::Oneof)]
221    pub enum Kind {
222        #[prost(message, tag = "1")]
223        FrontierUppers(super::ProtoFrontierUppersKind),
224        #[prost(message, tag = "2")]
225        DroppedId(ProtoDroppedId),
226        #[prost(message, tag = "3")]
227        Stats(ProtoStatisticsUpdates),
228        #[prost(message, tag = "4")]
229        StatusUpdates(ProtoStatusUpdates),
230        #[prost(message, tag = "5")]
231        StagedBatches(ProtoStagedBatches),
232    }
233}
234/// Generated client implementations.
235pub mod proto_storage_client {
236    #![allow(
237        unused_variables,
238        dead_code,
239        missing_docs,
240        clippy::wildcard_imports,
241        clippy::let_unit_value,
242    )]
243    use tonic::codegen::*;
244    use tonic::codegen::http::Uri;
245    #[derive(Debug, Clone)]
246    pub struct ProtoStorageClient<T> {
247        inner: tonic::client::Grpc<T>,
248    }
249    impl ProtoStorageClient<tonic::transport::Channel> {
250        /// Attempt to create a new client by connecting to a given endpoint.
251        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
252        where
253            D: TryInto<tonic::transport::Endpoint>,
254            D::Error: Into<StdError>,
255        {
256            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
257            Ok(Self::new(conn))
258        }
259    }
260    impl<T> ProtoStorageClient<T>
261    where
262        T: tonic::client::GrpcService<tonic::body::BoxBody>,
263        T::Error: Into<StdError>,
264        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
265        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
266    {
267        pub fn new(inner: T) -> Self {
268            let inner = tonic::client::Grpc::new(inner);
269            Self { inner }
270        }
271        pub fn with_origin(inner: T, origin: Uri) -> Self {
272            let inner = tonic::client::Grpc::with_origin(inner, origin);
273            Self { inner }
274        }
275        pub fn with_interceptor<F>(
276            inner: T,
277            interceptor: F,
278        ) -> ProtoStorageClient<InterceptedService<T, F>>
279        where
280            F: tonic::service::Interceptor,
281            T::ResponseBody: Default,
282            T: tonic::codegen::Service<
283                http::Request<tonic::body::BoxBody>,
284                Response = http::Response<
285                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
286                >,
287            >,
288            <T as tonic::codegen::Service<
289                http::Request<tonic::body::BoxBody>,
290            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
291        {
292            ProtoStorageClient::new(InterceptedService::new(inner, interceptor))
293        }
294        /// Compress requests with the given encoding.
295        ///
296        /// This requires the server to support it otherwise it might respond with an
297        /// error.
298        #[must_use]
299        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
300            self.inner = self.inner.send_compressed(encoding);
301            self
302        }
303        /// Enable decompressing responses.
304        #[must_use]
305        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
306            self.inner = self.inner.accept_compressed(encoding);
307            self
308        }
309        /// Limits the maximum size of a decoded message.
310        ///
311        /// Default: `4MB`
312        #[must_use]
313        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
314            self.inner = self.inner.max_decoding_message_size(limit);
315            self
316        }
317        /// Limits the maximum size of an encoded message.
318        ///
319        /// Default: `usize::MAX`
320        #[must_use]
321        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
322            self.inner = self.inner.max_encoding_message_size(limit);
323            self
324        }
325        pub async fn command_response_stream(
326            &mut self,
327            request: impl tonic::IntoStreamingRequest<
328                Message = super::ProtoStorageCommand,
329            >,
330        ) -> std::result::Result<
331            tonic::Response<tonic::codec::Streaming<super::ProtoStorageResponse>>,
332            tonic::Status,
333        > {
334            self.inner
335                .ready()
336                .await
337                .map_err(|e| {
338                    tonic::Status::unknown(
339                        format!("Service was not ready: {}", e.into()),
340                    )
341                })?;
342            let codec = tonic::codec::ProstCodec::default();
343            let path = http::uri::PathAndQuery::from_static(
344                "/mz_storage_client.client.ProtoStorage/CommandResponseStream",
345            );
346            let mut req = request.into_streaming_request();
347            req.extensions_mut()
348                .insert(
349                    GrpcMethod::new(
350                        "mz_storage_client.client.ProtoStorage",
351                        "CommandResponseStream",
352                    ),
353                );
354            self.inner.streaming(req, path, codec).await
355        }
356    }
357}
358/// Generated server implementations.
359pub mod proto_storage_server {
360    #![allow(
361        unused_variables,
362        dead_code,
363        missing_docs,
364        clippy::wildcard_imports,
365        clippy::let_unit_value,
366    )]
367    use tonic::codegen::*;
368    /// Generated trait containing gRPC methods that should be implemented for use with ProtoStorageServer.
369    #[async_trait]
370    pub trait ProtoStorage: std::marker::Send + std::marker::Sync + 'static {
371        /// Server streaming response type for the CommandResponseStream method.
372        type CommandResponseStreamStream: tonic::codegen::tokio_stream::Stream<
373                Item = std::result::Result<super::ProtoStorageResponse, tonic::Status>,
374            >
375            + std::marker::Send
376            + 'static;
377        async fn command_response_stream(
378            &self,
379            request: tonic::Request<tonic::Streaming<super::ProtoStorageCommand>>,
380        ) -> std::result::Result<
381            tonic::Response<Self::CommandResponseStreamStream>,
382            tonic::Status,
383        >;
384    }
385    #[derive(Debug)]
386    pub struct ProtoStorageServer<T> {
387        inner: Arc<T>,
388        accept_compression_encodings: EnabledCompressionEncodings,
389        send_compression_encodings: EnabledCompressionEncodings,
390        max_decoding_message_size: Option<usize>,
391        max_encoding_message_size: Option<usize>,
392    }
393    impl<T> ProtoStorageServer<T> {
394        pub fn new(inner: T) -> Self {
395            Self::from_arc(Arc::new(inner))
396        }
397        pub fn from_arc(inner: Arc<T>) -> Self {
398            Self {
399                inner,
400                accept_compression_encodings: Default::default(),
401                send_compression_encodings: Default::default(),
402                max_decoding_message_size: None,
403                max_encoding_message_size: None,
404            }
405        }
406        pub fn with_interceptor<F>(
407            inner: T,
408            interceptor: F,
409        ) -> InterceptedService<Self, F>
410        where
411            F: tonic::service::Interceptor,
412        {
413            InterceptedService::new(Self::new(inner), interceptor)
414        }
415        /// Enable decompressing requests with the given encoding.
416        #[must_use]
417        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
418            self.accept_compression_encodings.enable(encoding);
419            self
420        }
421        /// Compress responses with the given encoding, if the client supports it.
422        #[must_use]
423        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
424            self.send_compression_encodings.enable(encoding);
425            self
426        }
427        /// Limits the maximum size of a decoded message.
428        ///
429        /// Default: `4MB`
430        #[must_use]
431        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
432            self.max_decoding_message_size = Some(limit);
433            self
434        }
435        /// Limits the maximum size of an encoded message.
436        ///
437        /// Default: `usize::MAX`
438        #[must_use]
439        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
440            self.max_encoding_message_size = Some(limit);
441            self
442        }
443    }
444    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProtoStorageServer<T>
445    where
446        T: ProtoStorage,
447        B: Body + std::marker::Send + 'static,
448        B::Error: Into<StdError> + std::marker::Send + 'static,
449    {
450        type Response = http::Response<tonic::body::BoxBody>;
451        type Error = std::convert::Infallible;
452        type Future = BoxFuture<Self::Response, Self::Error>;
453        fn poll_ready(
454            &mut self,
455            _cx: &mut Context<'_>,
456        ) -> Poll<std::result::Result<(), Self::Error>> {
457            Poll::Ready(Ok(()))
458        }
459        fn call(&mut self, req: http::Request<B>) -> Self::Future {
460            match req.uri().path() {
461                "/mz_storage_client.client.ProtoStorage/CommandResponseStream" => {
462                    #[allow(non_camel_case_types)]
463                    struct CommandResponseStreamSvc<T: ProtoStorage>(pub Arc<T>);
464                    impl<
465                        T: ProtoStorage,
466                    > tonic::server::StreamingService<super::ProtoStorageCommand>
467                    for CommandResponseStreamSvc<T> {
468                        type Response = super::ProtoStorageResponse;
469                        type ResponseStream = T::CommandResponseStreamStream;
470                        type Future = BoxFuture<
471                            tonic::Response<Self::ResponseStream>,
472                            tonic::Status,
473                        >;
474                        fn call(
475                            &mut self,
476                            request: tonic::Request<
477                                tonic::Streaming<super::ProtoStorageCommand>,
478                            >,
479                        ) -> Self::Future {
480                            let inner = Arc::clone(&self.0);
481                            let fut = async move {
482                                <T as ProtoStorage>::command_response_stream(
483                                        &inner,
484                                        request,
485                                    )
486                                    .await
487                            };
488                            Box::pin(fut)
489                        }
490                    }
491                    let accept_compression_encodings = self.accept_compression_encodings;
492                    let send_compression_encodings = self.send_compression_encodings;
493                    let max_decoding_message_size = self.max_decoding_message_size;
494                    let max_encoding_message_size = self.max_encoding_message_size;
495                    let inner = self.inner.clone();
496                    let fut = async move {
497                        let method = CommandResponseStreamSvc(inner);
498                        let codec = tonic::codec::ProstCodec::default();
499                        let mut grpc = tonic::server::Grpc::new(codec)
500                            .apply_compression_config(
501                                accept_compression_encodings,
502                                send_compression_encodings,
503                            )
504                            .apply_max_message_size_config(
505                                max_decoding_message_size,
506                                max_encoding_message_size,
507                            );
508                        let res = grpc.streaming(method, req).await;
509                        Ok(res)
510                    };
511                    Box::pin(fut)
512                }
513                _ => {
514                    Box::pin(async move {
515                        let mut response = http::Response::new(empty_body());
516                        let headers = response.headers_mut();
517                        headers
518                            .insert(
519                                tonic::Status::GRPC_STATUS,
520                                (tonic::Code::Unimplemented as i32).into(),
521                            );
522                        headers
523                            .insert(
524                                http::header::CONTENT_TYPE,
525                                tonic::metadata::GRPC_CONTENT_TYPE,
526                            );
527                        Ok(response)
528                    })
529                }
530            }
531        }
532    }
533    impl<T> Clone for ProtoStorageServer<T> {
534        fn clone(&self) -> Self {
535            let inner = self.inner.clone();
536            Self {
537                inner,
538                accept_compression_encodings: self.accept_compression_encodings,
539                send_compression_encodings: self.send_compression_encodings,
540                max_decoding_message_size: self.max_decoding_message_size,
541                max_encoding_message_size: self.max_encoding_message_size,
542            }
543        }
544    }
545    /// Generated gRPC service name
546    pub const SERVICE_NAME: &str = "mz_storage_client.client.ProtoStorage";
547    impl<T> tonic::server::NamedService for ProtoStorageServer<T> {
548        const NAME: &'static str = SERVICE_NAME;
549    }
550}