search fix to new architecture
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,9 @@
|
||||
// This file is @generated by prost-build.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct SearchCountResponse {
|
||||
#[prost(uint64, tag = "1")]
|
||||
pub count: u64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct ColumnConstraint {
|
||||
#[prost(string, tag = "1")]
|
||||
@@ -24,6 +29,11 @@ pub struct SearchRequest {
|
||||
pub offset: ::core::option::Option<u32>,
|
||||
#[prost(message, optional, tag = "7")]
|
||||
pub order: ::core::option::Option<SearchOrder>,
|
||||
/// Current rows are the default so pickers and relationship counts never
|
||||
/// select historical records. Callers may explicitly search immutable row
|
||||
/// archives as well.
|
||||
#[prost(enumeration = "SearchVersionScope", tag = "8")]
|
||||
pub version_scope: i32,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct SearchOrder {
|
||||
@@ -59,6 +69,12 @@ pub mod search_response {
|
||||
>,
|
||||
#[prost(uint64, optional, tag = "7")]
|
||||
pub position: ::core::option::Option<u64>,
|
||||
/// Version 0 means the source predates managed row versioning. New managed
|
||||
/// rows always return a positive version.
|
||||
#[prost(int64, tag = "8")]
|
||||
pub version_number: i64,
|
||||
#[prost(bool, tag = "9")]
|
||||
pub archived: bool,
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
@@ -92,6 +108,35 @@ impl MatchMode {
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum SearchVersionScope {
|
||||
Current = 0,
|
||||
Archived = 1,
|
||||
All = 2,
|
||||
}
|
||||
impl SearchVersionScope {
|
||||
/// 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::Current => "SEARCH_VERSION_SCOPE_CURRENT",
|
||||
Self::Archived => "SEARCH_VERSION_SCOPE_ARCHIVED",
|
||||
Self::All => "SEARCH_VERSION_SCOPE_ALL",
|
||||
}
|
||||
}
|
||||
/// Creates an enum from field names used in the ProtoBuf definition.
|
||||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
||||
match value {
|
||||
"SEARCH_VERSION_SCOPE_CURRENT" => Some(Self::Current),
|
||||
"SEARCH_VERSION_SCOPE_ARCHIVED" => Some(Self::Archived),
|
||||
"SEARCH_VERSION_SCOPE_ALL" => Some(Self::All),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum SearchOrderDirection {
|
||||
Unspecified = 0,
|
||||
Asc = 1,
|
||||
@@ -231,6 +276,30 @@ pub mod searcher_client {
|
||||
.insert(GrpcMethod::new("komp_ac.search.Searcher", "Search"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn count(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::SearchRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::SearchCountResponse>,
|
||||
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/Count",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(GrpcMethod::new("komp_ac.search.Searcher", "Count"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Generated server implementations.
|
||||
@@ -250,6 +319,13 @@ pub mod searcher_server {
|
||||
&self,
|
||||
request: tonic::Request<super::SearchRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status>;
|
||||
async fn count(
|
||||
&self,
|
||||
request: tonic::Request<super::SearchRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::SearchCountResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub struct SearcherServer<T> {
|
||||
@@ -370,6 +446,49 @@ pub mod searcher_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.search.Searcher/Count" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct CountSvc<T: Searcher>(pub Arc<T>);
|
||||
impl<T: Searcher> tonic::server::UnaryService<super::SearchRequest>
|
||||
for CountSvc<T> {
|
||||
type Response = super::SearchCountResponse;
|
||||
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>::count(&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 = CountSvc(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(
|
||||
|
||||
Reference in New Issue
Block a user