accounting kernel4

This commit is contained in:
Priec
2026-07-20 17:44:54 +02:00
parent c70360532c
commit 8b14e4d6d6
7 changed files with 264 additions and 156 deletions

218
Cargo.lock generated
View File

@@ -90,6 +90,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "alloca"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "allocator-api2" name = "allocator-api2"
version = "0.2.21" version = "0.2.21"
@@ -119,6 +128,18 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "anes"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]]
name = "anstyle"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.102" version = "1.0.102"
@@ -959,6 +980,33 @@ dependencies = [
"phf 0.12.1", "phf 0.12.1",
] ]
[[package]]
name = "ciborium"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
dependencies = [
"ciborium-io",
"ciborium-ll",
"serde",
]
[[package]]
name = "ciborium-io"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
[[package]]
name = "ciborium-ll"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
dependencies = [
"ciborium-io",
"half",
]
[[package]] [[package]]
name = "cipher" name = "cipher"
version = "0.5.2" version = "0.5.2"
@@ -969,6 +1017,31 @@ dependencies = [
"inout", "inout",
] ]
[[package]]
name = "clap"
version = "4.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fb99565819980999fb7b4a1796046a5c949e6d4ff132cf5fadf5a641e20d776"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b"
dependencies = [
"anstyle",
"clap_lex",
]
[[package]]
name = "clap_lex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]] [[package]]
name = "client" name = "client"
version = "0.8.30" version = "0.8.30"
@@ -1265,6 +1338,41 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "criterion"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
dependencies = [
"alloca",
"anes",
"cast",
"ciborium",
"clap",
"criterion-plot",
"itertools 0.13.0",
"num-traits",
"oorandom",
"page_size",
"plotters",
"rayon",
"regex",
"serde",
"serde_json",
"tinytemplate",
"walkdir",
]
[[package]]
name = "criterion-plot"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
dependencies = [
"cast",
"itertools 0.13.0",
]
[[package]] [[package]]
name = "critical-section" name = "critical-section"
version = "1.2.0" version = "1.2.0"
@@ -1571,7 +1679,7 @@ dependencies = [
"datafusion-sql", "datafusion-sql",
"futures", "futures",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"log", "log",
"object_store", "object_store",
"parking_lot", "parking_lot",
@@ -1600,7 +1708,7 @@ dependencies = [
"datafusion-physical-plan", "datafusion-physical-plan",
"datafusion-session", "datafusion-session",
"futures", "futures",
"itertools", "itertools 0.14.0",
"log", "log",
"object_store", "object_store",
"parking_lot", "parking_lot",
@@ -1625,7 +1733,7 @@ dependencies = [
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"datafusion-physical-plan", "datafusion-physical-plan",
"futures", "futures",
"itertools", "itertools 0.14.0",
"log", "log",
"object_store", "object_store",
] ]
@@ -1644,7 +1752,7 @@ dependencies = [
"half", "half",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"libc", "libc",
"log", "log",
"object_store", "object_store",
@@ -1686,7 +1794,7 @@ dependencies = [
"datafusion-session", "datafusion-session",
"futures", "futures",
"glob", "glob",
"itertools", "itertools 0.14.0",
"log", "log",
"object_store", "object_store",
"parking_lot", "parking_lot",
@@ -1714,7 +1822,7 @@ dependencies = [
"datafusion-physical-plan", "datafusion-physical-plan",
"datafusion-session", "datafusion-session",
"futures", "futures",
"itertools", "itertools 0.14.0",
"object_store", "object_store",
"tokio", "tokio",
] ]
@@ -1810,7 +1918,7 @@ dependencies = [
"datafusion-functions-window-common", "datafusion-functions-window-common",
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"serde_json", "serde_json",
"sqlparser", "sqlparser",
] ]
@@ -1824,7 +1932,7 @@ dependencies = [
"arrow", "arrow",
"datafusion-common", "datafusion-common",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
] ]
[[package]] [[package]]
@@ -1846,7 +1954,7 @@ dependencies = [
"datafusion-macros", "datafusion-macros",
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"hex", "hex",
"itertools", "itertools 0.14.0",
"log", "log",
"memchr", "memchr",
"num-traits", "num-traits",
@@ -1907,7 +2015,7 @@ dependencies = [
"datafusion-macros", "datafusion-macros",
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"itertools", "itertools 0.14.0",
"itoa", "itoa",
"log", "log",
"memchr", "memchr",
@@ -1980,7 +2088,7 @@ dependencies = [
"datafusion-expr-common", "datafusion-expr-common",
"datafusion-physical-expr", "datafusion-physical-expr",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"log", "log",
"regex", "regex",
"regex-syntax 0.8.11", "regex-syntax 0.8.11",
@@ -2001,7 +2109,7 @@ dependencies = [
"half", "half",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"parking_lot", "parking_lot",
"petgraph 0.8.3", "petgraph 0.8.3",
"tokio", "tokio",
@@ -2019,7 +2127,7 @@ dependencies = [
"datafusion-functions", "datafusion-functions",
"datafusion-physical-expr", "datafusion-physical-expr",
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"itertools", "itertools 0.14.0",
] ]
[[package]] [[package]]
@@ -2034,7 +2142,7 @@ dependencies = [
"datafusion-expr-common", "datafusion-expr-common",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"parking_lot", "parking_lot",
"pin-project", "pin-project",
] ]
@@ -2054,7 +2162,7 @@ dependencies = [
"datafusion-physical-expr-common", "datafusion-physical-expr-common",
"datafusion-physical-plan", "datafusion-physical-plan",
"datafusion-pruning", "datafusion-pruning",
"itertools", "itertools 0.14.0",
] ]
[[package]] [[package]]
@@ -2082,7 +2190,7 @@ dependencies = [
"half", "half",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indexmap 2.14.0", "indexmap 2.14.0",
"itertools", "itertools 0.14.0",
"log", "log",
"num-traits", "num-traits",
"parking_lot", "parking_lot",
@@ -2161,7 +2269,7 @@ dependencies = [
"futures", "futures",
"geo-types", "geo-types",
"hickory-resolver", "hickory-resolver",
"itertools", "itertools 0.14.0",
"logos", "logos",
"native-tls", "native-tls",
"num-bigint", "num-bigint",
@@ -3817,6 +3925,15 @@ dependencies = [
"thiserror 1.0.69", "thiserror 1.0.69",
] ]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.14.0" version = "0.14.0"
@@ -4689,7 +4806,7 @@ dependencies = [
"futures-util", "futures-util",
"http", "http",
"humantime", "humantime",
"itertools", "itertools 0.14.0",
"parking_lot", "parking_lot",
"percent-encoding", "percent-encoding",
"thiserror 2.0.18", "thiserror 2.0.18",
@@ -4831,6 +4948,16 @@ dependencies = [
"sha2 0.10.9", "sha2 0.10.9",
] ]
[[package]]
name = "page_size"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "palette" name = "palette"
version = "0.7.6" version = "0.7.6"
@@ -5155,6 +5282,34 @@ dependencies = [
"time", "time",
] ]
[[package]]
name = "plotters"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
dependencies = [
"num-traits",
"plotters-backend",
"plotters-svg",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "plotters-backend"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
[[package]]
name = "plotters-svg"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
dependencies = [
"plotters-backend",
]
[[package]] [[package]]
name = "png" name = "png"
version = "0.18.1" version = "0.18.1"
@@ -5386,7 +5541,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042" checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"itertools", "itertools 0.14.0",
"log", "log",
"multimap", "multimap",
"petgraph 0.8.3", "petgraph 0.8.3",
@@ -5407,7 +5562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf" checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools 0.14.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.117", "syn 2.0.117",
@@ -5688,7 +5843,7 @@ dependencies = [
"critical-section", "critical-section",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indoc", "indoc",
"itertools", "itertools 0.14.0",
"kasuari", "kasuari",
"lru 0.18.0", "lru 0.18.0",
"palette", "palette",
@@ -5742,7 +5897,7 @@ dependencies = [
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indoc", "indoc",
"instability", "instability",
"itertools", "itertools 0.14.0",
"line-clipping", "line-clipping",
"ratatui-core", "ratatui-core",
"serde", "serde",
@@ -7237,7 +7392,7 @@ dependencies = [
"fnv", "fnv",
"fs4", "fs4",
"htmlescape", "htmlescape",
"itertools", "itertools 0.14.0",
"levenshtein_automata", "levenshtein_automata",
"log", "log",
"lru 0.16.4", "lru 0.16.4",
@@ -7286,7 +7441,7 @@ checksum = "c57166f5bcfd478f370ab8445afb4678dce44801fa5ce5c451aaf8595583c5dc"
dependencies = [ dependencies = [
"downcast-rs", "downcast-rs",
"fastdivide", "fastdivide",
"itertools", "itertools 0.14.0",
"serde", "serde",
"tantivy-bitpacker", "tantivy-bitpacker",
"tantivy-common", "tantivy-common",
@@ -7338,7 +7493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a2cfc3ac5164cbadc28965ffb145a8f47582a60ae5897859ad8d4316596c606" checksum = "8a2cfc3ac5164cbadc28965ffb145a8f47582a60ae5897859ad8d4316596c606"
dependencies = [ dependencies = [
"futures-util", "futures-util",
"itertools", "itertools 0.14.0",
"tantivy-bitpacker", "tantivy-bitpacker",
"tantivy-common", "tantivy-common",
"tantivy-fst", "tantivy-fst",
@@ -7580,6 +7735,16 @@ dependencies = [
"zerovec", "zerovec",
] ]
[[package]]
name = "tinytemplate"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
"serde",
"serde_json",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.11.0" version = "1.11.0"
@@ -8015,6 +8180,7 @@ dependencies = [
name = "tui-pages" name = "tui-pages"
version = "0.8.30" version = "0.8.30"
dependencies = [ dependencies = [
"criterion",
"crossterm", "crossterm",
"nucleo", "nucleo",
"ratatui", "ratatui",
@@ -8183,7 +8349,7 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5" checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"
dependencies = [ dependencies = [
"itertools", "itertools 0.14.0",
"unicode-segmentation", "unicode-segmentation",
"unicode-width 0.2.2", "unicode-width 0.2.2",
] ]

2
client

Submodule client updated: 40c6db688d...0a4284fa0d

View File

@@ -4,8 +4,9 @@ package komp_ac.accounting;
// Mutable informational journals. A journal may contain only debits, only // Mutable informational journals. A journal may contain only debits, only
// credits, or any non-zero balance. Balance is reported but never enforced. // credits, or any non-zero balance. Balance is reported but never enforced.
service Accounting { service Accounting {
// Create an empty journal and return its generated journal_id. // Create a journal with its first lines when journal_id is absent, or append
rpc CreateJournal(CreateJournalRequest) returns (Journal); // all supplied lines atomically when journal_id identifies an existing one.
rpc PostJournal(PostJournalRequest) returns (Journal);
// Return journal lines and credits-minus-debits informational balance. // Return journal lines and credits-minus-debits informational balance.
rpc GetJournal(GetJournalRequest) returns (Journal); rpc GetJournal(GetJournalRequest) returns (Journal);
@@ -17,9 +18,6 @@ service Accounting {
rpc ListUnbalancedJournals(ListUnbalancedJournalsRequest) rpc ListUnbalancedJournals(ListUnbalancedJournalsRequest)
returns (ListUnbalancedJournalsResponse); returns (ListUnbalancedJournalsResponse);
// Append one manual debit or credit line to an existing journal.
rpc AddJournalLine(AddJournalLineRequest) returns (Journal);
// Soft-delete one line while retaining it for audit display. // Soft-delete one line while retaining it for audit display.
rpc SoftDeleteJournalLine(SoftDeleteJournalLineRequest) returns (Journal); rpc SoftDeleteJournalLine(SoftDeleteJournalLineRequest) returns (Journal);
} }
@@ -34,10 +32,30 @@ enum JournalSide {
JOURNAL_SIDE_CREDIT = 2; JOURNAL_SIDE_CREDIT = 2;
} }
message CreateJournalRequest { message PostJournalRequest {
string profile_name = 1; string profile_name = 1;
string currency = 2;
string description = 3; // Absent creates a new journal. Present must identify an existing journal;
// an unknown id is never treated as a request to create one.
optional int64 journal_id = 2;
// Required when creating. When appending, empty uses the journal currency;
// a supplied value must match it exactly.
string currency = 3;
// Applied when creating and required to be empty when appending.
string description = 4;
// At least one line is required. The lines are inserted atomically and the
// journal is allowed to remain unbalanced.
repeated JournalLineInput lines = 5;
}
message JournalLineInput {
JournalSide side = 1;
string account_code = 2;
string amount = 3;
string description = 4;
} }
message GetJournalRequest { message GetJournalRequest {
@@ -98,15 +116,6 @@ message ListUnbalancedJournalsResponse {
string next_page_token = 3; string next_page_token = 3;
} }
message AddJournalLineRequest {
string profile_name = 1;
int64 journal_id = 2;
JournalSide side = 3;
string account_code = 4;
string amount = 5;
string description = 6;
}
message SoftDeleteJournalLineRequest { message SoftDeleteJournalLineRequest {
string profile_name = 1; string profile_name = 1;
int64 journal_id = 2; int64 journal_id = 2;

Binary file not shown.

View File

@@ -1,11 +1,33 @@
// This file is @generated by prost-build. // This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateJournalRequest { pub struct PostJournalRequest {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String, pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")] /// Absent creates a new journal. Present must identify an existing journal;
pub currency: ::prost::alloc::string::String, /// an unknown id is never treated as a request to create one.
#[prost(int64, optional, tag = "2")]
pub journal_id: ::core::option::Option<i64>,
/// Required when creating. When appending, empty uses the journal currency;
/// a supplied value must match it exactly.
#[prost(string, tag = "3")] #[prost(string, tag = "3")]
pub currency: ::prost::alloc::string::String,
/// Applied when creating and required to be empty when appending.
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
/// At least one line is required. The lines are inserted atomically and the
/// journal is allowed to remain unbalanced.
#[prost(message, repeated, tag = "5")]
pub lines: ::prost::alloc::vec::Vec<JournalLineInput>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JournalLineInput {
#[prost(enumeration = "JournalSide", tag = "1")]
pub side: i32,
#[prost(string, tag = "2")]
pub account_code: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub amount: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String, pub description: ::prost::alloc::string::String,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
@@ -87,21 +109,6 @@ pub struct ListUnbalancedJournalsResponse {
pub next_page_token: ::prost::alloc::string::String, pub next_page_token: ::prost::alloc::string::String,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddJournalLineRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub journal_id: i64,
#[prost(enumeration = "JournalSide", tag = "3")]
pub side: i32,
#[prost(string, tag = "4")]
pub account_code: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub amount: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub description: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SoftDeleteJournalLineRequest { pub struct SoftDeleteJournalLineRequest {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String, pub profile_name: ::prost::alloc::string::String,
@@ -283,10 +290,11 @@ pub mod accounting_client {
self.inner = self.inner.max_encoding_message_size(limit); self.inner = self.inner.max_encoding_message_size(limit);
self self
} }
/// Create an empty journal and return its generated journal_id. /// Create a journal with its first lines when journal_id is absent, or append
pub async fn create_journal( /// all supplied lines atomically when journal_id identifies an existing one.
pub async fn post_journal(
&mut self, &mut self,
request: impl tonic::IntoRequest<super::CreateJournalRequest>, request: impl tonic::IntoRequest<super::PostJournalRequest>,
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> { ) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
self.inner self.inner
.ready() .ready()
@@ -298,13 +306,11 @@ pub mod accounting_client {
})?; })?;
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static( let path = http::uri::PathAndQuery::from_static(
"/komp_ac.accounting.Accounting/CreateJournal", "/komp_ac.accounting.Accounting/PostJournal",
); );
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut() req.extensions_mut()
.insert( .insert(GrpcMethod::new("komp_ac.accounting.Accounting", "PostJournal"));
GrpcMethod::new("komp_ac.accounting.Accounting", "CreateJournal"),
);
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Return journal lines and credits-minus-debits informational balance. /// Return journal lines and credits-minus-debits informational balance.
@@ -389,30 +395,6 @@ pub mod accounting_client {
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Append one manual debit or credit line to an existing journal.
pub async fn add_journal_line(
&mut self,
request: impl tonic::IntoRequest<super::AddJournalLineRequest>,
) -> std::result::Result<tonic::Response<super::Journal>, 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.accounting.Accounting/AddJournalLine",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.accounting.Accounting", "AddJournalLine"),
);
self.inner.unary(req, path, codec).await
}
/// Soft-delete one line while retaining it for audit display. /// Soft-delete one line while retaining it for audit display.
pub async fn soft_delete_journal_line( pub async fn soft_delete_journal_line(
&mut self, &mut self,
@@ -455,10 +437,11 @@ pub mod accounting_server {
/// Generated trait containing gRPC methods that should be implemented for use with AccountingServer. /// Generated trait containing gRPC methods that should be implemented for use with AccountingServer.
#[async_trait] #[async_trait]
pub trait Accounting: std::marker::Send + std::marker::Sync + 'static { pub trait Accounting: std::marker::Send + std::marker::Sync + 'static {
/// Create an empty journal and return its generated journal_id. /// Create a journal with its first lines when journal_id is absent, or append
async fn create_journal( /// all supplied lines atomically when journal_id identifies an existing one.
async fn post_journal(
&self, &self,
request: tonic::Request<super::CreateJournalRequest>, request: tonic::Request<super::PostJournalRequest>,
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>; ) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
/// Return journal lines and credits-minus-debits informational balance. /// Return journal lines and credits-minus-debits informational balance.
async fn get_journal( async fn get_journal(
@@ -481,11 +464,6 @@ pub mod accounting_server {
tonic::Response<super::ListUnbalancedJournalsResponse>, tonic::Response<super::ListUnbalancedJournalsResponse>,
tonic::Status, tonic::Status,
>; >;
/// Append one manual debit or credit line to an existing journal.
async fn add_journal_line(
&self,
request: tonic::Request<super::AddJournalLineRequest>,
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
/// Soft-delete one line while retaining it for audit display. /// Soft-delete one line while retaining it for audit display.
async fn soft_delete_journal_line( async fn soft_delete_journal_line(
&self, &self,
@@ -570,13 +548,13 @@ pub mod accounting_server {
} }
fn call(&mut self, req: http::Request<B>) -> Self::Future { fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() { match req.uri().path() {
"/komp_ac.accounting.Accounting/CreateJournal" => { "/komp_ac.accounting.Accounting/PostJournal" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct CreateJournalSvc<T: Accounting>(pub Arc<T>); struct PostJournalSvc<T: Accounting>(pub Arc<T>);
impl< impl<
T: Accounting, T: Accounting,
> tonic::server::UnaryService<super::CreateJournalRequest> > tonic::server::UnaryService<super::PostJournalRequest>
for CreateJournalSvc<T> { for PostJournalSvc<T> {
type Response = super::Journal; type Response = super::Journal;
type Future = BoxFuture< type Future = BoxFuture<
tonic::Response<Self::Response>, tonic::Response<Self::Response>,
@@ -584,11 +562,11 @@ pub mod accounting_server {
>; >;
fn call( fn call(
&mut self, &mut self,
request: tonic::Request<super::CreateJournalRequest>, request: tonic::Request<super::PostJournalRequest>,
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as Accounting>::create_journal(&inner, request).await <T as Accounting>::post_journal(&inner, request).await
}; };
Box::pin(fut) Box::pin(fut)
} }
@@ -599,7 +577,7 @@ pub mod accounting_server {
let max_encoding_message_size = self.max_encoding_message_size; let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone(); let inner = self.inner.clone();
let fut = async move { let fut = async move {
let method = CreateJournalSvc(inner); let method = PostJournalSvc(inner);
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec) let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config( .apply_compression_config(
@@ -752,51 +730,6 @@ pub mod accounting_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/komp_ac.accounting.Accounting/AddJournalLine" => {
#[allow(non_camel_case_types)]
struct AddJournalLineSvc<T: Accounting>(pub Arc<T>);
impl<
T: Accounting,
> tonic::server::UnaryService<super::AddJournalLineRequest>
for AddJournalLineSvc<T> {
type Response = super::Journal;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AddJournalLineRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Accounting>::add_journal_line(&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 = AddJournalLineSvc(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.accounting.Accounting/SoftDeleteJournalLine" => { "/komp_ac.accounting.Accounting/SoftDeleteJournalLine" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct SoftDeleteJournalLineSvc<T: Accounting>(pub Arc<T>); struct SoftDeleteJournalLineSvc<T: Accounting>(pub Arc<T>);

2
server

Submodule server updated: cf30823119...3d145bfc4b