#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchRequest {
#[prost(string, tag="1")]
pub index_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub query: ::prost::alloc::string::String,
#[prost(string, repeated, tag="3")]
pub search_fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, optional, tag="4")]
pub start_timestamp: ::core::option::Option<i64>,
#[prost(int64, optional, tag="5")]
pub end_timestamp: ::core::option::Option<i64>,
#[prost(uint64, tag="6")]
pub max_hits: u64,
#[prost(uint64, tag="7")]
pub start_offset: u64,
#[prost(enumeration="SortOrder", optional, tag="9")]
pub sort_order: ::core::option::Option<i32>,
#[prost(string, optional, tag="10")]
pub sort_by_field: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="11")]
pub aggregation_request: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResponse {
#[prost(uint64, tag="1")]
pub num_hits: u64,
#[prost(message, repeated, tag="2")]
pub hits: ::prost::alloc::vec::Vec<Hit>,
#[prost(uint64, tag="3")]
pub elapsed_time_micros: u64,
#[prost(string, repeated, tag="4")]
pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, optional, tag="5")]
pub aggregation: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitSearchError {
#[prost(string, tag="1")]
pub error: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub split_id: ::prost::alloc::string::String,
#[prost(bool, tag="3")]
pub retryable_error: bool,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafSearchRequest {
#[prost(message, optional, tag="1")]
pub search_request: ::core::option::Option<SearchRequest>,
#[prost(message, repeated, tag="4")]
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
#[prost(string, tag="5")]
pub doc_mapper: ::prost::alloc::string::String,
#[prost(string, tag="6")]
pub index_uri: ::prost::alloc::string::String,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitIdAndFooterOffsets {
#[prost(string, tag="1")]
pub split_id: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub split_footer_start: u64,
#[prost(uint64, tag="3")]
pub split_footer_end: u64,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafHit {
#[prost(string, tag="1")]
pub leaf_json: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub partial_hit: ::core::option::Option<PartialHit>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hit {
#[prost(string, tag="1")]
pub json: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub partial_hit: ::core::option::Option<PartialHit>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartialHit {
#[prost(uint64, tag="1")]
pub sorting_field_value: u64,
#[prost(string, tag="2")]
pub split_id: ::prost::alloc::string::String,
#[prost(uint32, tag="3")]
pub segment_ord: u32,
#[prost(uint32, tag="4")]
pub doc_id: u32,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafSearchResponse {
#[prost(uint64, tag="1")]
pub num_hits: u64,
#[prost(message, repeated, tag="2")]
pub partial_hits: ::prost::alloc::vec::Vec<PartialHit>,
#[prost(message, repeated, tag="3")]
pub failed_splits: ::prost::alloc::vec::Vec<SplitSearchError>,
#[prost(uint64, tag="4")]
pub num_attempted_splits: u64,
#[prost(string, optional, tag="5")]
pub intermediate_aggregation_result: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FetchDocsRequest {
#[prost(message, repeated, tag="1")]
pub partial_hits: ::prost::alloc::vec::Vec<PartialHit>,
#[prost(string, tag="2")]
pub index_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag="3")]
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
#[prost(string, tag="4")]
pub index_uri: ::prost::alloc::string::String,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FetchDocsResponse {
#[prost(message, repeated, tag="1")]
pub hits: ::prost::alloc::vec::Vec<LeafHit>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchStreamRequest {
#[prost(string, tag="1")]
pub index_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub query: ::prost::alloc::string::String,
#[prost(string, repeated, tag="3")]
pub search_fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, optional, tag="4")]
pub start_timestamp: ::core::option::Option<i64>,
#[prost(int64, optional, tag="5")]
pub end_timestamp: ::core::option::Option<i64>,
#[prost(string, tag="6")]
pub fast_field: ::prost::alloc::string::String,
#[prost(enumeration="OutputFormat", tag="7")]
pub output_format: i32,
#[prost(string, optional, tag="9")]
pub partition_by_field: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafSearchStreamRequest {
#[prost(message, optional, tag="1")]
pub request: ::core::option::Option<SearchStreamRequest>,
#[prost(message, repeated, tag="2")]
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
#[prost(string, tag="5")]
pub doc_mapper: ::prost::alloc::string::String,
#[prost(string, tag="6")]
pub index_uri: ::prost::alloc::string::String,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafSearchStreamResponse {
#[prost(bytes="vec", tag="1")]
pub data: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag="2")]
pub split_id: ::prost::alloc::string::String,
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SortOrder {
Asc = 0,
Desc = 1,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OutputFormat {
Csv = 0,
ClickHouseRowBinary = 1,
}
pub mod search_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct SearchServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SearchServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SearchServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SearchServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
SearchServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[must_use]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
pub async fn root_search(
&mut self,
request: impl tonic::IntoRequest<super::SearchRequest>,
) -> Result<tonic::Response<super::SearchResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/quickwit.SearchService/RootSearch",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn leaf_search(
&mut self,
request: impl tonic::IntoRequest<super::LeafSearchRequest>,
) -> Result<tonic::Response<super::LeafSearchResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/quickwit.SearchService/LeafSearch",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn fetch_docs(
&mut self,
request: impl tonic::IntoRequest<super::FetchDocsRequest>,
) -> Result<tonic::Response<super::FetchDocsResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/quickwit.SearchService/FetchDocs",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn leaf_search_stream(
&mut self,
request: impl tonic::IntoRequest<super::LeafSearchStreamRequest>,
) -> Result<
tonic::Response<
tonic::codec::Streaming<super::LeafSearchStreamResponse>,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/quickwit.SearchService/LeafSearchStream",
);
self.inner.server_streaming(request.into_request(), path, codec).await
}
}
}
pub mod search_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait SearchService: Send + Sync + 'static {
async fn root_search(
&self,
request: tonic::Request<super::SearchRequest>,
) -> Result<tonic::Response<super::SearchResponse>, tonic::Status>;
async fn leaf_search(
&self,
request: tonic::Request<super::LeafSearchRequest>,
) -> Result<tonic::Response<super::LeafSearchResponse>, tonic::Status>;
async fn fetch_docs(
&self,
request: tonic::Request<super::FetchDocsRequest>,
) -> Result<tonic::Response<super::FetchDocsResponse>, tonic::Status>;
type LeafSearchStreamStream: futures_core::Stream<
Item = Result<super::LeafSearchStreamResponse, tonic::Status>,
>
+ Send
+ 'static;
async fn leaf_search_stream(
&self,
request: tonic::Request<super::LeafSearchStreamRequest>,
) -> Result<tonic::Response<Self::LeafSearchStreamStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct SearchServiceServer<T: SearchService> {
inner: _Inner<T>,
accept_compression_encodings: (),
send_compression_encodings: (),
}
struct _Inner<T>(Arc<T>);
impl<T: SearchService> SearchServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SearchServiceServer<T>
where
T: SearchService,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/quickwit.SearchService/RootSearch" => {
#[allow(non_camel_case_types)]
struct RootSearchSvc<T: SearchService>(pub Arc<T>);
impl<
T: SearchService,
> tonic::server::UnaryService<super::SearchRequest>
for RootSearchSvc<T> {
type Response = super::SearchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SearchRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).root_search(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = RootSearchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/quickwit.SearchService/LeafSearch" => {
#[allow(non_camel_case_types)]
struct LeafSearchSvc<T: SearchService>(pub Arc<T>);
impl<
T: SearchService,
> tonic::server::UnaryService<super::LeafSearchRequest>
for LeafSearchSvc<T> {
type Response = super::LeafSearchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeafSearchRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).leaf_search(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = LeafSearchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/quickwit.SearchService/FetchDocs" => {
#[allow(non_camel_case_types)]
struct FetchDocsSvc<T: SearchService>(pub Arc<T>);
impl<
T: SearchService,
> tonic::server::UnaryService<super::FetchDocsRequest>
for FetchDocsSvc<T> {
type Response = super::FetchDocsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::FetchDocsRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).fetch_docs(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = FetchDocsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/quickwit.SearchService/LeafSearchStream" => {
#[allow(non_camel_case_types)]
struct LeafSearchStreamSvc<T: SearchService>(pub Arc<T>);
impl<
T: SearchService,
> tonic::server::ServerStreamingService<
super::LeafSearchStreamRequest,
> for LeafSearchStreamSvc<T> {
type Response = super::LeafSearchStreamResponse;
type ResponseStream = T::LeafSearchStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeafSearchStreamRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).leaf_search_stream(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = LeafSearchStreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: SearchService> Clone for SearchServiceServer<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,
}
}
}
impl<T: SearchService> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: SearchService> tonic::transport::NamedService for SearchServiceServer<T> {
const NAME: &'static str = "quickwit.SearchService";
}
}