Compare commits

...

6 Commits

Author SHA1 Message Date
Priec
ee509b6041 server pg backup 2026-06-29 01:00:18 +02:00
Priec
293165d4a2 translations at client are done now 2026-06-27 16:43:50 +02:00
Priec
999886834d import 2026-06-22 21:59:16 +02:00
Priec
0853b12df4 cursor api fixed, forms page is ready 2026-06-22 17:41:57 +02:00
Priec
a8c49575d3 chore: update submodule pointers for v0.8.12 (canvas, pages) and v0.8.13 (client) 2026-06-22 16:56:14 +02:00
Priec
670f9575ee theme finished partly 2026-06-19 23:00:50 +02:00
11 changed files with 1129 additions and 24 deletions

238
Cargo.lock generated
View File

@@ -475,6 +475,16 @@ dependencies = [
"syn 2.0.117",
]
[[package]]
name = "bstr"
version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cee35f73844aa3014bb606320a6c1f010249dbdf43342fe54b5a4f6a8ed4b79"
dependencies = [
"memchr",
"serde_core",
]
[[package]]
name = "bumpalo"
version = "3.20.3"
@@ -609,7 +619,7 @@ dependencies = [
[[package]]
name = "client"
version = "0.8.2"
version = "0.8.12"
dependencies = [
"anyhow",
"async-trait",
@@ -617,6 +627,7 @@ dependencies = [
"crossterm",
"dirs",
"dotenvy",
"fluent-templates",
"futures",
"lazy_static",
"prost",
@@ -638,6 +649,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"tui-pages",
"unic-langid",
"unicode-segmentation",
"unicode-width 0.2.2",
"uuid",
@@ -679,7 +691,7 @@ dependencies = [
[[package]]
name = "common"
version = "0.8.2"
version = "0.8.12"
dependencies = [
"prost",
"prost-build",
@@ -1465,6 +1477,82 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "fluent-bundle"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01203cb8918f5711e73891b347816d932046f95f54207710bda99beaeb423bf4"
dependencies = [
"fluent-langneg",
"fluent-syntax",
"intl-memoizer",
"intl_pluralrules",
"rustc-hash",
"self_cell",
"smallvec",
"unic-langid",
]
[[package]]
name = "fluent-langneg"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7eebbe59450baee8282d71676f3bfed5689aeab00b27545e83e5f14b1195e8b0"
dependencies = [
"unic-langid",
]
[[package]]
name = "fluent-syntax"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54f0d287c53ffd184d04d8677f590f4ac5379785529e5e08b1c8083acdd5c198"
dependencies = [
"memchr",
"thiserror 2.0.18",
]
[[package]]
name = "fluent-template-macros"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6b1dac7e7f07f8a60aa844f616bede13deeffaf24e9e35ae9e4979a7dac4a5c"
dependencies = [
"flume 0.11.1",
"ignore",
"proc-macro2",
"quote",
"syn 2.0.117",
"unic-langid",
]
[[package]]
name = "fluent-templates"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d48ac2b8e7c3a2198fc584af78e674d15dacdede8a6cebb686c844713f7d0ba"
dependencies = [
"fluent-bundle",
"fluent-langneg",
"fluent-syntax",
"fluent-template-macros",
"flume 0.11.1",
"ignore",
"intl-memoizer",
"log",
"thiserror 2.0.18",
"unic-langid",
]
[[package]]
name = "flume"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095"
dependencies = [
"spin",
]
[[package]]
name = "flume"
version = "0.12.0"
@@ -1709,6 +1797,19 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "globset"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3"
dependencies = [
"aho-corasick",
"bstr",
"log",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "group"
version = "0.13.0"
@@ -2144,6 +2245,22 @@ dependencies = [
"icu_properties",
]
[[package]]
name = "ignore"
version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b915661dd01db3f05050265b2477bcc6527b3792388e2749b41623cc592be67d"
dependencies = [
"crossbeam-deque",
"globset",
"log",
"memchr",
"regex-automata",
"same-file",
"walkdir",
"winapi-util",
]
[[package]]
name = "im"
version = "15.1.0"
@@ -2251,6 +2368,25 @@ dependencies = [
"syn 2.0.117",
]
[[package]]
name = "intl-memoizer"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "310da2e345f5eb861e7a07ee182262e94975051db9e4223e909ba90f392f163f"
dependencies = [
"type-map",
"unic-langid",
]
[[package]]
name = "intl_pluralrules"
version = "7.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972"
dependencies = [
"unic-langid",
]
[[package]]
name = "inventory"
version = "0.3.24"
@@ -3290,6 +3426,12 @@ dependencies = [
"syn 2.0.117",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.20+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.106"
@@ -3908,7 +4050,7 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "search"
version = "0.8.2"
version = "0.8.12"
dependencies = [
"anyhow",
"common",
@@ -3937,6 +4079,12 @@ dependencies = [
"zeroize",
]
[[package]]
name = "self_cell"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89"
[[package]]
name = "semver"
version = "1.0.28"
@@ -3997,7 +4145,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.8.2"
version = "0.8.12"
dependencies = [
"anyhow",
"bcrypt",
@@ -4034,7 +4182,7 @@ dependencies = [
"tonic-reflection",
"tracing",
"tracing-subscriber",
"tui-canvas-validation-core 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tui-canvas-validation-core 0.8.2",
"unicode-width 0.2.2",
"uuid",
"validator",
@@ -4398,7 +4546,7 @@ checksum = "488e99c397a62007e4229aec669a179816339afc6d2620ca6fa420dbee2e982c"
dependencies = [
"atoi",
"chrono",
"flume",
"flume 0.12.0",
"form_urlencoded",
"futures-channel",
"futures-core",
@@ -5345,7 +5493,7 @@ checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a"
[[package]]
name = "tui-canvas"
version = "0.8.5"
version = "0.8.12"
dependencies = [
"anyhow",
"arboard",
@@ -5364,17 +5512,7 @@ dependencies = [
"toml",
"tracing",
"tracing-subscriber",
"tui-canvas-validation-core 0.8.2",
"unicode-width 0.2.2",
]
[[package]]
name = "tui-canvas-validation-core"
version = "0.8.2"
dependencies = [
"regex",
"serde",
"thiserror 2.0.18",
"tui-canvas-validation-core 0.8.12",
"unicode-width 0.2.2",
]
@@ -5389,9 +5527,19 @@ dependencies = [
"unicode-width 0.2.2",
]
[[package]]
name = "tui-canvas-validation-core"
version = "0.8.12"
dependencies = [
"regex",
"serde",
"thiserror 2.0.18",
"unicode-width 0.2.2",
]
[[package]]
name = "tui-pages"
version = "0.8.5"
version = "0.8.12"
dependencies = [
"crossterm",
"nucleo",
@@ -5404,6 +5552,15 @@ dependencies = [
"unicode-width 0.2.2",
]
[[package]]
name = "type-map"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90"
dependencies = [
"rustc-hash",
]
[[package]]
name = "typed-arena"
version = "2.0.2"
@@ -5458,6 +5615,49 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
[[package]]
name = "unic-langid"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28ba52c9b05311f4f6e62d5d9d46f094bd6e84cb8df7b3ef952748d752a7d05"
dependencies = [
"unic-langid-impl",
"unic-langid-macros",
]
[[package]]
name = "unic-langid-impl"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dce1bf08044d4b7a94028c93786f8566047edc11110595914de93362559bc658"
dependencies = [
"tinystr",
]
[[package]]
name = "unic-langid-macros"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5957eb82e346d7add14182a3315a7e298f04e1ba4baac36f7f0dbfedba5fc25"
dependencies = [
"proc-macro-hack",
"tinystr",
"unic-langid-impl",
"unic-langid-macros-impl",
]
[[package]]
name = "unic-langid-macros-impl"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1249a628de3ad34b821ecb1001355bca3940bcb2f88558f1a8bd82e977f75b5"
dependencies = [
"proc-macro-hack",
"quote",
"syn 2.0.117",
"unic-langid-impl",
]
[[package]]
name = "unicase"
version = "2.9.0"

View File

@@ -5,7 +5,7 @@ resolver = "3"
[workspace.package]
# TODO: idk how to do the name, fix later
# name = "komp_ac"
version = "0.8.8"
version = "0.8.12"
edition = "2024"
license = "GPL-3.0-or-later"
authors = ["Filip Priečinský <filippriec@gmail.com>"]

2
client

Submodule client updated: 061806c45f...89e87d71ab

View File

@@ -206,6 +206,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/common.proto",
"proto/adresar.proto",
"proto/auth.proto",
"proto/backup.proto",
"proto/search.proto",
"proto/search2.proto",
"proto/table_definition.proto",
@@ -229,6 +230,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/common.proto",
"proto/adresar.proto",
"proto/auth.proto",
"proto/backup.proto",
"proto/search.proto",
"proto/search2.proto",
"proto/table_definition.proto",

67
common/proto/backup.proto Normal file
View File

@@ -0,0 +1,67 @@
syntax = "proto3";
package komp_ac.backup;
import "common.proto";
service BackupService {
rpc StartBackup(StartBackupRequest) returns (BackupOperationResponse);
rpc StartCheck(komp_ac.common.Empty) returns (BackupOperationResponse);
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
rpc RestoreLatest(RestoreLatestRequest) returns (BackupOperationResponse);
rpc RestoreTarget(RestoreTargetRequest) returns (BackupOperationResponse);
}
enum BackupType {
BACKUP_TYPE_UNSPECIFIED = 0;
BACKUP_TYPE_FULL = 1;
BACKUP_TYPE_DIFF = 2;
BACKUP_TYPE_INCR = 3;
}
enum OperationKind {
OPERATION_KIND_UNSPECIFIED = 0;
OPERATION_KIND_BACKUP = 1;
OPERATION_KIND_CHECK = 2;
OPERATION_KIND_RESTORE = 3;
}
enum OperationStatus {
OPERATION_STATUS_UNSPECIFIED = 0;
OPERATION_STATUS_RUNNING = 1;
OPERATION_STATUS_SUCCEEDED = 2;
OPERATION_STATUS_FAILED = 3;
}
message StartBackupRequest {
BackupType backup_type = 1;
}
message RestoreLatestRequest {
string confirmation = 1;
}
message RestoreTargetRequest {
string confirmation = 1;
string target_type = 2;
string target = 3;
}
message GetOperationStatusRequest {
string operation_id = 1;
}
message BackupOperationResponse {
string operation_id = 1;
OperationKind kind = 2;
OperationStatus status = 3;
string message = 4;
string output = 5;
int64 started_at_unix_seconds = 6;
int64 finished_at_unix_seconds = 7;
}
message BackupInfoResponse {
bool success = 1;
string output = 2;
}

View File

@@ -10,6 +10,9 @@ pub mod proto {
pub mod auth {
include!("proto/komp_ac.auth.rs");
}
pub mod backup {
include!("proto/komp_ac.backup.rs");
}
pub mod common {
include!("proto/komp_ac.common.rs");
}

Binary file not shown.

View File

@@ -0,0 +1,833 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartBackupRequest {
#[prost(enumeration = "BackupType", tag = "1")]
pub backup_type: i32,
}
#[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 {
#[prost(string, tag = "1")]
pub operation_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BackupOperationResponse {
#[prost(string, tag = "1")]
pub operation_id: ::prost::alloc::string::String,
#[prost(enumeration = "OperationKind", tag = "2")]
pub kind: i32,
#[prost(enumeration = "OperationStatus", tag = "3")]
pub status: i32,
#[prost(string, tag = "4")]
pub message: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub output: ::prost::alloc::string::String,
#[prost(int64, tag = "6")]
pub started_at_unix_seconds: i64,
#[prost(int64, tag = "7")]
pub finished_at_unix_seconds: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BackupInfoResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub output: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BackupType {
Unspecified = 0,
Full = 1,
Diff = 2,
Incr = 3,
}
impl BackupType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "BACKUP_TYPE_UNSPECIFIED",
Self::Full => "BACKUP_TYPE_FULL",
Self::Diff => "BACKUP_TYPE_DIFF",
Self::Incr => "BACKUP_TYPE_INCR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BACKUP_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"BACKUP_TYPE_FULL" => Some(Self::Full),
"BACKUP_TYPE_DIFF" => Some(Self::Diff),
"BACKUP_TYPE_INCR" => Some(Self::Incr),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationKind {
Unspecified = 0,
Backup = 1,
Check = 2,
Restore = 3,
}
impl OperationKind {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "OPERATION_KIND_UNSPECIFIED",
Self::Backup => "OPERATION_KIND_BACKUP",
Self::Check => "OPERATION_KIND_CHECK",
Self::Restore => "OPERATION_KIND_RESTORE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_KIND_UNSPECIFIED" => Some(Self::Unspecified),
"OPERATION_KIND_BACKUP" => Some(Self::Backup),
"OPERATION_KIND_CHECK" => Some(Self::Check),
"OPERATION_KIND_RESTORE" => Some(Self::Restore),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationStatus {
Unspecified = 0,
Running = 1,
Succeeded = 2,
Failed = 3,
}
impl OperationStatus {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "OPERATION_STATUS_UNSPECIFIED",
Self::Running => "OPERATION_STATUS_RUNNING",
Self::Succeeded => "OPERATION_STATUS_SUCCEEDED",
Self::Failed => "OPERATION_STATUS_FAILED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"OPERATION_STATUS_RUNNING" => Some(Self::Running),
"OPERATION_STATUS_SUCCEEDED" => Some(Self::Succeeded),
"OPERATION_STATUS_FAILED" => Some(Self::Failed),
_ => None,
}
}
}
/// Generated client implementations.
pub mod backup_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BackupServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BackupServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BackupServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BackupServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BackupServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn start_backup(
&mut self,
request: impl tonic::IntoRequest<super::StartBackupRequest>,
) -> 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/StartBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.backup.BackupService", "StartBackup"));
self.inner.unary(req, path, codec).await
}
pub async fn start_check(
&mut self,
request: impl tonic::IntoRequest<super::super::common::Empty>,
) -> 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/StartCheck",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.backup.BackupService", "StartCheck"));
self.inner.unary(req, path, codec).await
}
pub async fn get_backup_info(
&mut self,
request: impl tonic::IntoRequest<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupInfoResponse>,
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/GetBackupInfo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "GetBackupInfo"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_operation_status(
&mut self,
request: impl tonic::IntoRequest<super::GetOperationStatusRequest>,
) -> 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/GetOperationStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "GetOperationStatus"),
);
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.
pub mod backup_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with BackupServiceServer.
#[async_trait]
pub trait BackupService: std::marker::Send + std::marker::Sync + 'static {
async fn start_backup(
&self,
request: tonic::Request<super::StartBackupRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn start_check(
&self,
request: tonic::Request<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn get_backup_info(
&self,
request: tonic::Request<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupInfoResponse>,
tonic::Status,
>;
async fn get_operation_status(
&self,
request: tonic::Request<super::GetOperationStatusRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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)]
pub struct BackupServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BackupServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BackupServiceServer<T>
where
T: BackupService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/komp_ac.backup.BackupService/StartBackup" => {
#[allow(non_camel_case_types)]
struct StartBackupSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::StartBackupRequest>
for StartBackupSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StartBackupRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::start_backup(&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 = StartBackupSvc(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/StartCheck" => {
#[allow(non_camel_case_types)]
struct StartCheckSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::super::common::Empty>
for StartCheckSvc<T> {
type Response = super::BackupOperationResponse;
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>::start_check(&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 = StartCheckSvc(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/GetBackupInfo" => {
#[allow(non_camel_case_types)]
struct GetBackupInfoSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::super::common::Empty>
for GetBackupInfoSvc<T> {
type Response = super::BackupInfoResponse;
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>::get_backup_info(&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 = GetBackupInfoSvc(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/GetOperationStatus" => {
#[allow(non_camel_case_types)]
struct GetOperationStatusSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::GetOperationStatusRequest>
for GetOperationStatusSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetOperationStatusRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::get_operation_status(&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 = GetOperationStatusSvc(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/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 {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for BackupServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "komp_ac.backup.BackupService";
impl<T> tonic::server::NamedService for BackupServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

2
server

Submodule server updated: f1008191cf...a0c8fd1a77