1#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct GetTableReplacePlanRequest {
5 #[prost(uint32, tag = "1")]
6 pub database_id: u32,
7 #[prost(uint32, tag = "2")]
8 pub owner: u32,
9 #[prost(string, tag = "3")]
10 pub table_name: ::prost::alloc::string::String,
11 #[prost(message, optional, tag = "4")]
12 pub table_change: ::core::option::Option<super::ddl_service::TableSchemaChange>,
13}
14#[derive(prost_helpers::AnyPB)]
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct GetTableReplacePlanResponse {
17 #[prost(message, optional, tag = "1")]
18 pub replace_plan: ::core::option::Option<super::ddl_service::ReplaceJobPlan>,
19}
20pub mod frontend_service_client {
22 #![allow(
23 unused_variables,
24 dead_code,
25 missing_docs,
26 clippy::wildcard_imports,
27 clippy::let_unit_value,
28 )]
29 use tonic::codegen::*;
30 use tonic::codegen::http::Uri;
31 #[derive(Debug, Clone)]
32 pub struct FrontendServiceClient<T> {
33 inner: tonic::client::Grpc<T>,
34 }
35 impl FrontendServiceClient<tonic::transport::Channel> {
36 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
38 where
39 D: TryInto<tonic::transport::Endpoint>,
40 D::Error: Into<StdError>,
41 {
42 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
43 Ok(Self::new(conn))
44 }
45 }
46 impl<T> FrontendServiceClient<T>
47 where
48 T: tonic::client::GrpcService<tonic::body::BoxBody>,
49 T::Error: Into<StdError>,
50 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
51 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
52 {
53 pub fn new(inner: T) -> Self {
54 let inner = tonic::client::Grpc::new(inner);
55 Self { inner }
56 }
57 pub fn with_origin(inner: T, origin: Uri) -> Self {
58 let inner = tonic::client::Grpc::with_origin(inner, origin);
59 Self { inner }
60 }
61 pub fn with_interceptor<F>(
62 inner: T,
63 interceptor: F,
64 ) -> FrontendServiceClient<InterceptedService<T, F>>
65 where
66 F: tonic::service::Interceptor,
67 T::ResponseBody: Default,
68 T: tonic::codegen::Service<
69 http::Request<tonic::body::BoxBody>,
70 Response = http::Response<
71 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
72 >,
73 >,
74 <T as tonic::codegen::Service<
75 http::Request<tonic::body::BoxBody>,
76 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
77 {
78 FrontendServiceClient::new(InterceptedService::new(inner, interceptor))
79 }
80 #[must_use]
85 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
86 self.inner = self.inner.send_compressed(encoding);
87 self
88 }
89 #[must_use]
91 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
92 self.inner = self.inner.accept_compressed(encoding);
93 self
94 }
95 #[must_use]
99 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
100 self.inner = self.inner.max_decoding_message_size(limit);
101 self
102 }
103 #[must_use]
107 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
108 self.inner = self.inner.max_encoding_message_size(limit);
109 self
110 }
111 pub async fn get_table_replace_plan(
112 &mut self,
113 request: impl tonic::IntoRequest<super::GetTableReplacePlanRequest>,
114 ) -> std::result::Result<
115 tonic::Response<super::GetTableReplacePlanResponse>,
116 tonic::Status,
117 > {
118 self.inner
119 .ready()
120 .await
121 .map_err(|e| {
122 tonic::Status::unknown(
123 format!("Service was not ready: {}", e.into()),
124 )
125 })?;
126 let codec = tonic::codec::ProstCodec::default();
127 let path = http::uri::PathAndQuery::from_static(
128 "/frontend_service.FrontendService/GetTableReplacePlan",
129 );
130 let mut req = request.into_request();
131 req.extensions_mut()
132 .insert(
133 GrpcMethod::new(
134 "frontend_service.FrontendService",
135 "GetTableReplacePlan",
136 ),
137 );
138 self.inner.unary(req, path, codec).await
139 }
140 }
141}
142pub mod frontend_service_server {
144 #![allow(
145 unused_variables,
146 dead_code,
147 missing_docs,
148 clippy::wildcard_imports,
149 clippy::let_unit_value,
150 )]
151 use tonic::codegen::*;
152 #[async_trait]
154 pub trait FrontendService: std::marker::Send + std::marker::Sync + 'static {
155 async fn get_table_replace_plan(
156 &self,
157 request: tonic::Request<super::GetTableReplacePlanRequest>,
158 ) -> std::result::Result<
159 tonic::Response<super::GetTableReplacePlanResponse>,
160 tonic::Status,
161 >;
162 }
163 #[derive(Debug)]
164 pub struct FrontendServiceServer<T> {
165 inner: Arc<T>,
166 accept_compression_encodings: EnabledCompressionEncodings,
167 send_compression_encodings: EnabledCompressionEncodings,
168 max_decoding_message_size: Option<usize>,
169 max_encoding_message_size: Option<usize>,
170 }
171 impl<T> FrontendServiceServer<T> {
172 pub fn new(inner: T) -> Self {
173 Self::from_arc(Arc::new(inner))
174 }
175 pub fn from_arc(inner: Arc<T>) -> Self {
176 Self {
177 inner,
178 accept_compression_encodings: Default::default(),
179 send_compression_encodings: Default::default(),
180 max_decoding_message_size: None,
181 max_encoding_message_size: None,
182 }
183 }
184 pub fn with_interceptor<F>(
185 inner: T,
186 interceptor: F,
187 ) -> InterceptedService<Self, F>
188 where
189 F: tonic::service::Interceptor,
190 {
191 InterceptedService::new(Self::new(inner), interceptor)
192 }
193 #[must_use]
195 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
196 self.accept_compression_encodings.enable(encoding);
197 self
198 }
199 #[must_use]
201 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
202 self.send_compression_encodings.enable(encoding);
203 self
204 }
205 #[must_use]
209 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
210 self.max_decoding_message_size = Some(limit);
211 self
212 }
213 #[must_use]
217 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
218 self.max_encoding_message_size = Some(limit);
219 self
220 }
221 }
222 impl<T, B> tonic::codegen::Service<http::Request<B>> for FrontendServiceServer<T>
223 where
224 T: FrontendService,
225 B: Body + std::marker::Send + 'static,
226 B::Error: Into<StdError> + std::marker::Send + 'static,
227 {
228 type Response = http::Response<tonic::body::BoxBody>;
229 type Error = std::convert::Infallible;
230 type Future = BoxFuture<Self::Response, Self::Error>;
231 fn poll_ready(
232 &mut self,
233 _cx: &mut Context<'_>,
234 ) -> Poll<std::result::Result<(), Self::Error>> {
235 Poll::Ready(Ok(()))
236 }
237 fn call(&mut self, req: http::Request<B>) -> Self::Future {
238 match req.uri().path() {
239 "/frontend_service.FrontendService/GetTableReplacePlan" => {
240 #[allow(non_camel_case_types)]
241 struct GetTableReplacePlanSvc<T: FrontendService>(pub Arc<T>);
242 impl<
243 T: FrontendService,
244 > tonic::server::UnaryService<super::GetTableReplacePlanRequest>
245 for GetTableReplacePlanSvc<T> {
246 type Response = super::GetTableReplacePlanResponse;
247 type Future = BoxFuture<
248 tonic::Response<Self::Response>,
249 tonic::Status,
250 >;
251 fn call(
252 &mut self,
253 request: tonic::Request<super::GetTableReplacePlanRequest>,
254 ) -> Self::Future {
255 let inner = Arc::clone(&self.0);
256 let fut = async move {
257 <T as FrontendService>::get_table_replace_plan(
258 &inner,
259 request,
260 )
261 .await
262 };
263 Box::pin(fut)
264 }
265 }
266 let accept_compression_encodings = self.accept_compression_encodings;
267 let send_compression_encodings = self.send_compression_encodings;
268 let max_decoding_message_size = self.max_decoding_message_size;
269 let max_encoding_message_size = self.max_encoding_message_size;
270 let inner = self.inner.clone();
271 let fut = async move {
272 let method = GetTableReplacePlanSvc(inner);
273 let codec = tonic::codec::ProstCodec::default();
274 let mut grpc = tonic::server::Grpc::new(codec)
275 .apply_compression_config(
276 accept_compression_encodings,
277 send_compression_encodings,
278 )
279 .apply_max_message_size_config(
280 max_decoding_message_size,
281 max_encoding_message_size,
282 );
283 let res = grpc.unary(method, req).await;
284 Ok(res)
285 };
286 Box::pin(fut)
287 }
288 _ => {
289 Box::pin(async move {
290 let mut response = http::Response::new(empty_body());
291 let headers = response.headers_mut();
292 headers
293 .insert(
294 tonic::Status::GRPC_STATUS,
295 (tonic::Code::Unimplemented as i32).into(),
296 );
297 headers
298 .insert(
299 http::header::CONTENT_TYPE,
300 tonic::metadata::GRPC_CONTENT_TYPE,
301 );
302 Ok(response)
303 })
304 }
305 }
306 }
307 }
308 impl<T> Clone for FrontendServiceServer<T> {
309 fn clone(&self) -> Self {
310 let inner = self.inner.clone();
311 Self {
312 inner,
313 accept_compression_encodings: self.accept_compression_encodings,
314 send_compression_encodings: self.send_compression_encodings,
315 max_decoding_message_size: self.max_decoding_message_size,
316 max_encoding_message_size: self.max_encoding_message_size,
317 }
318 }
319 }
320 pub const SERVICE_NAME: &str = "frontend_service.FrontendService";
322 impl<T> tonic::server::NamedService for FrontendServiceServer<T> {
323 const NAME: &'static str = SERVICE_NAME;
324 }
325}