#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListCollectionsRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListCollectionsResponse {
#[prost(string, repeated, tag = "1")]
pub collection_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateCollectionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<CollectionConfig>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateCollectionResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetCollectionInfoRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetCollectionInfoResponse {
#[prost(message, optional, tag = "1")]
pub info: ::core::option::Option<CollectionInfo>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteCollectionRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteCollectionResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InsertVectorRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub vector_id: ::prost::alloc::string::String,
#[prost(float, repeated, tag = "3")]
pub data: ::prost::alloc::vec::Vec<f32>,
#[prost(map = "string, string", tag = "4")]
pub payload: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InsertVectorResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InsertVectorsResponse {
#[prost(uint32, tag = "1")]
pub inserted_count: u32,
#[prost(uint32, tag = "2")]
pub failed_count: u32,
#[prost(string, repeated, tag = "3")]
pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetVectorRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub vector_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetVectorResponse {
#[prost(string, tag = "1")]
pub vector_id: ::prost::alloc::string::String,
#[prost(float, repeated, tag = "2")]
pub data: ::prost::alloc::vec::Vec<f32>,
#[prost(map = "string, string", tag = "3")]
pub payload: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateVectorRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub vector_id: ::prost::alloc::string::String,
#[prost(float, repeated, tag = "3")]
pub data: ::prost::alloc::vec::Vec<f32>,
#[prost(map = "string, string", tag = "4")]
pub payload: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpdateVectorResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteVectorRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub vector_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteVectorResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(float, repeated, tag = "2")]
pub query_vector: ::prost::alloc::vec::Vec<f32>,
#[prost(uint32, tag = "3")]
pub limit: u32,
#[prost(double, tag = "4")]
pub threshold: f64,
#[prost(map = "string, string", tag = "5")]
pub filter: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResponse {
#[prost(message, repeated, tag = "1")]
pub results: ::prost::alloc::vec::Vec<SearchResult>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSearchRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub queries: ::prost::alloc::vec::Vec<SearchRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSearchResponse {
#[prost(message, repeated, tag = "1")]
pub results: ::prost::alloc::vec::Vec<SearchResponse>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HybridSearchRequest {
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
#[prost(float, repeated, tag = "2")]
pub dense_query: ::prost::alloc::vec::Vec<f32>,
#[prost(message, optional, tag = "3")]
pub sparse_query: ::core::option::Option<SparseVector>,
#[prost(message, optional, tag = "4")]
pub config: ::core::option::Option<HybridSearchConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HybridSearchResponse {
#[prost(message, repeated, tag = "1")]
pub results: ::prost::alloc::vec::Vec<HybridSearchResult>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthCheckRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthCheckResponse {
#[prost(string, tag = "1")]
pub status: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub timestamp: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetStatsRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetStatsResponse {
#[prost(uint32, tag = "1")]
pub collections_count: u32,
#[prost(uint64, tag = "2")]
pub total_vectors: u64,
#[prost(int64, tag = "3")]
pub uptime_seconds: i64,
#[prost(string, tag = "4")]
pub version: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CollectionConfig {
#[prost(uint32, tag = "1")]
pub dimension: u32,
#[prost(enumeration = "DistanceMetric", tag = "2")]
pub metric: i32,
#[prost(message, optional, tag = "3")]
pub hnsw_config: ::core::option::Option<HnswConfig>,
#[prost(message, optional, tag = "4")]
pub quantization: ::core::option::Option<QuantizationConfig>,
#[prost(enumeration = "StorageType", tag = "5")]
pub storage_type: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CollectionInfo {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<CollectionConfig>,
#[prost(uint64, tag = "3")]
pub vector_count: u64,
#[prost(int64, tag = "4")]
pub created_at: i64,
#[prost(int64, tag = "5")]
pub updated_at: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResult {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub score: f32,
#[prost(float, repeated, tag = "3")]
pub vector: ::prost::alloc::vec::Vec<f32>,
#[prost(map = "string, string", tag = "4")]
pub payload: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HybridSearchResult {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub hybrid_score: f32,
#[prost(float, tag = "3")]
pub dense_score: f32,
#[prost(float, tag = "4")]
pub sparse_score: f32,
#[prost(float, repeated, tag = "5")]
pub vector: ::prost::alloc::vec::Vec<f32>,
#[prost(map = "string, string", tag = "6")]
pub payload: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SparseVector {
#[prost(uint32, repeated, tag = "1")]
pub indices: ::prost::alloc::vec::Vec<u32>,
#[prost(float, repeated, tag = "2")]
pub values: ::prost::alloc::vec::Vec<f32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct HybridSearchConfig {
#[prost(uint32, tag = "1")]
pub dense_k: u32,
#[prost(uint32, tag = "2")]
pub sparse_k: u32,
#[prost(uint32, tag = "3")]
pub final_k: u32,
#[prost(double, tag = "4")]
pub alpha: f64,
#[prost(enumeration = "HybridScoringAlgorithm", tag = "5")]
pub algorithm: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HnswConfig {
#[prost(uint32, tag = "1")]
pub m: u32,
#[prost(uint32, tag = "2")]
pub ef_construction: u32,
#[prost(uint32, tag = "3")]
pub ef: u32,
#[prost(uint64, tag = "4")]
pub seed: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct QuantizationConfig {
#[prost(oneof = "quantization_config::Config", tags = "1, 2, 3")]
pub config: ::core::option::Option<quantization_config::Config>,
}
pub mod quantization_config {
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Config {
#[prost(message, tag = "1")]
Scalar(super::ScalarQuantization),
#[prost(message, tag = "2")]
Product(super::ProductQuantization),
#[prost(message, tag = "3")]
Binary(super::BinaryQuantization),
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScalarQuantization {
#[prost(uint32, tag = "1")]
pub bits: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProductQuantization {
#[prost(uint32, tag = "1")]
pub subvectors: u32,
#[prost(uint32, tag = "2")]
pub centroids: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BinaryQuantization {}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DistanceMetric {
Cosine = 0,
Euclidean = 1,
DotProduct = 2,
}
impl DistanceMetric {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Cosine => "COSINE",
Self::Euclidean => "EUCLIDEAN",
Self::DotProduct => "DOT_PRODUCT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"COSINE" => Some(Self::Cosine),
"EUCLIDEAN" => Some(Self::Euclidean),
"DOT_PRODUCT" => Some(Self::DotProduct),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StorageType {
Memory = 0,
Mmap = 1,
}
impl StorageType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Memory => "MEMORY",
Self::Mmap => "MMAP",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MEMORY" => Some(Self::Memory),
"MMAP" => Some(Self::Mmap),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum HybridScoringAlgorithm {
Rrf = 0,
Weighted = 1,
AlphaBlend = 2,
}
impl HybridScoringAlgorithm {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Rrf => "RRF",
Self::Weighted => "WEIGHTED",
Self::AlphaBlend => "ALPHA_BLEND",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RRF" => Some(Self::Rrf),
"WEIGHTED" => Some(Self::Weighted),
"ALPHA_BLEND" => Some(Self::AlphaBlend),
_ => None,
}
}
}
pub mod vectorizer_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct VectorizerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl VectorizerServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> VectorizerServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> VectorizerServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
VectorizerServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn list_collections(
&mut self,
request: impl tonic::IntoRequest<super::ListCollectionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListCollectionsResponse>,
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(
"/vectorizer.VectorizerService/ListCollections",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("vectorizer.VectorizerService", "ListCollections"),
);
self.inner.unary(req, path, codec).await
}
pub async fn create_collection(
&mut self,
request: impl tonic::IntoRequest<super::CreateCollectionRequest>,
) -> std::result::Result<
tonic::Response<super::CreateCollectionResponse>,
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(
"/vectorizer.VectorizerService/CreateCollection",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("vectorizer.VectorizerService", "CreateCollection"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_collection_info(
&mut self,
request: impl tonic::IntoRequest<super::GetCollectionInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetCollectionInfoResponse>,
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(
"/vectorizer.VectorizerService/GetCollectionInfo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("vectorizer.VectorizerService", "GetCollectionInfo"),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_collection(
&mut self,
request: impl tonic::IntoRequest<super::DeleteCollectionRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteCollectionResponse>,
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(
"/vectorizer.VectorizerService/DeleteCollection",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("vectorizer.VectorizerService", "DeleteCollection"),
);
self.inner.unary(req, path, codec).await
}
pub async fn insert_vector(
&mut self,
request: impl tonic::IntoRequest<super::InsertVectorRequest>,
) -> std::result::Result<
tonic::Response<super::InsertVectorResponse>,
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(
"/vectorizer.VectorizerService/InsertVector",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "InsertVector"));
self.inner.unary(req, path, codec).await
}
pub async fn insert_vectors(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::InsertVectorRequest,
>,
) -> std::result::Result<
tonic::Response<super::InsertVectorsResponse>,
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(
"/vectorizer.VectorizerService/InsertVectors",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new("vectorizer.VectorizerService", "InsertVectors"),
);
self.inner.client_streaming(req, path, codec).await
}
pub async fn get_vector(
&mut self,
request: impl tonic::IntoRequest<super::GetVectorRequest>,
) -> std::result::Result<
tonic::Response<super::GetVectorResponse>,
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(
"/vectorizer.VectorizerService/GetVector",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "GetVector"));
self.inner.unary(req, path, codec).await
}
pub async fn update_vector(
&mut self,
request: impl tonic::IntoRequest<super::UpdateVectorRequest>,
) -> std::result::Result<
tonic::Response<super::UpdateVectorResponse>,
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(
"/vectorizer.VectorizerService/UpdateVector",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "UpdateVector"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_vector(
&mut self,
request: impl tonic::IntoRequest<super::DeleteVectorRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteVectorResponse>,
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(
"/vectorizer.VectorizerService/DeleteVector",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "DeleteVector"));
self.inner.unary(req, path, codec).await
}
pub async fn search(
&mut self,
request: impl tonic::IntoRequest<super::SearchRequest>,
) -> std::result::Result<tonic::Response<super::SearchResponse>, 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(
"/vectorizer.VectorizerService/Search",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "Search"));
self.inner.unary(req, path, codec).await
}
pub async fn batch_search(
&mut self,
request: impl tonic::IntoRequest<super::BatchSearchRequest>,
) -> std::result::Result<
tonic::Response<super::BatchSearchResponse>,
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(
"/vectorizer.VectorizerService/BatchSearch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "BatchSearch"));
self.inner.unary(req, path, codec).await
}
pub async fn hybrid_search(
&mut self,
request: impl tonic::IntoRequest<super::HybridSearchRequest>,
) -> std::result::Result<
tonic::Response<super::HybridSearchResponse>,
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(
"/vectorizer.VectorizerService/HybridSearch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "HybridSearch"));
self.inner.unary(req, path, codec).await
}
pub async fn health_check(
&mut self,
request: impl tonic::IntoRequest<super::HealthCheckRequest>,
) -> std::result::Result<
tonic::Response<super::HealthCheckResponse>,
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(
"/vectorizer.VectorizerService/HealthCheck",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "HealthCheck"));
self.inner.unary(req, path, codec).await
}
pub async fn get_stats(
&mut self,
request: impl tonic::IntoRequest<super::GetStatsRequest>,
) -> std::result::Result<
tonic::Response<super::GetStatsResponse>,
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(
"/vectorizer.VectorizerService/GetStats",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("vectorizer.VectorizerService", "GetStats"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod vectorizer_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait VectorizerService: std::marker::Send + std::marker::Sync + 'static {
async fn list_collections(
&self,
request: tonic::Request<super::ListCollectionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListCollectionsResponse>,
tonic::Status,
>;
async fn create_collection(
&self,
request: tonic::Request<super::CreateCollectionRequest>,
) -> std::result::Result<
tonic::Response<super::CreateCollectionResponse>,
tonic::Status,
>;
async fn get_collection_info(
&self,
request: tonic::Request<super::GetCollectionInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetCollectionInfoResponse>,
tonic::Status,
>;
async fn delete_collection(
&self,
request: tonic::Request<super::DeleteCollectionRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteCollectionResponse>,
tonic::Status,
>;
async fn insert_vector(
&self,
request: tonic::Request<super::InsertVectorRequest>,
) -> std::result::Result<
tonic::Response<super::InsertVectorResponse>,
tonic::Status,
>;
async fn insert_vectors(
&self,
request: tonic::Request<tonic::Streaming<super::InsertVectorRequest>>,
) -> std::result::Result<
tonic::Response<super::InsertVectorsResponse>,
tonic::Status,
>;
async fn get_vector(
&self,
request: tonic::Request<super::GetVectorRequest>,
) -> std::result::Result<
tonic::Response<super::GetVectorResponse>,
tonic::Status,
>;
async fn update_vector(
&self,
request: tonic::Request<super::UpdateVectorRequest>,
) -> std::result::Result<
tonic::Response<super::UpdateVectorResponse>,
tonic::Status,
>;
async fn delete_vector(
&self,
request: tonic::Request<super::DeleteVectorRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteVectorResponse>,
tonic::Status,
>;
async fn search(
&self,
request: tonic::Request<super::SearchRequest>,
) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status>;
async fn batch_search(
&self,
request: tonic::Request<super::BatchSearchRequest>,
) -> std::result::Result<
tonic::Response<super::BatchSearchResponse>,
tonic::Status,
>;
async fn hybrid_search(
&self,
request: tonic::Request<super::HybridSearchRequest>,
) -> std::result::Result<
tonic::Response<super::HybridSearchResponse>,
tonic::Status,
>;
async fn health_check(
&self,
request: tonic::Request<super::HealthCheckRequest>,
) -> std::result::Result<
tonic::Response<super::HealthCheckResponse>,
tonic::Status,
>;
async fn get_stats(
&self,
request: tonic::Request<super::GetStatsRequest>,
) -> std::result::Result<
tonic::Response<super::GetStatsResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct VectorizerServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> VectorizerServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for VectorizerServiceServer<T>
where
T: VectorizerService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/vectorizer.VectorizerService/ListCollections" => {
#[allow(non_camel_case_types)]
struct ListCollectionsSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::ListCollectionsRequest>
for ListCollectionsSvc<T> {
type Response = super::ListCollectionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListCollectionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::list_collections(&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 = ListCollectionsSvc(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)
}
"/vectorizer.VectorizerService/CreateCollection" => {
#[allow(non_camel_case_types)]
struct CreateCollectionSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::CreateCollectionRequest>
for CreateCollectionSvc<T> {
type Response = super::CreateCollectionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CreateCollectionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::create_collection(&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 = CreateCollectionSvc(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)
}
"/vectorizer.VectorizerService/GetCollectionInfo" => {
#[allow(non_camel_case_types)]
struct GetCollectionInfoSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::GetCollectionInfoRequest>
for GetCollectionInfoSvc<T> {
type Response = super::GetCollectionInfoResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetCollectionInfoRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::get_collection_info(
&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 = GetCollectionInfoSvc(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)
}
"/vectorizer.VectorizerService/DeleteCollection" => {
#[allow(non_camel_case_types)]
struct DeleteCollectionSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::DeleteCollectionRequest>
for DeleteCollectionSvc<T> {
type Response = super::DeleteCollectionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteCollectionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::delete_collection(&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 = DeleteCollectionSvc(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)
}
"/vectorizer.VectorizerService/InsertVector" => {
#[allow(non_camel_case_types)]
struct InsertVectorSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::InsertVectorRequest>
for InsertVectorSvc<T> {
type Response = super::InsertVectorResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InsertVectorRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::insert_vector(&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 = InsertVectorSvc(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)
}
"/vectorizer.VectorizerService/InsertVectors" => {
#[allow(non_camel_case_types)]
struct InsertVectorsSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::ClientStreamingService<super::InsertVectorRequest>
for InsertVectorsSvc<T> {
type Response = super::InsertVectorsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::InsertVectorRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::insert_vectors(&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 = InsertVectorsSvc(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.client_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/vectorizer.VectorizerService/GetVector" => {
#[allow(non_camel_case_types)]
struct GetVectorSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::GetVectorRequest>
for GetVectorSvc<T> {
type Response = super::GetVectorResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetVectorRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::get_vector(&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 = GetVectorSvc(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)
}
"/vectorizer.VectorizerService/UpdateVector" => {
#[allow(non_camel_case_types)]
struct UpdateVectorSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::UpdateVectorRequest>
for UpdateVectorSvc<T> {
type Response = super::UpdateVectorResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UpdateVectorRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::update_vector(&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 = UpdateVectorSvc(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)
}
"/vectorizer.VectorizerService/DeleteVector" => {
#[allow(non_camel_case_types)]
struct DeleteVectorSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::DeleteVectorRequest>
for DeleteVectorSvc<T> {
type Response = super::DeleteVectorResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteVectorRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::delete_vector(&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 = DeleteVectorSvc(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)
}
"/vectorizer.VectorizerService/Search" => {
#[allow(non_camel_case_types)]
struct SearchSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::SearchRequest>
for SearchSvc<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 = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::search(&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 = SearchSvc(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)
}
"/vectorizer.VectorizerService/BatchSearch" => {
#[allow(non_camel_case_types)]
struct BatchSearchSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::BatchSearchRequest>
for BatchSearchSvc<T> {
type Response = super::BatchSearchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::BatchSearchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::batch_search(&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 = BatchSearchSvc(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)
}
"/vectorizer.VectorizerService/HybridSearch" => {
#[allow(non_camel_case_types)]
struct HybridSearchSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::HybridSearchRequest>
for HybridSearchSvc<T> {
type Response = super::HybridSearchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HybridSearchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::hybrid_search(&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 = HybridSearchSvc(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)
}
"/vectorizer.VectorizerService/HealthCheck" => {
#[allow(non_camel_case_types)]
struct HealthCheckSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::HealthCheckRequest>
for HealthCheckSvc<T> {
type Response = super::HealthCheckResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HealthCheckRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::health_check(&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 = HealthCheckSvc(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)
}
"/vectorizer.VectorizerService/GetStats" => {
#[allow(non_camel_case_types)]
struct GetStatsSvc<T: VectorizerService>(pub Arc<T>);
impl<
T: VectorizerService,
> tonic::server::UnaryService<super::GetStatsRequest>
for GetStatsSvc<T> {
type Response = super::GetStatsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetStatsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as VectorizerService>::get_stats(&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 = GetStatsSvc(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(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for VectorizerServiceServer<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,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "vectorizer.VectorizerService";
impl<T> tonic::server::NamedService for VectorizerServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}