superadmin managing backend
This commit is contained in:
Submodule client-gui2 updated: bdefd862eb...5c3181a65d
@@ -9,6 +9,41 @@ service BackupService {
|
||||
rpc StartDump(komp_ac.common.Empty) returns (BackupOperationResponse);
|
||||
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
|
||||
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
|
||||
rpc ListDatabases(komp_ac.common.Empty) returns (ListDatabasesResponse);
|
||||
rpc CreateDatabase(CreateDatabaseRequest) returns (DatabaseInfo);
|
||||
rpc RunDatabaseMigrations(DatabaseRequest) returns (DatabaseInfo);
|
||||
rpc ActivateDatabase(DatabaseRequest) returns (ActivateDatabaseResponse);
|
||||
}
|
||||
|
||||
message DatabaseRequest {
|
||||
string database_name = 1;
|
||||
}
|
||||
|
||||
message CreateDatabaseRequest {
|
||||
string database_name = 1;
|
||||
}
|
||||
|
||||
message DatabaseInfo {
|
||||
string database_name = 1;
|
||||
bool active = 2;
|
||||
bool connectable = 3;
|
||||
int64 size_bytes = 4;
|
||||
int32 applied_migrations = 5;
|
||||
int32 pending_migrations = 6;
|
||||
bool migration_dirty = 7;
|
||||
bool application_database = 8;
|
||||
string status = 9;
|
||||
}
|
||||
|
||||
message ListDatabasesResponse {
|
||||
string mode = 1;
|
||||
repeated DatabaseInfo databases = 2;
|
||||
}
|
||||
|
||||
message ActivateDatabaseResponse {
|
||||
string database_name = 1;
|
||||
bool switching = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
enum BackupType {
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,51 @@
|
||||
// This file is @generated by prost-build.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct DatabaseRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub database_name: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct CreateDatabaseRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub database_name: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct DatabaseInfo {
|
||||
#[prost(string, tag = "1")]
|
||||
pub database_name: ::prost::alloc::string::String,
|
||||
#[prost(bool, tag = "2")]
|
||||
pub active: bool,
|
||||
#[prost(bool, tag = "3")]
|
||||
pub connectable: bool,
|
||||
#[prost(int64, tag = "4")]
|
||||
pub size_bytes: i64,
|
||||
#[prost(int32, tag = "5")]
|
||||
pub applied_migrations: i32,
|
||||
#[prost(int32, tag = "6")]
|
||||
pub pending_migrations: i32,
|
||||
#[prost(bool, tag = "7")]
|
||||
pub migration_dirty: bool,
|
||||
#[prost(bool, tag = "8")]
|
||||
pub application_database: bool,
|
||||
#[prost(string, tag = "9")]
|
||||
pub status: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ListDatabasesResponse {
|
||||
#[prost(string, tag = "1")]
|
||||
pub mode: ::prost::alloc::string::String,
|
||||
#[prost(message, repeated, tag = "2")]
|
||||
pub databases: ::prost::alloc::vec::Vec<DatabaseInfo>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct ActivateDatabaseResponse {
|
||||
#[prost(string, tag = "1")]
|
||||
pub database_name: ::prost::alloc::string::String,
|
||||
#[prost(bool, tag = "2")]
|
||||
pub switching: bool,
|
||||
#[prost(string, tag = "3")]
|
||||
pub message: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct StartBackupRequest {
|
||||
#[prost(enumeration = "BackupType", tag = "1")]
|
||||
@@ -362,6 +409,107 @@ pub mod backup_service_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn list_databases(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::super::common::Empty>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ListDatabasesResponse>,
|
||||
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/ListDatabases",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new("komp_ac.backup.BackupService", "ListDatabases"),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn create_database(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::CreateDatabaseRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::DatabaseInfo>, 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/CreateDatabase",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new("komp_ac.backup.BackupService", "CreateDatabase"),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn run_database_migrations(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::DatabaseRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::DatabaseInfo>, 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/RunDatabaseMigrations",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.backup.BackupService",
|
||||
"RunDatabaseMigrations",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn activate_database(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::DatabaseRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ActivateDatabaseResponse>,
|
||||
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/ActivateDatabase",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new("komp_ac.backup.BackupService", "ActivateDatabase"),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Generated server implementations.
|
||||
@@ -412,6 +560,28 @@ pub mod backup_service_server {
|
||||
tonic::Response<super::BackupOperationResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
async fn list_databases(
|
||||
&self,
|
||||
request: tonic::Request<super::super::common::Empty>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ListDatabasesResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
async fn create_database(
|
||||
&self,
|
||||
request: tonic::Request<super::CreateDatabaseRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::DatabaseInfo>, tonic::Status>;
|
||||
async fn run_database_migrations(
|
||||
&self,
|
||||
request: tonic::Request<super::DatabaseRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::DatabaseInfo>, tonic::Status>;
|
||||
async fn activate_database(
|
||||
&self,
|
||||
request: tonic::Request<super::DatabaseRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ActivateDatabaseResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub struct BackupServiceServer<T> {
|
||||
@@ -715,6 +885,191 @@ pub mod backup_service_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.backup.BackupService/ListDatabases" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct ListDatabasesSvc<T: BackupService>(pub Arc<T>);
|
||||
impl<
|
||||
T: BackupService,
|
||||
> tonic::server::UnaryService<super::super::common::Empty>
|
||||
for ListDatabasesSvc<T> {
|
||||
type Response = super::ListDatabasesResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::super::common::Empty>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as BackupService>::list_databases(&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 = ListDatabasesSvc(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/CreateDatabase" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct CreateDatabaseSvc<T: BackupService>(pub Arc<T>);
|
||||
impl<
|
||||
T: BackupService,
|
||||
> tonic::server::UnaryService<super::CreateDatabaseRequest>
|
||||
for CreateDatabaseSvc<T> {
|
||||
type Response = super::DatabaseInfo;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::CreateDatabaseRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as BackupService>::create_database(&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 = CreateDatabaseSvc(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/RunDatabaseMigrations" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct RunDatabaseMigrationsSvc<T: BackupService>(pub Arc<T>);
|
||||
impl<
|
||||
T: BackupService,
|
||||
> tonic::server::UnaryService<super::DatabaseRequest>
|
||||
for RunDatabaseMigrationsSvc<T> {
|
||||
type Response = super::DatabaseInfo;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::DatabaseRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as BackupService>::run_database_migrations(
|
||||
&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 = RunDatabaseMigrationsSvc(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/ActivateDatabase" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct ActivateDatabaseSvc<T: BackupService>(pub Arc<T>);
|
||||
impl<
|
||||
T: BackupService,
|
||||
> tonic::server::UnaryService<super::DatabaseRequest>
|
||||
for ActivateDatabaseSvc<T> {
|
||||
type Response = super::ActivateDatabaseResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::DatabaseRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as BackupService>::activate_database(&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 = ActivateDatabaseSvc(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 {
|
||||
let mut response = http::Response::new(
|
||||
|
||||
2
server
2
server
Submodule server updated: 1342460048...ec9f1f19de
Reference in New Issue
Block a user