Compare commits

...

8 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
Priec
fa2d03b19e version v0.8.8 bump - closer to stabilizing pages api and implementing more features soon 2026-06-17 23:06:03 +02:00
Priec
32d593de55 better readme, finally working everything 2026-06-10 22:28:59 +02:00
12 changed files with 1515 additions and 112 deletions

664
Cargo.lock generated

File diff suppressed because it is too large Load Diff

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.2"
version = "0.8.12"
edition = "2024"
license = "GPL-3.0-or-later"
authors = ["Filip Priečinský <filippriec@gmail.com>"]
@@ -52,4 +52,14 @@ crossterm = "0.29.0"
toml = "1.1.2"
unicode-width = "0.2.2"
# Fuzzy matching (picker)
nucleo = "0.5.0"
common = { path = "./common" }
# Build against the in-tree tui-pages / tui-canvas (the source for the published
# crates) so local fixes take effect without a crates.io release. The published
# versions remain the declared dependency; this only redirects the source.
[patch.crates-io]
tui-pages = { path = "tui-pages" }
tui-canvas = { path = "tui-canvas" }

View File

@@ -1,20 +1,38 @@
# Hey
# komp_ac
This is only work in progress, until release 1.0.0 this is for development use cases only.
TUI accounting system. Client/server application with two extracted open-source
libraries.
I run development like this:
## Crates
| Crate | What | Published |
|-------|------|-----------|
| `client` | TUI application, uses `tui-pages` + `tui-canvas` | No - GPLv3 |
| `server` | Backend, gRPC services | No - AGPLv3 |
| `common` | Shared protobuf types | No - GPLv3 |
| `search` | Full-text search (Tantivy) | No - AGPLv3 |
| [`tui-pages`](https://crates.io/crates/tui-pages) | Multi-page TUI navigation framework | Yes — MIT, [docs](https://tui-pages.farmeris.sk) |
| [`tui-canvas`](https://crates.io/crates/tui-canvas) | Form / textarea / text input TUI widgets | Yes — MIT |
| `tui-canvas-validation-core` | Validation primitives for `tui-canvas` | Yes — MIT |
## Development
Server and client:
Server:
```
cargo watch -x 'run --package server -- server'
```
Client:
```
cargo watch --why -x 'run --package server -- server'
cargo watch -x 'run --package client -- client'
```
Client with tracing:
```
cargo run --package client --features ui-debug -- client
cargo watch -x 'run --package client --features ui-debug -- client'
```
## License
Application code (server, search): AGPL-3.0-or-later.
Application code (client, common): GPL-3.0-or-later.
Libraries (tui-canvas, tui-pages, tui-canvas-validation-core): MIT.

2
client

Submodule client updated: e800ead957...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: 3c3a1d6698...a0c8fd1a77