filtered navigation batched

This commit is contained in:
Priec
2026-09-05 09:03:54 +02:00
parent 55689d0a8d
commit 52cfbd7070
10 changed files with 145 additions and 21 deletions

36
Cargo.lock generated
View File

@@ -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]]

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.50"
version = "0.8.54"
edition = "2024"
license = "GPL-3.0-or-later"
authors = ["Filip Priečinský <filippriec@gmail.com>"]

2
client

Submodule client updated: 53ec9866af...efe9dfe05b

View File

@@ -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);
}

Binary file not shown.

View File

@@ -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<super::SearchRequest>,
) -> std::result::Result<
tonic::Response<super::super::tables_data::GetTableDataResponse>,
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<super::SearchRequest>,
@@ -394,6 +422,17 @@ pub mod searcher_server {
&self,
request: tonic::Request<super::SearchRequest>,
) -> std::result::Result<tonic::Response<super::SearchResponse>, 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<super::SearchRequest>,
) -> std::result::Result<
tonic::Response<super::super::tables_data::GetTableDataResponse>,
tonic::Status,
>;
async fn count(
&self,
request: tonic::Request<super::SearchRequest>,
@@ -521,6 +560,49 @@ pub mod searcher_server {
};
Box::pin(fut)
}
"/komp_ac.search.Searcher/GetFilteredRow" => {
#[allow(non_camel_case_types)]
struct GetFilteredRowSvc<T: Searcher>(pub Arc<T>);
impl<T: Searcher> tonic::server::UnaryService<super::SearchRequest>
for GetFilteredRowSvc<T> {
type Response = super::super::tables_data::GetTableDataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SearchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Searcher>::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<T: Searcher>(pub Arc<T>);

View File

@@ -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<ColumnConstraint>,
offset: u32,
order: Option<SearchOrder>,
) -> Result<GetTableDataResponse> {
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,

View File

@@ -21,6 +21,13 @@ impl SearchGrpc {
Ok(self.client.search(request).await?.into_inner())
}
pub async fn get_filtered_row(
&mut self,
request: Request<SearchRequest>,
) -> Result<common::proto::komp_ac::tables_data::GetTableDataResponse> {
Ok(self.client.get_filtered_row(request).await?.into_inner())
}
pub async fn count(&mut self, request: Request<SearchRequest>) -> Result<SearchCountResponse> {
Ok(self.client.count(request).await?.into_inner())
}

View File

@@ -1981,6 +1981,13 @@ impl Searcher for SearcherService {
}
async fn get_filtered_row(
&self,
_request: Request<SearchRequest>,
) -> Result<Response<common::proto::komp_ac::tables_data::GetTableDataResponse>, Status> {
Err(Status::unimplemented("Filtered row loading requires the authorized full-text search service"))
}
async fn count(
&self,
request: Request<SearchRequest>,

2
server

Submodule server updated: dcbcf6ebc9...b085516e17