diff --git a/Cargo.lock b/Cargo.lock index 060bc130..a26eee30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,7 +207,7 @@ dependencies = [ "objc2-foundation", "parking_lot", "percent-encoding", - "windows-sys 0.59.0", + "windows-sys 0.52.0", "x11rb", ] @@ -1161,7 +1161,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "client" -version = "0.8.50" +version = "0.8.54" dependencies = [ "anyhow", "async-trait", @@ -1282,7 +1282,7 @@ dependencies = [ [[package]] name = "common" -version = "0.8.50" +version = "0.8.54" dependencies = [ "icu_casemap", "prost", @@ -2574,7 +2574,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2738,7 +2738,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4248,7 +4248,7 @@ dependencies = [ [[package]] name = "komp-app" -version = "0.8.50" +version = "0.8.54" dependencies = [ "anyhow", "common", @@ -4749,7 +4749,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5934,7 +5934,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6618,7 +6618,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6675,7 +6675,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6782,7 +6782,7 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "search" -version = "0.8.50" +version = "0.8.54" dependencies = [ "anyhow", "common", @@ -6970,7 +6970,7 @@ dependencies = [ [[package]] name = "server" -version = "0.8.50" +version = "0.8.54" dependencies = [ "anyhow", "bcrypt", @@ -7959,7 +7959,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -8562,7 +8562,7 @@ checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" [[package]] name = "tui-canvas" -version = "0.8.50" +version = "0.8.54" dependencies = [ "anyhow", "arboard", @@ -8593,7 +8593,7 @@ dependencies = [ [[package]] name = "tui-canvas-validation-core" -version = "0.8.50" +version = "0.8.54" dependencies = [ "regex", "serde", @@ -8603,7 +8603,7 @@ dependencies = [ [[package]] name = "tui-pages" -version = "0.8.50" +version = "0.8.54" dependencies = [ "criterion", "crossterm", @@ -8849,7 +8849,7 @@ dependencies = [ [[package]] name = "ux-config" -version = "0.8.50" +version = "0.8.54" dependencies = [ "toml", ] @@ -9323,7 +9323,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index debc6728..b40f6bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "3" [workspace.package] # TODO: idk how to do the name, fix later # name = "komp_ac" -version = "0.8.50" +version = "0.8.54" edition = "2024" license = "GPL-3.0-or-later" authors = ["Filip Priečinský "] diff --git a/client b/client index 53ec9866..efe9dfe0 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 53ec9866affe26dd539357909ff6c90ff4b6dfd6 +Subproject commit efe9dfe05b12b2fa414c85bbaa3bd38e4d4d2078 diff --git a/common/proto/search.proto b/common/proto/search.proto index 94cbc107..a5cd0335 100644 --- a/common/proto/search.proto +++ b/common/proto/search.proto @@ -3,9 +3,15 @@ syntax = "proto3"; package komp_ac.search; import "common.proto"; +import "tables_data.proto"; service Searcher { rpc Search(SearchRequest) returns (SearchResponse); + // Loads one current row at the zero-based offset using the requested filter + // and ordering. Requires a table and a nonempty filter; limit is ignored. + // Returns live authorized row data and one-based filtered navigation bounds. + // A missing position returns NOT_FOUND. Search and row reads are not a snapshot. + rpc GetFilteredRow(SearchRequest) returns (komp_ac.tables_data.GetTableDataResponse); rpc Count(SearchRequest) returns (SearchCountResponse); } diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index d0cd2ec2..c7a47173 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.search.rs b/common/src/proto/komp_ac.search.rs index 57377743..e08b008f 100644 --- a/common/src/proto/komp_ac.search.rs +++ b/common/src/proto/komp_ac.search.rs @@ -351,6 +351,34 @@ pub mod searcher_client { .insert(GrpcMethod::new("komp_ac.search.Searcher", "Search")); self.inner.unary(req, path, codec).await } + /// Loads one current row at the zero-based offset using the requested filter + /// and ordering. Requires a table and a nonempty filter; limit is ignored. + /// Returns live authorized row data and one-based filtered navigation bounds. + /// A missing position returns NOT_FOUND. Search and row reads are not a snapshot. + pub async fn get_filtered_row( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.search.Searcher/GetFilteredRow", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("komp_ac.search.Searcher", "GetFilteredRow")); + self.inner.unary(req, path, codec).await + } pub async fn count( &mut self, request: impl tonic::IntoRequest, @@ -394,6 +422,17 @@ pub mod searcher_server { &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; + /// Loads one current row at the zero-based offset using the requested filter + /// and ordering. Requires a table and a nonempty filter; limit is ignored. + /// Returns live authorized row data and one-based filtered navigation bounds. + /// A missing position returns NOT_FOUND. Search and row reads are not a snapshot. + async fn get_filtered_row( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn count( &self, request: tonic::Request, @@ -521,6 +560,49 @@ pub mod searcher_server { }; Box::pin(fut) } + "/komp_ac.search.Searcher/GetFilteredRow" => { + #[allow(non_camel_case_types)] + struct GetFilteredRowSvc(pub Arc); + impl tonic::server::UnaryService + for GetFilteredRowSvc { + type Response = super::super::tables_data::GetTableDataResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_filtered_row(&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 = GetFilteredRowSvc(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.search.Searcher/Count" => { #[allow(non_camel_case_types)] struct CountSvc(pub Arc); diff --git a/komp-app/src/grpc.rs b/komp-app/src/grpc.rs index ffc3a431..43615b62 100644 --- a/komp-app/src/grpc.rs +++ b/komp-app/src/grpc.rs @@ -1222,6 +1222,28 @@ impl GrpcClient { self.search_client.search(request).await } + pub async fn get_filtered_table_row( + &mut self, + profile_name: String, + table_name: String, + free_query: String, + must: Vec, + offset: u32, + order: Option, + ) -> Result { + let request = self.authenticated_request(SearchRequest { + profile_name, + table_name: Some(table_name), + free_query, + must, + limit: Some(1), + offset: Some(offset), + order, + version_scope: 0, + })?; + self.search_client.get_filtered_row(request).await + } + pub async fn count_table_rows( &mut self, profile_name: String, diff --git a/komp-app/src/search.rs b/komp-app/src/search.rs index e987be98..0370d916 100644 --- a/komp-app/src/search.rs +++ b/komp-app/src/search.rs @@ -21,6 +21,13 @@ impl SearchGrpc { Ok(self.client.search(request).await?.into_inner()) } + pub async fn get_filtered_row( + &mut self, + request: Request, + ) -> Result { + Ok(self.client.get_filtered_row(request).await?.into_inner()) + } + pub async fn count(&mut self, request: Request) -> Result { Ok(self.client.count(request).await?.into_inner()) } diff --git a/search/src/lib.rs b/search/src/lib.rs index 6cfaf527..575a9ee4 100644 --- a/search/src/lib.rs +++ b/search/src/lib.rs @@ -1981,6 +1981,13 @@ impl Searcher for SearcherService { } + async fn get_filtered_row( + &self, + _request: Request, + ) -> Result, Status> { + Err(Status::unimplemented("Filtered row loading requires the authorized full-text search service")) + } + async fn count( &self, request: Request, diff --git a/server b/server index dcbcf6eb..b085516e 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit dcbcf6ebc920656b38e7ecdf2e43a119bdc9a272 +Subproject commit b085516e17a37f4f8448e7022dd33183860f9775