1#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct MetaBackupManifestId {
5 #[prost(uint64, tag = "1")]
6 pub id: u64,
7}
8#[derive(prost_helpers::AnyPB)]
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct BackupMetaRequest {
11 #[prost(string, optional, tag = "1")]
12 pub remarks: ::core::option::Option<::prost::alloc::string::String>,
13}
14#[derive(prost_helpers::AnyPB)]
15#[derive(Clone, Copy, PartialEq, ::prost::Message)]
16pub struct BackupMetaResponse {
17 #[prost(uint64, tag = "1")]
18 pub job_id: u64,
19}
20#[derive(prost_helpers::AnyPB)]
21#[derive(Clone, Copy, PartialEq, ::prost::Message)]
22pub struct GetBackupJobStatusRequest {
23 #[prost(uint64, tag = "1")]
24 pub job_id: u64,
25}
26#[derive(prost_helpers::AnyPB)]
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct GetBackupJobStatusResponse {
29 #[prost(uint64, tag = "1")]
30 pub job_id: u64,
31 #[prost(enumeration = "BackupJobStatus", tag = "2")]
32 pub job_status: i32,
33 #[prost(string, tag = "3")]
34 pub message: ::prost::alloc::string::String,
35}
36#[derive(prost_helpers::AnyPB)]
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct DeleteMetaSnapshotRequest {
39 #[prost(uint64, repeated, tag = "1")]
40 pub snapshot_ids: ::prost::alloc::vec::Vec<u64>,
41}
42#[derive(prost_helpers::AnyPB)]
43#[derive(Clone, Copy, PartialEq, ::prost::Message)]
44pub struct DeleteMetaSnapshotResponse {}
45#[derive(prost_helpers::AnyPB)]
46#[derive(Clone, Copy, PartialEq, ::prost::Message)]
47pub struct GetMetaSnapshotManifestRequest {}
48#[derive(prost_helpers::AnyPB)]
49#[derive(Clone, PartialEq, ::prost::Message)]
50pub struct GetMetaSnapshotManifestResponse {
51 #[prost(message, optional, tag = "1")]
52 pub manifest: ::core::option::Option<MetaSnapshotManifest>,
53}
54#[derive(prost_helpers::AnyPB)]
55#[derive(Clone, PartialEq, ::prost::Message)]
56pub struct MetaSnapshotManifest {
57 #[prost(uint64, tag = "1")]
58 pub manifest_id: u64,
59 #[prost(message, repeated, tag = "2")]
60 pub snapshot_metadata: ::prost::alloc::vec::Vec<MetaSnapshotMetadata>,
61}
62#[derive(prost_helpers::AnyPB)]
63#[derive(Clone, PartialEq, ::prost::Message)]
64pub struct MetaSnapshotMetadata {
65 #[prost(uint64, tag = "1")]
66 pub id: u64,
67 #[prost(uint64, tag = "2")]
68 pub hummock_version_id: u64,
69 #[prost(uint32, optional, tag = "5")]
70 pub format_version: ::core::option::Option<u32>,
71 #[prost(string, optional, tag = "6")]
72 pub remarks: ::core::option::Option<::prost::alloc::string::String>,
73 #[prost(string, optional, tag = "7")]
74 pub rw_version: ::core::option::Option<::prost::alloc::string::String>,
75 #[prost(map = "uint32, message", tag = "8")]
76 pub state_table_info: ::std::collections::HashMap<
77 u32,
78 super::hummock::StateTableInfo,
79 >,
80}
81#[derive(prost_helpers::AnyPB)]
82#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
83#[repr(i32)]
84pub enum BackupJobStatus {
85 Unspecified = 0,
86 Running = 1,
87 Succeeded = 2,
88 NotFound = 3,
89 Failed = 4,
90}
91impl BackupJobStatus {
92 pub fn as_str_name(&self) -> &'static str {
97 match self {
98 Self::Unspecified => "UNSPECIFIED",
99 Self::Running => "RUNNING",
100 Self::Succeeded => "SUCCEEDED",
101 Self::NotFound => "NOT_FOUND",
102 Self::Failed => "FAILED",
103 }
104 }
105 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
107 match value {
108 "UNSPECIFIED" => Some(Self::Unspecified),
109 "RUNNING" => Some(Self::Running),
110 "SUCCEEDED" => Some(Self::Succeeded),
111 "NOT_FOUND" => Some(Self::NotFound),
112 "FAILED" => Some(Self::Failed),
113 _ => None,
114 }
115 }
116}
117pub mod backup_service_client {
119 #![allow(
120 unused_variables,
121 dead_code,
122 missing_docs,
123 clippy::wildcard_imports,
124 clippy::let_unit_value,
125 )]
126 use tonic::codegen::*;
127 use tonic::codegen::http::Uri;
128 #[derive(Debug, Clone)]
129 pub struct BackupServiceClient<T> {
130 inner: tonic::client::Grpc<T>,
131 }
132 impl BackupServiceClient<tonic::transport::Channel> {
133 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
135 where
136 D: TryInto<tonic::transport::Endpoint>,
137 D::Error: Into<StdError>,
138 {
139 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
140 Ok(Self::new(conn))
141 }
142 }
143 impl<T> BackupServiceClient<T>
144 where
145 T: tonic::client::GrpcService<tonic::body::BoxBody>,
146 T::Error: Into<StdError>,
147 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
148 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
149 {
150 pub fn new(inner: T) -> Self {
151 let inner = tonic::client::Grpc::new(inner);
152 Self { inner }
153 }
154 pub fn with_origin(inner: T, origin: Uri) -> Self {
155 let inner = tonic::client::Grpc::with_origin(inner, origin);
156 Self { inner }
157 }
158 pub fn with_interceptor<F>(
159 inner: T,
160 interceptor: F,
161 ) -> BackupServiceClient<InterceptedService<T, F>>
162 where
163 F: tonic::service::Interceptor,
164 T::ResponseBody: Default,
165 T: tonic::codegen::Service<
166 http::Request<tonic::body::BoxBody>,
167 Response = http::Response<
168 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
169 >,
170 >,
171 <T as tonic::codegen::Service<
172 http::Request<tonic::body::BoxBody>,
173 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
174 {
175 BackupServiceClient::new(InterceptedService::new(inner, interceptor))
176 }
177 #[must_use]
182 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
183 self.inner = self.inner.send_compressed(encoding);
184 self
185 }
186 #[must_use]
188 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
189 self.inner = self.inner.accept_compressed(encoding);
190 self
191 }
192 #[must_use]
196 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
197 self.inner = self.inner.max_decoding_message_size(limit);
198 self
199 }
200 #[must_use]
204 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
205 self.inner = self.inner.max_encoding_message_size(limit);
206 self
207 }
208 pub async fn backup_meta(
209 &mut self,
210 request: impl tonic::IntoRequest<super::BackupMetaRequest>,
211 ) -> std::result::Result<
212 tonic::Response<super::BackupMetaResponse>,
213 tonic::Status,
214 > {
215 self.inner
216 .ready()
217 .await
218 .map_err(|e| {
219 tonic::Status::unknown(
220 format!("Service was not ready: {}", e.into()),
221 )
222 })?;
223 let codec = tonic::codec::ProstCodec::default();
224 let path = http::uri::PathAndQuery::from_static(
225 "/backup_service.BackupService/BackupMeta",
226 );
227 let mut req = request.into_request();
228 req.extensions_mut()
229 .insert(GrpcMethod::new("backup_service.BackupService", "BackupMeta"));
230 self.inner.unary(req, path, codec).await
231 }
232 pub async fn get_backup_job_status(
233 &mut self,
234 request: impl tonic::IntoRequest<super::GetBackupJobStatusRequest>,
235 ) -> std::result::Result<
236 tonic::Response<super::GetBackupJobStatusResponse>,
237 tonic::Status,
238 > {
239 self.inner
240 .ready()
241 .await
242 .map_err(|e| {
243 tonic::Status::unknown(
244 format!("Service was not ready: {}", e.into()),
245 )
246 })?;
247 let codec = tonic::codec::ProstCodec::default();
248 let path = http::uri::PathAndQuery::from_static(
249 "/backup_service.BackupService/GetBackupJobStatus",
250 );
251 let mut req = request.into_request();
252 req.extensions_mut()
253 .insert(
254 GrpcMethod::new("backup_service.BackupService", "GetBackupJobStatus"),
255 );
256 self.inner.unary(req, path, codec).await
257 }
258 pub async fn delete_meta_snapshot(
259 &mut self,
260 request: impl tonic::IntoRequest<super::DeleteMetaSnapshotRequest>,
261 ) -> std::result::Result<
262 tonic::Response<super::DeleteMetaSnapshotResponse>,
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 "/backup_service.BackupService/DeleteMetaSnapshot",
276 );
277 let mut req = request.into_request();
278 req.extensions_mut()
279 .insert(
280 GrpcMethod::new("backup_service.BackupService", "DeleteMetaSnapshot"),
281 );
282 self.inner.unary(req, path, codec).await
283 }
284 pub async fn get_meta_snapshot_manifest(
285 &mut self,
286 request: impl tonic::IntoRequest<super::GetMetaSnapshotManifestRequest>,
287 ) -> std::result::Result<
288 tonic::Response<super::GetMetaSnapshotManifestResponse>,
289 tonic::Status,
290 > {
291 self.inner
292 .ready()
293 .await
294 .map_err(|e| {
295 tonic::Status::unknown(
296 format!("Service was not ready: {}", e.into()),
297 )
298 })?;
299 let codec = tonic::codec::ProstCodec::default();
300 let path = http::uri::PathAndQuery::from_static(
301 "/backup_service.BackupService/GetMetaSnapshotManifest",
302 );
303 let mut req = request.into_request();
304 req.extensions_mut()
305 .insert(
306 GrpcMethod::new(
307 "backup_service.BackupService",
308 "GetMetaSnapshotManifest",
309 ),
310 );
311 self.inner.unary(req, path, codec).await
312 }
313 }
314}
315pub mod backup_service_server {
317 #![allow(
318 unused_variables,
319 dead_code,
320 missing_docs,
321 clippy::wildcard_imports,
322 clippy::let_unit_value,
323 )]
324 use tonic::codegen::*;
325 #[async_trait]
327 pub trait BackupService: std::marker::Send + std::marker::Sync + 'static {
328 async fn backup_meta(
329 &self,
330 request: tonic::Request<super::BackupMetaRequest>,
331 ) -> std::result::Result<
332 tonic::Response<super::BackupMetaResponse>,
333 tonic::Status,
334 >;
335 async fn get_backup_job_status(
336 &self,
337 request: tonic::Request<super::GetBackupJobStatusRequest>,
338 ) -> std::result::Result<
339 tonic::Response<super::GetBackupJobStatusResponse>,
340 tonic::Status,
341 >;
342 async fn delete_meta_snapshot(
343 &self,
344 request: tonic::Request<super::DeleteMetaSnapshotRequest>,
345 ) -> std::result::Result<
346 tonic::Response<super::DeleteMetaSnapshotResponse>,
347 tonic::Status,
348 >;
349 async fn get_meta_snapshot_manifest(
350 &self,
351 request: tonic::Request<super::GetMetaSnapshotManifestRequest>,
352 ) -> std::result::Result<
353 tonic::Response<super::GetMetaSnapshotManifestResponse>,
354 tonic::Status,
355 >;
356 }
357 #[derive(Debug)]
358 pub struct BackupServiceServer<T> {
359 inner: Arc<T>,
360 accept_compression_encodings: EnabledCompressionEncodings,
361 send_compression_encodings: EnabledCompressionEncodings,
362 max_decoding_message_size: Option<usize>,
363 max_encoding_message_size: Option<usize>,
364 }
365 impl<T> BackupServiceServer<T> {
366 pub fn new(inner: T) -> Self {
367 Self::from_arc(Arc::new(inner))
368 }
369 pub fn from_arc(inner: Arc<T>) -> Self {
370 Self {
371 inner,
372 accept_compression_encodings: Default::default(),
373 send_compression_encodings: Default::default(),
374 max_decoding_message_size: None,
375 max_encoding_message_size: None,
376 }
377 }
378 pub fn with_interceptor<F>(
379 inner: T,
380 interceptor: F,
381 ) -> InterceptedService<Self, F>
382 where
383 F: tonic::service::Interceptor,
384 {
385 InterceptedService::new(Self::new(inner), interceptor)
386 }
387 #[must_use]
389 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
390 self.accept_compression_encodings.enable(encoding);
391 self
392 }
393 #[must_use]
395 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
396 self.send_compression_encodings.enable(encoding);
397 self
398 }
399 #[must_use]
403 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
404 self.max_decoding_message_size = Some(limit);
405 self
406 }
407 #[must_use]
411 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
412 self.max_encoding_message_size = Some(limit);
413 self
414 }
415 }
416 impl<T, B> tonic::codegen::Service<http::Request<B>> for BackupServiceServer<T>
417 where
418 T: BackupService,
419 B: Body + std::marker::Send + 'static,
420 B::Error: Into<StdError> + std::marker::Send + 'static,
421 {
422 type Response = http::Response<tonic::body::BoxBody>;
423 type Error = std::convert::Infallible;
424 type Future = BoxFuture<Self::Response, Self::Error>;
425 fn poll_ready(
426 &mut self,
427 _cx: &mut Context<'_>,
428 ) -> Poll<std::result::Result<(), Self::Error>> {
429 Poll::Ready(Ok(()))
430 }
431 fn call(&mut self, req: http::Request<B>) -> Self::Future {
432 match req.uri().path() {
433 "/backup_service.BackupService/BackupMeta" => {
434 #[allow(non_camel_case_types)]
435 struct BackupMetaSvc<T: BackupService>(pub Arc<T>);
436 impl<
437 T: BackupService,
438 > tonic::server::UnaryService<super::BackupMetaRequest>
439 for BackupMetaSvc<T> {
440 type Response = super::BackupMetaResponse;
441 type Future = BoxFuture<
442 tonic::Response<Self::Response>,
443 tonic::Status,
444 >;
445 fn call(
446 &mut self,
447 request: tonic::Request<super::BackupMetaRequest>,
448 ) -> Self::Future {
449 let inner = Arc::clone(&self.0);
450 let fut = async move {
451 <T as BackupService>::backup_meta(&inner, request).await
452 };
453 Box::pin(fut)
454 }
455 }
456 let accept_compression_encodings = self.accept_compression_encodings;
457 let send_compression_encodings = self.send_compression_encodings;
458 let max_decoding_message_size = self.max_decoding_message_size;
459 let max_encoding_message_size = self.max_encoding_message_size;
460 let inner = self.inner.clone();
461 let fut = async move {
462 let method = BackupMetaSvc(inner);
463 let codec = tonic::codec::ProstCodec::default();
464 let mut grpc = tonic::server::Grpc::new(codec)
465 .apply_compression_config(
466 accept_compression_encodings,
467 send_compression_encodings,
468 )
469 .apply_max_message_size_config(
470 max_decoding_message_size,
471 max_encoding_message_size,
472 );
473 let res = grpc.unary(method, req).await;
474 Ok(res)
475 };
476 Box::pin(fut)
477 }
478 "/backup_service.BackupService/GetBackupJobStatus" => {
479 #[allow(non_camel_case_types)]
480 struct GetBackupJobStatusSvc<T: BackupService>(pub Arc<T>);
481 impl<
482 T: BackupService,
483 > tonic::server::UnaryService<super::GetBackupJobStatusRequest>
484 for GetBackupJobStatusSvc<T> {
485 type Response = super::GetBackupJobStatusResponse;
486 type Future = BoxFuture<
487 tonic::Response<Self::Response>,
488 tonic::Status,
489 >;
490 fn call(
491 &mut self,
492 request: tonic::Request<super::GetBackupJobStatusRequest>,
493 ) -> Self::Future {
494 let inner = Arc::clone(&self.0);
495 let fut = async move {
496 <T as BackupService>::get_backup_job_status(&inner, request)
497 .await
498 };
499 Box::pin(fut)
500 }
501 }
502 let accept_compression_encodings = self.accept_compression_encodings;
503 let send_compression_encodings = self.send_compression_encodings;
504 let max_decoding_message_size = self.max_decoding_message_size;
505 let max_encoding_message_size = self.max_encoding_message_size;
506 let inner = self.inner.clone();
507 let fut = async move {
508 let method = GetBackupJobStatusSvc(inner);
509 let codec = tonic::codec::ProstCodec::default();
510 let mut grpc = tonic::server::Grpc::new(codec)
511 .apply_compression_config(
512 accept_compression_encodings,
513 send_compression_encodings,
514 )
515 .apply_max_message_size_config(
516 max_decoding_message_size,
517 max_encoding_message_size,
518 );
519 let res = grpc.unary(method, req).await;
520 Ok(res)
521 };
522 Box::pin(fut)
523 }
524 "/backup_service.BackupService/DeleteMetaSnapshot" => {
525 #[allow(non_camel_case_types)]
526 struct DeleteMetaSnapshotSvc<T: BackupService>(pub Arc<T>);
527 impl<
528 T: BackupService,
529 > tonic::server::UnaryService<super::DeleteMetaSnapshotRequest>
530 for DeleteMetaSnapshotSvc<T> {
531 type Response = super::DeleteMetaSnapshotResponse;
532 type Future = BoxFuture<
533 tonic::Response<Self::Response>,
534 tonic::Status,
535 >;
536 fn call(
537 &mut self,
538 request: tonic::Request<super::DeleteMetaSnapshotRequest>,
539 ) -> Self::Future {
540 let inner = Arc::clone(&self.0);
541 let fut = async move {
542 <T as BackupService>::delete_meta_snapshot(&inner, request)
543 .await
544 };
545 Box::pin(fut)
546 }
547 }
548 let accept_compression_encodings = self.accept_compression_encodings;
549 let send_compression_encodings = self.send_compression_encodings;
550 let max_decoding_message_size = self.max_decoding_message_size;
551 let max_encoding_message_size = self.max_encoding_message_size;
552 let inner = self.inner.clone();
553 let fut = async move {
554 let method = DeleteMetaSnapshotSvc(inner);
555 let codec = tonic::codec::ProstCodec::default();
556 let mut grpc = tonic::server::Grpc::new(codec)
557 .apply_compression_config(
558 accept_compression_encodings,
559 send_compression_encodings,
560 )
561 .apply_max_message_size_config(
562 max_decoding_message_size,
563 max_encoding_message_size,
564 );
565 let res = grpc.unary(method, req).await;
566 Ok(res)
567 };
568 Box::pin(fut)
569 }
570 "/backup_service.BackupService/GetMetaSnapshotManifest" => {
571 #[allow(non_camel_case_types)]
572 struct GetMetaSnapshotManifestSvc<T: BackupService>(pub Arc<T>);
573 impl<
574 T: BackupService,
575 > tonic::server::UnaryService<super::GetMetaSnapshotManifestRequest>
576 for GetMetaSnapshotManifestSvc<T> {
577 type Response = super::GetMetaSnapshotManifestResponse;
578 type Future = BoxFuture<
579 tonic::Response<Self::Response>,
580 tonic::Status,
581 >;
582 fn call(
583 &mut self,
584 request: tonic::Request<
585 super::GetMetaSnapshotManifestRequest,
586 >,
587 ) -> Self::Future {
588 let inner = Arc::clone(&self.0);
589 let fut = async move {
590 <T as BackupService>::get_meta_snapshot_manifest(
591 &inner,
592 request,
593 )
594 .await
595 };
596 Box::pin(fut)
597 }
598 }
599 let accept_compression_encodings = self.accept_compression_encodings;
600 let send_compression_encodings = self.send_compression_encodings;
601 let max_decoding_message_size = self.max_decoding_message_size;
602 let max_encoding_message_size = self.max_encoding_message_size;
603 let inner = self.inner.clone();
604 let fut = async move {
605 let method = GetMetaSnapshotManifestSvc(inner);
606 let codec = tonic::codec::ProstCodec::default();
607 let mut grpc = tonic::server::Grpc::new(codec)
608 .apply_compression_config(
609 accept_compression_encodings,
610 send_compression_encodings,
611 )
612 .apply_max_message_size_config(
613 max_decoding_message_size,
614 max_encoding_message_size,
615 );
616 let res = grpc.unary(method, req).await;
617 Ok(res)
618 };
619 Box::pin(fut)
620 }
621 _ => {
622 Box::pin(async move {
623 let mut response = http::Response::new(empty_body());
624 let headers = response.headers_mut();
625 headers
626 .insert(
627 tonic::Status::GRPC_STATUS,
628 (tonic::Code::Unimplemented as i32).into(),
629 );
630 headers
631 .insert(
632 http::header::CONTENT_TYPE,
633 tonic::metadata::GRPC_CONTENT_TYPE,
634 );
635 Ok(response)
636 })
637 }
638 }
639 }
640 }
641 impl<T> Clone for BackupServiceServer<T> {
642 fn clone(&self) -> Self {
643 let inner = self.inner.clone();
644 Self {
645 inner,
646 accept_compression_encodings: self.accept_compression_encodings,
647 send_compression_encodings: self.send_compression_encodings,
648 max_decoding_message_size: self.max_decoding_message_size,
649 max_encoding_message_size: self.max_encoding_message_size,
650 }
651 }
652 }
653 pub const SERVICE_NAME: &str = "backup_service.BackupService";
655 impl<T> tonic::server::NamedService for BackupServiceServer<T> {
656 const NAME: &'static str = SERVICE_NAME;
657 }
658}