pgBackRest db backup
This commit is contained in:
@@ -8,8 +8,6 @@ service BackupService {
|
|||||||
rpc StartCheck(komp_ac.common.Empty) returns (BackupOperationResponse);
|
rpc StartCheck(komp_ac.common.Empty) returns (BackupOperationResponse);
|
||||||
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
|
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
|
||||||
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
|
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
|
||||||
rpc RestoreLatest(RestoreLatestRequest) returns (BackupOperationResponse);
|
|
||||||
rpc RestoreTarget(RestoreTargetRequest) returns (BackupOperationResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BackupType {
|
enum BackupType {
|
||||||
@@ -23,7 +21,6 @@ enum OperationKind {
|
|||||||
OPERATION_KIND_UNSPECIFIED = 0;
|
OPERATION_KIND_UNSPECIFIED = 0;
|
||||||
OPERATION_KIND_BACKUP = 1;
|
OPERATION_KIND_BACKUP = 1;
|
||||||
OPERATION_KIND_CHECK = 2;
|
OPERATION_KIND_CHECK = 2;
|
||||||
OPERATION_KIND_RESTORE = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum OperationStatus {
|
enum OperationStatus {
|
||||||
@@ -37,16 +34,6 @@ message StartBackupRequest {
|
|||||||
BackupType backup_type = 1;
|
BackupType backup_type = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RestoreLatestRequest {
|
|
||||||
string confirmation = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RestoreTargetRequest {
|
|
||||||
string confirmation = 1;
|
|
||||||
string target_type = 2;
|
|
||||||
string target = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetOperationStatusRequest {
|
message GetOperationStatusRequest {
|
||||||
string operation_id = 1;
|
string operation_id = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -5,20 +5,6 @@ pub struct StartBackupRequest {
|
|||||||
pub backup_type: i32,
|
pub backup_type: i32,
|
||||||
}
|
}
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
pub struct RestoreLatestRequest {
|
|
||||||
#[prost(string, tag = "1")]
|
|
||||||
pub confirmation: ::prost::alloc::string::String,
|
|
||||||
}
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
||||||
pub struct RestoreTargetRequest {
|
|
||||||
#[prost(string, tag = "1")]
|
|
||||||
pub confirmation: ::prost::alloc::string::String,
|
|
||||||
#[prost(string, tag = "2")]
|
|
||||||
pub target_type: ::prost::alloc::string::String,
|
|
||||||
#[prost(string, tag = "3")]
|
|
||||||
pub target: ::prost::alloc::string::String,
|
|
||||||
}
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
||||||
pub struct GetOperationStatusRequest {
|
pub struct GetOperationStatusRequest {
|
||||||
#[prost(string, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub operation_id: ::prost::alloc::string::String,
|
pub operation_id: ::prost::alloc::string::String,
|
||||||
@@ -85,7 +71,6 @@ pub enum OperationKind {
|
|||||||
Unspecified = 0,
|
Unspecified = 0,
|
||||||
Backup = 1,
|
Backup = 1,
|
||||||
Check = 2,
|
Check = 2,
|
||||||
Restore = 3,
|
|
||||||
}
|
}
|
||||||
impl OperationKind {
|
impl OperationKind {
|
||||||
/// String value of the enum field names used in the ProtoBuf definition.
|
/// String value of the enum field names used in the ProtoBuf definition.
|
||||||
@@ -97,7 +82,6 @@ impl OperationKind {
|
|||||||
Self::Unspecified => "OPERATION_KIND_UNSPECIFIED",
|
Self::Unspecified => "OPERATION_KIND_UNSPECIFIED",
|
||||||
Self::Backup => "OPERATION_KIND_BACKUP",
|
Self::Backup => "OPERATION_KIND_BACKUP",
|
||||||
Self::Check => "OPERATION_KIND_CHECK",
|
Self::Check => "OPERATION_KIND_CHECK",
|
||||||
Self::Restore => "OPERATION_KIND_RESTORE",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Creates an enum from field names used in the ProtoBuf definition.
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
||||||
@@ -106,7 +90,6 @@ impl OperationKind {
|
|||||||
"OPERATION_KIND_UNSPECIFIED" => Some(Self::Unspecified),
|
"OPERATION_KIND_UNSPECIFIED" => Some(Self::Unspecified),
|
||||||
"OPERATION_KIND_BACKUP" => Some(Self::Backup),
|
"OPERATION_KIND_BACKUP" => Some(Self::Backup),
|
||||||
"OPERATION_KIND_CHECK" => Some(Self::Check),
|
"OPERATION_KIND_CHECK" => Some(Self::Check),
|
||||||
"OPERATION_KIND_RESTORE" => Some(Self::Restore),
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,58 +317,6 @@ pub mod backup_service_client {
|
|||||||
);
|
);
|
||||||
self.inner.unary(req, path, codec).await
|
self.inner.unary(req, path, codec).await
|
||||||
}
|
}
|
||||||
pub async fn restore_latest(
|
|
||||||
&mut self,
|
|
||||||
request: impl tonic::IntoRequest<super::RestoreLatestRequest>,
|
|
||||||
) -> std::result::Result<
|
|
||||||
tonic::Response<super::BackupOperationResponse>,
|
|
||||||
tonic::Status,
|
|
||||||
> {
|
|
||||||
self.inner
|
|
||||||
.ready()
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
tonic::Status::unknown(
|
|
||||||
format!("Service was not ready: {}", e.into()),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
let codec = tonic_prost::ProstCodec::default();
|
|
||||||
let path = http::uri::PathAndQuery::from_static(
|
|
||||||
"/komp_ac.backup.BackupService/RestoreLatest",
|
|
||||||
);
|
|
||||||
let mut req = request.into_request();
|
|
||||||
req.extensions_mut()
|
|
||||||
.insert(
|
|
||||||
GrpcMethod::new("komp_ac.backup.BackupService", "RestoreLatest"),
|
|
||||||
);
|
|
||||||
self.inner.unary(req, path, codec).await
|
|
||||||
}
|
|
||||||
pub async fn restore_target(
|
|
||||||
&mut self,
|
|
||||||
request: impl tonic::IntoRequest<super::RestoreTargetRequest>,
|
|
||||||
) -> std::result::Result<
|
|
||||||
tonic::Response<super::BackupOperationResponse>,
|
|
||||||
tonic::Status,
|
|
||||||
> {
|
|
||||||
self.inner
|
|
||||||
.ready()
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
tonic::Status::unknown(
|
|
||||||
format!("Service was not ready: {}", e.into()),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
let codec = tonic_prost::ProstCodec::default();
|
|
||||||
let path = http::uri::PathAndQuery::from_static(
|
|
||||||
"/komp_ac.backup.BackupService/RestoreTarget",
|
|
||||||
);
|
|
||||||
let mut req = request.into_request();
|
|
||||||
req.extensions_mut()
|
|
||||||
.insert(
|
|
||||||
GrpcMethod::new("komp_ac.backup.BackupService", "RestoreTarget"),
|
|
||||||
);
|
|
||||||
self.inner.unary(req, path, codec).await
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Generated server implementations.
|
/// Generated server implementations.
|
||||||
@@ -429,20 +360,6 @@ pub mod backup_service_server {
|
|||||||
tonic::Response<super::BackupOperationResponse>,
|
tonic::Response<super::BackupOperationResponse>,
|
||||||
tonic::Status,
|
tonic::Status,
|
||||||
>;
|
>;
|
||||||
async fn restore_latest(
|
|
||||||
&self,
|
|
||||||
request: tonic::Request<super::RestoreLatestRequest>,
|
|
||||||
) -> std::result::Result<
|
|
||||||
tonic::Response<super::BackupOperationResponse>,
|
|
||||||
tonic::Status,
|
|
||||||
>;
|
|
||||||
async fn restore_target(
|
|
||||||
&self,
|
|
||||||
request: tonic::Request<super::RestoreTargetRequest>,
|
|
||||||
) -> std::result::Result<
|
|
||||||
tonic::Response<super::BackupOperationResponse>,
|
|
||||||
tonic::Status,
|
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct BackupServiceServer<T> {
|
pub struct BackupServiceServer<T> {
|
||||||
@@ -701,96 +618,6 @@ pub mod backup_service_server {
|
|||||||
};
|
};
|
||||||
Box::pin(fut)
|
Box::pin(fut)
|
||||||
}
|
}
|
||||||
"/komp_ac.backup.BackupService/RestoreLatest" => {
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
struct RestoreLatestSvc<T: BackupService>(pub Arc<T>);
|
|
||||||
impl<
|
|
||||||
T: BackupService,
|
|
||||||
> tonic::server::UnaryService<super::RestoreLatestRequest>
|
|
||||||
for RestoreLatestSvc<T> {
|
|
||||||
type Response = super::BackupOperationResponse;
|
|
||||||
type Future = BoxFuture<
|
|
||||||
tonic::Response<Self::Response>,
|
|
||||||
tonic::Status,
|
|
||||||
>;
|
|
||||||
fn call(
|
|
||||||
&mut self,
|
|
||||||
request: tonic::Request<super::RestoreLatestRequest>,
|
|
||||||
) -> Self::Future {
|
|
||||||
let inner = Arc::clone(&self.0);
|
|
||||||
let fut = async move {
|
|
||||||
<T as BackupService>::restore_latest(&inner, request).await
|
|
||||||
};
|
|
||||||
Box::pin(fut)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let accept_compression_encodings = self.accept_compression_encodings;
|
|
||||||
let send_compression_encodings = self.send_compression_encodings;
|
|
||||||
let max_decoding_message_size = self.max_decoding_message_size;
|
|
||||||
let max_encoding_message_size = self.max_encoding_message_size;
|
|
||||||
let inner = self.inner.clone();
|
|
||||||
let fut = async move {
|
|
||||||
let method = RestoreLatestSvc(inner);
|
|
||||||
let codec = tonic_prost::ProstCodec::default();
|
|
||||||
let mut grpc = tonic::server::Grpc::new(codec)
|
|
||||||
.apply_compression_config(
|
|
||||||
accept_compression_encodings,
|
|
||||||
send_compression_encodings,
|
|
||||||
)
|
|
||||||
.apply_max_message_size_config(
|
|
||||||
max_decoding_message_size,
|
|
||||||
max_encoding_message_size,
|
|
||||||
);
|
|
||||||
let res = grpc.unary(method, req).await;
|
|
||||||
Ok(res)
|
|
||||||
};
|
|
||||||
Box::pin(fut)
|
|
||||||
}
|
|
||||||
"/komp_ac.backup.BackupService/RestoreTarget" => {
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
struct RestoreTargetSvc<T: BackupService>(pub Arc<T>);
|
|
||||||
impl<
|
|
||||||
T: BackupService,
|
|
||||||
> tonic::server::UnaryService<super::RestoreTargetRequest>
|
|
||||||
for RestoreTargetSvc<T> {
|
|
||||||
type Response = super::BackupOperationResponse;
|
|
||||||
type Future = BoxFuture<
|
|
||||||
tonic::Response<Self::Response>,
|
|
||||||
tonic::Status,
|
|
||||||
>;
|
|
||||||
fn call(
|
|
||||||
&mut self,
|
|
||||||
request: tonic::Request<super::RestoreTargetRequest>,
|
|
||||||
) -> Self::Future {
|
|
||||||
let inner = Arc::clone(&self.0);
|
|
||||||
let fut = async move {
|
|
||||||
<T as BackupService>::restore_target(&inner, request).await
|
|
||||||
};
|
|
||||||
Box::pin(fut)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let accept_compression_encodings = self.accept_compression_encodings;
|
|
||||||
let send_compression_encodings = self.send_compression_encodings;
|
|
||||||
let max_decoding_message_size = self.max_decoding_message_size;
|
|
||||||
let max_encoding_message_size = self.max_encoding_message_size;
|
|
||||||
let inner = self.inner.clone();
|
|
||||||
let fut = async move {
|
|
||||||
let method = RestoreTargetSvc(inner);
|
|
||||||
let codec = tonic_prost::ProstCodec::default();
|
|
||||||
let mut grpc = tonic::server::Grpc::new(codec)
|
|
||||||
.apply_compression_config(
|
|
||||||
accept_compression_encodings,
|
|
||||||
send_compression_encodings,
|
|
||||||
)
|
|
||||||
.apply_max_message_size_config(
|
|
||||||
max_decoding_message_size,
|
|
||||||
max_encoding_message_size,
|
|
||||||
);
|
|
||||||
let res = grpc.unary(method, req).await;
|
|
||||||
Ok(res)
|
|
||||||
};
|
|
||||||
Box::pin(fut)
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut response = http::Response::new(
|
let mut response = http::Response::new(
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 068cfbdba0...8eedcdfa34
Reference in New Issue
Block a user