From 0dc530a1fd27cbc479c37bdbcb67dcf2cd9991aa Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Thu, 5 Sep 2019 10:51:46 +0800 Subject: [PATCH] MS-482 Change search stream transport to unary in grpc Former-commit-id: cd94b6a3b7da5b8971379d8aac45b25bec736399 --- cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc | 76 ++- cpp/src/grpc/gen-milvus/milvus.grpc.pb.h | 278 +++++----- cpp/src/grpc/gen-milvus/milvus.pb.cc | 499 ++++++++++++++---- cpp/src/grpc/gen-milvus/milvus.pb.h | 265 ++++++++-- cpp/src/grpc/milvus.proto | 13 +- cpp/src/scheduler/SchedInst.cpp | 88 +-- cpp/src/scheduler/task/SearchTask.cpp | 13 +- cpp/src/sdk/grpc/ClientProxy.cpp | 12 +- cpp/src/sdk/grpc/GrpcClient.cpp | 19 +- cpp/src/sdk/grpc/GrpcClient.h | 4 +- cpp/src/server/grpc_impl/GrpcMilvusServer.cpp | 45 +- .../server/grpc_impl/GrpcRequestHandler.cpp | 14 +- cpp/src/server/grpc_impl/GrpcRequestHandler.h | 8 +- cpp/src/server/grpc_impl/GrpcRequestTask.cpp | 27 +- cpp/src/server/grpc_impl/GrpcRequestTask.h | 8 +- 15 files changed, 956 insertions(+), 413 deletions(-) diff --git a/cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc b/cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc index 2ef7baf5..0a417538 100644 --- a/cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc +++ b/cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc @@ -49,8 +49,8 @@ MilvusService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& chan , rpcmethod_DropTable_(MilvusService_method_names[2], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) , rpcmethod_CreateIndex_(MilvusService_method_names[3], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) , rpcmethod_Insert_(MilvusService_method_names[4], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) - , rpcmethod_Search_(MilvusService_method_names[5], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel) - , rpcmethod_SearchInFiles_(MilvusService_method_names[6], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel) + , rpcmethod_Search_(MilvusService_method_names[5], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_SearchInFiles_(MilvusService_method_names[6], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) , rpcmethod_DescribeTable_(MilvusService_method_names[7], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) , rpcmethod_CountTable_(MilvusService_method_names[8], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) , rpcmethod_ShowTables_(MilvusService_method_names[9], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel) @@ -201,36 +201,60 @@ void MilvusService::Stub::experimental_async::Insert(::grpc::ClientContext* cont return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::VectorIds>::Create(channel_.get(), cq, rpcmethod_Insert_, context, request, false); } -::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::SearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request) { - return ::grpc_impl::internal::ClientReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), rpcmethod_Search_, context, request); +::grpc::Status MilvusService::Stub::Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::milvus::grpc::TopKQueryResultList* response) { + return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Search_, context, request, response); } -void MilvusService::Stub::experimental_async::Search(::grpc::ClientContext* context, ::milvus::grpc::SearchParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) { - ::grpc_impl::internal::ClientCallbackReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(stub_->channel_.get(), stub_->rpcmethod_Search_, context, request, reactor); +void MilvusService::Stub::experimental_async::Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_Search_, context, request, response, std::move(f)); } -::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), cq, rpcmethod_Search_, context, request, true, tag); +void MilvusService::Stub::experimental_async::Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_Search_, context, request, response, std::move(f)); } -::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), cq, rpcmethod_Search_, context, request, false, nullptr); +void MilvusService::Stub::experimental_async::Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_Search_, context, request, response, reactor); } -::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::SearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request) { - return ::grpc_impl::internal::ClientReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), rpcmethod_SearchInFiles_, context, request); +void MilvusService::Stub::experimental_async::Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_Search_, context, request, response, reactor); } -void MilvusService::Stub::experimental_async::SearchInFiles(::grpc::ClientContext* context, ::milvus::grpc::SearchInFilesParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) { - ::grpc_impl::internal::ClientCallbackReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(stub_->channel_.get(), stub_->rpcmethod_SearchInFiles_, context, request, reactor); +::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* MilvusService::Stub::AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TopKQueryResultList>::Create(channel_.get(), cq, rpcmethod_Search_, context, request, true); } -::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), cq, rpcmethod_SearchInFiles_, context, request, true, tag); +::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* MilvusService::Stub::PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TopKQueryResultList>::Create(channel_.get(), cq, rpcmethod_Search_, context, request, false); } -::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* MilvusService::Stub::PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { - return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TopKQueryResult>::Create(channel_.get(), cq, rpcmethod_SearchInFiles_, context, request, false, nullptr); +::grpc::Status MilvusService::Stub::SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::milvus::grpc::TopKQueryResultList* response) { + return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_SearchInFiles_, context, request, response); +} + +void MilvusService::Stub::experimental_async::SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_SearchInFiles_, context, request, response, std::move(f)); +} + +void MilvusService::Stub::experimental_async::SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function f) { + ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_SearchInFiles_, context, request, response, std::move(f)); +} + +void MilvusService::Stub::experimental_async::SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_SearchInFiles_, context, request, response, reactor); +} + +void MilvusService::Stub::experimental_async::SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) { + ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_SearchInFiles_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* MilvusService::Stub::AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TopKQueryResultList>::Create(channel_.get(), cq, rpcmethod_SearchInFiles_, context, request, true); +} + +::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* MilvusService::Stub::PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TopKQueryResultList>::Create(channel_.get(), cq, rpcmethod_SearchInFiles_, context, request, false); } ::grpc::Status MilvusService::Stub::DescribeTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::milvus::grpc::TableSchema* response) { @@ -473,13 +497,13 @@ MilvusService::Service::Service() { std::mem_fn(&MilvusService::Service::Insert), this))); AddMethod(new ::grpc::internal::RpcServiceMethod( MilvusService_method_names[5], - ::grpc::internal::RpcMethod::SERVER_STREAMING, - new ::grpc::internal::ServerStreamingHandler< MilvusService::Service, ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResult>( + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< MilvusService::Service, ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResultList>( std::mem_fn(&MilvusService::Service::Search), this))); AddMethod(new ::grpc::internal::RpcServiceMethod( MilvusService_method_names[6], - ::grpc::internal::RpcMethod::SERVER_STREAMING, - new ::grpc::internal::ServerStreamingHandler< MilvusService::Service, ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResult>( + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< MilvusService::Service, ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResultList>( std::mem_fn(&MilvusService::Service::SearchInFiles), this))); AddMethod(new ::grpc::internal::RpcServiceMethod( MilvusService_method_names[7], @@ -561,17 +585,17 @@ MilvusService::Service::~Service() { return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } -::grpc::Status MilvusService::Service::Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) { +::grpc::Status MilvusService::Service::Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) { (void) context; (void) request; - (void) writer; + (void) response; return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } -::grpc::Status MilvusService::Service::SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) { +::grpc::Status MilvusService::Service::SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) { (void) context; (void) request; - (void) writer; + (void) response; return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } diff --git a/cpp/src/grpc/gen-milvus/milvus.grpc.pb.h b/cpp/src/grpc/gen-milvus/milvus.grpc.pb.h index 163ffa92..0ab25afb 100644 --- a/cpp/src/grpc/gen-milvus/milvus.grpc.pb.h +++ b/cpp/src/grpc/gen-milvus/milvus.grpc.pb.h @@ -130,14 +130,12 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>> Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request) { - return std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>>(SearchRaw(context, request)); + virtual ::grpc::Status Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::milvus::grpc::TopKQueryResultList* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>> AsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>>(AsyncSearchRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>> AsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>>(AsyncSearchRaw(context, request, cq, tag)); - } - std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>> PrepareAsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>>(PrepareAsyncSearchRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>> PrepareAsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>>(PrepareAsyncSearchRaw(context, request, cq)); } // * // @brief Internal use query interface @@ -150,14 +148,12 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>> SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request) { - return std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>>(SearchInFilesRaw(context, request)); - } - std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>> AsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>>(AsyncSearchInFilesRaw(context, request, cq, tag)); + virtual ::grpc::Status SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::milvus::grpc::TopKQueryResultList* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>> AsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>>(AsyncSearchInFilesRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>> PrepareAsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>>(PrepareAsyncSearchInFilesRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>> PrepareAsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>>(PrepareAsyncSearchInFilesRaw(context, request, cq)); } // * // @brief Get table schema @@ -341,7 +337,10 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - virtual void Search(::grpc::ClientContext* context, ::milvus::grpc::SearchParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) = 0; + virtual void Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function) = 0; + virtual void Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function) = 0; + virtual void Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + virtual void Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; // * // @brief Internal use query interface // @@ -353,7 +352,10 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - virtual void SearchInFiles(::grpc::ClientContext* context, ::milvus::grpc::SearchInFilesParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) = 0; + virtual void SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function) = 0; + virtual void SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function) = 0; + virtual void SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; + virtual void SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; // * // @brief Get table schema // @@ -449,12 +451,10 @@ class MilvusService final { virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::Status>* PrepareAsyncCreateIndexRaw(::grpc::ClientContext* context, const ::milvus::grpc::IndexParam& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::VectorIds>* AsyncInsertRaw(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::VectorIds>* PrepareAsyncInsertRaw(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam& request, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>* SearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request) = 0; - virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>* AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq, void* tag) = 0; - virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>* PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientReaderInterface< ::milvus::grpc::TopKQueryResult>* SearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request) = 0; - virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>* AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq, void* tag) = 0; - virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TopKQueryResult>* PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>* AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>* PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>* AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TopKQueryResultList>* PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableSchema>* AsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableSchema>* PrepareAsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableRowCount>* AsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0; @@ -511,23 +511,19 @@ class MilvusService final { std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::VectorIds>> PrepareAsyncInsert(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam& request, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::VectorIds>>(PrepareAsyncInsertRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>> Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request) { - return std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>>(SearchRaw(context, request)); - } - std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>> AsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>>(AsyncSearchRaw(context, request, cq, tag)); + ::grpc::Status Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::milvus::grpc::TopKQueryResultList* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>> AsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>>(AsyncSearchRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>> PrepareAsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>>(PrepareAsyncSearchRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>> PrepareAsyncSearch(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>>(PrepareAsyncSearchRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>> SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request) { - return std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>>(SearchInFilesRaw(context, request)); + ::grpc::Status SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::milvus::grpc::TopKQueryResultList* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>> AsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>>(AsyncSearchInFilesRaw(context, request, cq)); } - std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>> AsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>>(AsyncSearchInFilesRaw(context, request, cq, tag)); - } - std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>> PrepareAsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>>(PrepareAsyncSearchInFilesRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>> PrepareAsyncSearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>>(PrepareAsyncSearchInFilesRaw(context, request, cq)); } ::grpc::Status DescribeTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::milvus::grpc::TableSchema* response) override; std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableSchema>> AsyncDescribeTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) { @@ -610,8 +606,14 @@ class MilvusService final { void Insert(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::VectorIds* response, std::function) override; void Insert(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam* request, ::milvus::grpc::VectorIds* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; void Insert(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::VectorIds* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; - void Search(::grpc::ClientContext* context, ::milvus::grpc::SearchParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) override; - void SearchInFiles(::grpc::ClientContext* context, ::milvus::grpc::SearchInFilesParam* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TopKQueryResult>* reactor) override; + void Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function) override; + void Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function) override; + void Search(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + void Search(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + void SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, std::function) override; + void SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, std::function) override; + void SearchInFiles(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; + void SearchInFiles(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; void DescribeTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName* request, ::milvus::grpc::TableSchema* response, std::function) override; void DescribeTable(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableSchema* response, std::function) override; void DescribeTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName* request, ::milvus::grpc::TableSchema* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; @@ -662,12 +664,10 @@ class MilvusService final { ::grpc::ClientAsyncResponseReader< ::milvus::grpc::Status>* PrepareAsyncCreateIndexRaw(::grpc::ClientContext* context, const ::milvus::grpc::IndexParam& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader< ::milvus::grpc::VectorIds>* AsyncInsertRaw(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader< ::milvus::grpc::VectorIds>* PrepareAsyncInsertRaw(::grpc::ClientContext* context, const ::milvus::grpc::InsertParam& request, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>* SearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request) override; - ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq, void* tag) override; - ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientReader< ::milvus::grpc::TopKQueryResult>* SearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request) override; - ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq, void* tag) override; - ::grpc::ClientAsyncReader< ::milvus::grpc::TopKQueryResult>* PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* AsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* PrepareAsyncSearchRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchParam& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* AsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TopKQueryResultList>* PrepareAsyncSearchInFilesRaw(::grpc::ClientContext* context, const ::milvus::grpc::SearchInFilesParam& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableSchema>* AsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableSchema>* PrepareAsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableRowCount>* AsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override; @@ -760,7 +760,7 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - virtual ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer); + virtual ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response); // * // @brief Internal use query interface // @@ -772,7 +772,7 @@ class MilvusService final { // @param topk, how many similarity vectors will be searched. // // @return query result array. - virtual ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer); + virtual ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response); // * // @brief Get table schema // @@ -947,12 +947,12 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSearch(::grpc::ServerContext* context, ::milvus::grpc::SearchParam* request, ::grpc::ServerAsyncWriter< ::milvus::grpc::TopKQueryResult>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncServerStreaming(5, context, request, writer, new_call_cq, notification_cq, tag); + void RequestSearch(::grpc::ServerContext* context, ::milvus::grpc::SearchParam* request, ::grpc::ServerAsyncResponseWriter< ::milvus::grpc::TopKQueryResultList>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -967,12 +967,12 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSearchInFiles(::grpc::ServerContext* context, ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerAsyncWriter< ::milvus::grpc::TopKQueryResult>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncServerStreaming(6, context, request, writer, new_call_cq, notification_cq, tag); + void RequestSearchInFiles(::grpc::ServerContext* context, ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerAsyncResponseWriter< ::milvus::grpc::TopKQueryResultList>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1298,20 +1298,29 @@ class MilvusService final { public: ExperimentalWithCallbackMethod_Search() { ::grpc::Service::experimental().MarkMethodCallback(5, - new ::grpc_impl::internal::CallbackServerStreamingHandler< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResult>( - [this] { return this->Search(); })); + new ::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResultList>( + [this](::grpc::ServerContext* context, + const ::milvus::grpc::SearchParam* request, + ::milvus::grpc::TopKQueryResultList* response, + ::grpc::experimental::ServerCallbackRpcController* controller) { + return this->Search(context, request, response, controller); + })); + } + void SetMessageAllocatorFor_Search( + ::grpc::experimental::MessageAllocator< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResultList>* allocator) { + static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResultList>*>( + ::grpc::Service::experimental().GetHandler(5)) + ->SetMessageAllocator(allocator); } ~ExperimentalWithCallbackMethod_Search() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::experimental::ServerWriteReactor< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResult>* Search() { - return new ::grpc_impl::internal::UnimplementedWriteReactor< - ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResult>;} + virtual void Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); } }; template class ExperimentalWithCallbackMethod_SearchInFiles : public BaseClass { @@ -1320,20 +1329,29 @@ class MilvusService final { public: ExperimentalWithCallbackMethod_SearchInFiles() { ::grpc::Service::experimental().MarkMethodCallback(6, - new ::grpc_impl::internal::CallbackServerStreamingHandler< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResult>( - [this] { return this->SearchInFiles(); })); + new ::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResultList>( + [this](::grpc::ServerContext* context, + const ::milvus::grpc::SearchInFilesParam* request, + ::milvus::grpc::TopKQueryResultList* response, + ::grpc::experimental::ServerCallbackRpcController* controller) { + return this->SearchInFiles(context, request, response, controller); + })); + } + void SetMessageAllocatorFor_SearchInFiles( + ::grpc::experimental::MessageAllocator< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResultList>* allocator) { + static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResultList>*>( + ::grpc::Service::experimental().GetHandler(6)) + ->SetMessageAllocator(allocator); } ~ExperimentalWithCallbackMethod_SearchInFiles() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::experimental::ServerWriteReactor< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResult>* SearchInFiles() { - return new ::grpc_impl::internal::UnimplementedWriteReactor< - ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResult>;} + virtual void SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); } }; template class ExperimentalWithCallbackMethod_DescribeTable : public BaseClass { @@ -1672,7 +1690,7 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -1689,7 +1707,7 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -1942,12 +1960,12 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSearch(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncWriter< ::grpc::ByteBuffer>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncServerStreaming(5, context, request, writer, new_call_cq, notification_cq, tag); + void RequestSearch(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1962,12 +1980,12 @@ class MilvusService final { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSearchInFiles(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncWriter< ::grpc::ByteBuffer>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncServerStreaming(6, context, request, writer, new_call_cq, notification_cq, tag); + void RequestSearchInFiles(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2262,20 +2280,23 @@ class MilvusService final { public: ExperimentalWithRawCallbackMethod_Search() { ::grpc::Service::experimental().MarkMethodRawCallback(5, - new ::grpc_impl::internal::CallbackServerStreamingHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( - [this] { return this->Search(); })); + new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this](::grpc::ServerContext* context, + const ::grpc::ByteBuffer* request, + ::grpc::ByteBuffer* response, + ::grpc::experimental::ServerCallbackRpcController* controller) { + this->Search(context, request, response, controller); + })); } ~ExperimentalWithRawCallbackMethod_Search() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::experimental::ServerWriteReactor< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* Search() { - return new ::grpc_impl::internal::UnimplementedWriteReactor< - ::grpc::ByteBuffer, ::grpc::ByteBuffer>;} + virtual void Search(::grpc::ServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); } }; template class ExperimentalWithRawCallbackMethod_SearchInFiles : public BaseClass { @@ -2284,20 +2305,23 @@ class MilvusService final { public: ExperimentalWithRawCallbackMethod_SearchInFiles() { ::grpc::Service::experimental().MarkMethodRawCallback(6, - new ::grpc_impl::internal::CallbackServerStreamingHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( - [this] { return this->SearchInFiles(); })); + new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this](::grpc::ServerContext* context, + const ::grpc::ByteBuffer* request, + ::grpc::ByteBuffer* response, + ::grpc::experimental::ServerCallbackRpcController* controller) { + this->SearchInFiles(context, request, response, controller); + })); } ~ExperimentalWithRawCallbackMethod_SearchInFiles() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::experimental::ServerWriteReactor< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* SearchInFiles() { - return new ::grpc_impl::internal::UnimplementedWriteReactor< - ::grpc::ByteBuffer, ::grpc::ByteBuffer>;} + virtual void SearchInFiles(::grpc::ServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); } }; template class ExperimentalWithRawCallbackMethod_DescribeTable : public BaseClass { @@ -2597,6 +2621,46 @@ class MilvusService final { virtual ::grpc::Status StreamedInsert(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::InsertParam,::milvus::grpc::VectorIds>* server_unary_streamer) = 0; }; template + class WithStreamedUnaryMethod_Search : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service *service) {} + public: + WithStreamedUnaryMethod_Search() { + ::grpc::Service::MarkMethodStreamed(5, + new ::grpc::internal::StreamedUnaryHandler< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResultList>(std::bind(&WithStreamedUnaryMethod_Search::StreamedSearch, this, std::placeholders::_1, std::placeholders::_2))); + } + ~WithStreamedUnaryMethod_Search() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::milvus::grpc::TopKQueryResultList* response) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedSearch(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::SearchParam,::milvus::grpc::TopKQueryResultList>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_SearchInFiles : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service *service) {} + public: + WithStreamedUnaryMethod_SearchInFiles() { + ::grpc::Service::MarkMethodStreamed(6, + new ::grpc::internal::StreamedUnaryHandler< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResultList>(std::bind(&WithStreamedUnaryMethod_SearchInFiles::StreamedSearchInFiles, this, std::placeholders::_1, std::placeholders::_2))); + } + ~WithStreamedUnaryMethod_SearchInFiles() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::milvus::grpc::TopKQueryResultList* response) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedSearchInFiles(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::SearchInFilesParam,::milvus::grpc::TopKQueryResultList>* server_unary_streamer) = 0; + }; + template class WithStreamedUnaryMethod_DescribeTable : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service *service) {} @@ -2736,47 +2800,7 @@ class MilvusService final { // replace default version of method with streamed unary virtual ::grpc::Status StreamedDropIndex(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::TableName,::milvus::grpc::Status>* server_unary_streamer) = 0; }; - typedef WithStreamedUnaryMethod_CreateTable > > > > > > > > > > > StreamedUnaryService; - template - class WithSplitStreamingMethod_Search : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service *service) {} - public: - WithSplitStreamingMethod_Search() { - ::grpc::Service::MarkMethodStreamed(5, - new ::grpc::internal::SplitServerStreamingHandler< ::milvus::grpc::SearchParam, ::milvus::grpc::TopKQueryResult>(std::bind(&WithSplitStreamingMethod_Search::StreamedSearch, this, std::placeholders::_1, std::placeholders::_2))); - } - ~WithSplitStreamingMethod_Search() override { - BaseClassMustBeDerivedFromService(this); - } - // disable regular version of this method - ::grpc::Status Search(::grpc::ServerContext* context, const ::milvus::grpc::SearchParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - // replace default version of method with split streamed - virtual ::grpc::Status StreamedSearch(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::milvus::grpc::SearchParam,::milvus::grpc::TopKQueryResult>* server_split_streamer) = 0; - }; - template - class WithSplitStreamingMethod_SearchInFiles : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(const Service *service) {} - public: - WithSplitStreamingMethod_SearchInFiles() { - ::grpc::Service::MarkMethodStreamed(6, - new ::grpc::internal::SplitServerStreamingHandler< ::milvus::grpc::SearchInFilesParam, ::milvus::grpc::TopKQueryResult>(std::bind(&WithSplitStreamingMethod_SearchInFiles::StreamedSearchInFiles, this, std::placeholders::_1, std::placeholders::_2))); - } - ~WithSplitStreamingMethod_SearchInFiles() override { - BaseClassMustBeDerivedFromService(this); - } - // disable regular version of this method - ::grpc::Status SearchInFiles(::grpc::ServerContext* context, const ::milvus::grpc::SearchInFilesParam* request, ::grpc::ServerWriter< ::milvus::grpc::TopKQueryResult>* writer) override { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - // replace default version of method with split streamed - virtual ::grpc::Status StreamedSearchInFiles(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::milvus::grpc::SearchInFilesParam,::milvus::grpc::TopKQueryResult>* server_split_streamer) = 0; - }; + typedef WithStreamedUnaryMethod_CreateTable > > > > > > > > > > > > > StreamedUnaryService; template class WithSplitStreamingMethod_ShowTables : public BaseClass { private: @@ -2797,8 +2821,8 @@ class MilvusService final { // replace default version of method with split streamed virtual ::grpc::Status StreamedShowTables(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::milvus::grpc::Command,::milvus::grpc::TableName>* server_split_streamer) = 0; }; - typedef WithSplitStreamingMethod_Search > > SplitStreamedService; - typedef WithStreamedUnaryMethod_CreateTable > > > > > > > > > > > > > > StreamedService; + typedef WithSplitStreamingMethod_ShowTables SplitStreamedService; + typedef WithStreamedUnaryMethod_CreateTable > > > > > > > > > > > > > > StreamedService; }; } // namespace grpc diff --git a/cpp/src/grpc/gen-milvus/milvus.pb.cc b/cpp/src/grpc/gen-milvus/milvus.pb.cc index 7cb053a9..2396c450 100644 --- a/cpp/src/grpc/gen-milvus/milvus.pb.cc +++ b/cpp/src/grpc/gen-milvus/milvus.pb.cc @@ -22,6 +22,7 @@ extern PROTOBUF_INTERNAL_EXPORT_milvus_2eproto ::PROTOBUF_NAMESPACE_ID::internal extern PROTOBUF_INTERNAL_EXPORT_milvus_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_SearchParam_milvus_2eproto; extern PROTOBUF_INTERNAL_EXPORT_status_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Status_status_2eproto; extern PROTOBUF_INTERNAL_EXPORT_milvus_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TableName_milvus_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_milvus_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TopKQueryResult_milvus_2eproto; namespace milvus { namespace grpc { class TableNameDefaultTypeInternal { @@ -64,6 +65,10 @@ class TopKQueryResultDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; } _TopKQueryResult_default_instance_; +class TopKQueryResultListDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _TopKQueryResultList_default_instance_; class StringReplyDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; @@ -327,11 +332,26 @@ static void InitDefaultsscc_info_TopKQueryResult_milvus_2eproto() { ::milvus::grpc::TopKQueryResult::InitAsDefaultInstance(); } -::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_TopKQueryResult_milvus_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_TopKQueryResult_milvus_2eproto}, { - &scc_info_Status_status_2eproto.base, +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TopKQueryResult_milvus_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_TopKQueryResult_milvus_2eproto}, { &scc_info_QueryResult_milvus_2eproto.base,}}; +static void InitDefaultsscc_info_TopKQueryResultList_milvus_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::milvus::grpc::_TopKQueryResultList_default_instance_; + new (ptr) ::milvus::grpc::TopKQueryResultList(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::milvus::grpc::TopKQueryResultList::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_TopKQueryResultList_milvus_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_TopKQueryResultList_milvus_2eproto}, { + &scc_info_Status_status_2eproto.base, + &scc_info_TopKQueryResult_milvus_2eproto.base,}}; + static void InitDefaultsscc_info_VectorIds_milvus_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -347,7 +367,7 @@ static void InitDefaultsscc_info_VectorIds_milvus_2eproto() { {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_VectorIds_milvus_2eproto}, { &scc_info_Status_status_2eproto.base,}}; -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_milvus_2eproto[17]; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_milvus_2eproto[18]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_milvus_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_milvus_2eproto = nullptr; @@ -424,9 +444,15 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_milvus_2eproto::offsets[] PROT ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(::milvus::grpc::TopKQueryResult, status_), PROTOBUF_FIELD_OFFSET(::milvus::grpc::TopKQueryResult, query_result_arrays_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::milvus::grpc::TopKQueryResultList, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::milvus::grpc::TopKQueryResultList, status_), + PROTOBUF_FIELD_OFFSET(::milvus::grpc::TopKQueryResultList, topk_query_result_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::milvus::grpc::StringReply, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -487,13 +513,14 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB { 53, -1, sizeof(::milvus::grpc::SearchInFilesParam)}, { 60, -1, sizeof(::milvus::grpc::QueryResult)}, { 67, -1, sizeof(::milvus::grpc::TopKQueryResult)}, - { 74, -1, sizeof(::milvus::grpc::StringReply)}, - { 81, -1, sizeof(::milvus::grpc::BoolReply)}, - { 88, -1, sizeof(::milvus::grpc::TableRowCount)}, - { 95, -1, sizeof(::milvus::grpc::Command)}, - { 101, -1, sizeof(::milvus::grpc::Index)}, - { 109, -1, sizeof(::milvus::grpc::IndexParam)}, - { 116, -1, sizeof(::milvus::grpc::DeleteByRangeParam)}, + { 73, -1, sizeof(::milvus::grpc::TopKQueryResultList)}, + { 80, -1, sizeof(::milvus::grpc::StringReply)}, + { 87, -1, sizeof(::milvus::grpc::BoolReply)}, + { 94, -1, sizeof(::milvus::grpc::TableRowCount)}, + { 101, -1, sizeof(::milvus::grpc::Command)}, + { 107, -1, sizeof(::milvus::grpc::Index)}, + { 115, -1, sizeof(::milvus::grpc::IndexParam)}, + { 122, -1, sizeof(::milvus::grpc::DeleteByRangeParam)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { @@ -507,6 +534,7 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = reinterpret_cast(&::milvus::grpc::_SearchInFilesParam_default_instance_), reinterpret_cast(&::milvus::grpc::_QueryResult_default_instance_), reinterpret_cast(&::milvus::grpc::_TopKQueryResult_default_instance_), + reinterpret_cast(&::milvus::grpc::_TopKQueryResultList_default_instance_), reinterpret_cast(&::milvus::grpc::_StringReply_default_instance_), reinterpret_cast(&::milvus::grpc::_BoolReply_default_instance_), reinterpret_cast(&::milvus::grpc::_TableRowCount_default_instance_), @@ -536,10 +564,12 @@ const char descriptor_table_protodef_milvus_2eproto[] PROTOBUF_SECTION_VARIABLE( " \001(\003\"[\n\022SearchInFilesParam\022\025\n\rfile_id_ar" "ray\030\001 \003(\t\022.\n\014search_param\030\002 \001(\0132\030.milvus" ".grpc.SearchParam\"+\n\013QueryResult\022\n\n\002id\030\001" - " \001(\003\022\020\n\010distance\030\002 \001(\001\"m\n\017TopKQueryResul" - "t\022#\n\006status\030\001 \001(\0132\023.milvus.grpc.Status\0225" - "\n\023query_result_arrays\030\002 \003(\0132\030.milvus.grp" - "c.QueryResult\"H\n\013StringReply\022#\n\006status\030\001" + " \001(\003\022\020\n\010distance\030\002 \001(\001\"H\n\017TopKQueryResul" + "t\0225\n\023query_result_arrays\030\001 \003(\0132\030.milvus." + "grpc.QueryResult\"s\n\023TopKQueryResultList\022" + "#\n\006status\030\001 \001(\0132\023.milvus.grpc.Status\0227\n\021" + "topk_query_result\030\002 \003(\0132\034.milvus.grpc.To" + "pKQueryResult\"H\n\013StringReply\022#\n\006status\030\001" " \001(\0132\023.milvus.grpc.Status\022\024\n\014string_repl" "y\030\002 \001(\t\"D\n\tBoolReply\022#\n\006status\030\001 \001(\0132\023.m" "ilvus.grpc.Status\022\022\n\nbool_reply\030\002 \001(\010\"M\n" @@ -551,7 +581,7 @@ const char descriptor_table_protodef_milvus_2eproto[] PROTOBUF_SECTION_VARIABLE( "\026.milvus.grpc.TableName\022!\n\005index\030\002 \001(\0132\022" ".milvus.grpc.Index\"K\n\022DeleteByRangeParam" "\022!\n\005range\030\001 \001(\0132\022.milvus.grpc.Range\022\022\n\nt" - "able_name\030\002 \001(\t2\352\007\n\rMilvusService\022>\n\013Cre" + "able_name\030\002 \001(\t2\356\007\n\rMilvusService\022>\n\013Cre" "ateTable\022\030.milvus.grpc.TableSchema\032\023.mil" "vus.grpc.Status\"\000\022<\n\010HasTable\022\026.milvus.g" "rpc.TableName\032\026.milvus.grpc.BoolReply\"\000\022" @@ -559,29 +589,29 @@ const char descriptor_table_protodef_milvus_2eproto[] PROTOBUF_SECTION_VARIABLE( "ilvus.grpc.Status\"\000\022=\n\013CreateIndex\022\027.mil" "vus.grpc.IndexParam\032\023.milvus.grpc.Status" "\"\000\022<\n\006Insert\022\030.milvus.grpc.InsertParam\032\026" - ".milvus.grpc.VectorIds\"\000\022D\n\006Search\022\030.mil" - "vus.grpc.SearchParam\032\034.milvus.grpc.TopKQ" - "ueryResult\"\0000\001\022R\n\rSearchInFiles\022\037.milvus" - ".grpc.SearchInFilesParam\032\034.milvus.grpc.T" - "opKQueryResult\"\0000\001\022C\n\rDescribeTable\022\026.mi" - "lvus.grpc.TableName\032\030.milvus.grpc.TableS" - "chema\"\000\022B\n\nCountTable\022\026.milvus.grpc.Tabl" - "eName\032\032.milvus.grpc.TableRowCount\"\000\022>\n\nS" - "howTables\022\024.milvus.grpc.Command\032\026.milvus" - ".grpc.TableName\"\0000\001\0227\n\003Cmd\022\024.milvus.grpc" - ".Command\032\030.milvus.grpc.StringReply\"\000\022G\n\r" - "DeleteByRange\022\037.milvus.grpc.DeleteByRang" - "eParam\032\023.milvus.grpc.Status\"\000\022=\n\014Preload" - "Table\022\026.milvus.grpc.TableName\032\023.milvus.g" - "rpc.Status\"\000\022B\n\rDescribeIndex\022\026.milvus.g" - "rpc.TableName\032\027.milvus.grpc.IndexParam\"\000" - "\022:\n\tDropIndex\022\026.milvus.grpc.TableName\032\023." - "milvus.grpc.Status\"\000b\006proto3" + ".milvus.grpc.VectorIds\"\000\022F\n\006Search\022\030.mil" + "vus.grpc.SearchParam\032 .milvus.grpc.TopKQ" + "ueryResultList\"\000\022T\n\rSearchInFiles\022\037.milv" + "us.grpc.SearchInFilesParam\032 .milvus.grpc" + ".TopKQueryResultList\"\000\022C\n\rDescribeTable\022" + "\026.milvus.grpc.TableName\032\030.milvus.grpc.Ta" + "bleSchema\"\000\022B\n\nCountTable\022\026.milvus.grpc." + "TableName\032\032.milvus.grpc.TableRowCount\"\000\022" + ">\n\nShowTables\022\024.milvus.grpc.Command\032\026.mi" + "lvus.grpc.TableName\"\0000\001\0227\n\003Cmd\022\024.milvus." + "grpc.Command\032\030.milvus.grpc.StringReply\"\000" + "\022G\n\rDeleteByRange\022\037.milvus.grpc.DeleteBy" + "RangeParam\032\023.milvus.grpc.Status\"\000\022=\n\014Pre" + "loadTable\022\026.milvus.grpc.TableName\032\023.milv" + "us.grpc.Status\"\000\022B\n\rDescribeIndex\022\026.milv" + "us.grpc.TableName\032\027.milvus.grpc.IndexPar" + "am\"\000\022:\n\tDropIndex\022\026.milvus.grpc.TableNam" + "e\032\023.milvus.grpc.Status\"\000b\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_milvus_2eproto_deps[1] = { &::descriptor_table_status_2eproto, }; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_milvus_2eproto_sccs[17] = { +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_milvus_2eproto_sccs[18] = { &scc_info_BoolReply_milvus_2eproto.base, &scc_info_Command_milvus_2eproto.base, &scc_info_DeleteByRangeParam_milvus_2eproto.base, @@ -598,15 +628,16 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mil &scc_info_TableRowCount_milvus_2eproto.base, &scc_info_TableSchema_milvus_2eproto.base, &scc_info_TopKQueryResult_milvus_2eproto.base, + &scc_info_TopKQueryResultList_milvus_2eproto.base, &scc_info_VectorIds_milvus_2eproto.base, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_milvus_2eproto_once; static bool descriptor_table_milvus_2eproto_initialized = false; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_milvus_2eproto = { - &descriptor_table_milvus_2eproto_initialized, descriptor_table_protodef_milvus_2eproto, "milvus.proto", 2388, - &descriptor_table_milvus_2eproto_once, descriptor_table_milvus_2eproto_sccs, descriptor_table_milvus_2eproto_deps, 17, 1, + &descriptor_table_milvus_2eproto_initialized, descriptor_table_protodef_milvus_2eproto, "milvus.proto", 2472, + &descriptor_table_milvus_2eproto_once, descriptor_table_milvus_2eproto_sccs, descriptor_table_milvus_2eproto_deps, 18, 1, schemas, file_default_instances, TableStruct_milvus_2eproto::offsets, - file_level_metadata_milvus_2eproto, 17, file_level_enum_descriptors_milvus_2eproto, file_level_service_descriptors_milvus_2eproto, + file_level_metadata_milvus_2eproto, 18, file_level_enum_descriptors_milvus_2eproto, file_level_service_descriptors_milvus_2eproto, }; // Force running AddDescriptors() at dynamic initialization time. @@ -3736,24 +3767,11 @@ void QueryResult::InternalSwap(QueryResult* other) { // =================================================================== void TopKQueryResult::InitAsDefaultInstance() { - ::milvus::grpc::_TopKQueryResult_default_instance_._instance.get_mutable()->status_ = const_cast< ::milvus::grpc::Status*>( - ::milvus::grpc::Status::internal_default_instance()); } class TopKQueryResult::_Internal { public: - static const ::milvus::grpc::Status& status(const TopKQueryResult* msg); }; -const ::milvus::grpc::Status& -TopKQueryResult::_Internal::status(const TopKQueryResult* msg) { - return *msg->status_; -} -void TopKQueryResult::clear_status() { - if (GetArenaNoVirtual() == nullptr && status_ != nullptr) { - delete status_; - } - status_ = nullptr; -} TopKQueryResult::TopKQueryResult() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); @@ -3764,17 +3782,11 @@ TopKQueryResult::TopKQueryResult(const TopKQueryResult& from) _internal_metadata_(nullptr), query_result_arrays_(from.query_result_arrays_) { _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_status()) { - status_ = new ::milvus::grpc::Status(*from.status_); - } else { - status_ = nullptr; - } // @@protoc_insertion_point(copy_constructor:milvus.grpc.TopKQueryResult) } void TopKQueryResult::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TopKQueryResult_milvus_2eproto.base); - status_ = nullptr; } TopKQueryResult::~TopKQueryResult() { @@ -3783,7 +3795,6 @@ TopKQueryResult::~TopKQueryResult() { } void TopKQueryResult::SharedDtor() { - if (this != internal_default_instance()) delete status_; } void TopKQueryResult::SetCachedSize(int size) const { @@ -3802,6 +3813,287 @@ void TopKQueryResult::Clear() { (void) cached_has_bits; query_result_arrays_.Clear(); + _internal_metadata_.Clear(); +} + +#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER +const char* TopKQueryResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(add_query_result_arrays(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} +#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER +bool TopKQueryResult::MergePartialFromCodedStream( + ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + // @@protoc_insertion_point(parse_start:milvus.grpc.TopKQueryResult) + for (;;) { + ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; + case 1: { + if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { + DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( + input, add_query_result_arrays())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:milvus.grpc.TopKQueryResult) + return true; +failure: + // @@protoc_insertion_point(parse_failure:milvus.grpc.TopKQueryResult) + return false; +#undef DO_ +} +#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER + +void TopKQueryResult::SerializeWithCachedSizes( + ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:milvus.grpc.TopKQueryResult) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; + for (unsigned int i = 0, + n = static_cast(this->query_result_arrays_size()); i < n; i++) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, + this->query_result_arrays(static_cast(i)), + output); + } + + if (_internal_metadata_.have_unknown_fields()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( + _internal_metadata_.unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:milvus.grpc.TopKQueryResult) +} + +::PROTOBUF_NAMESPACE_ID::uint8* TopKQueryResult::InternalSerializeWithCachedSizesToArray( + ::PROTOBUF_NAMESPACE_ID::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:milvus.grpc.TopKQueryResult) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; + for (unsigned int i = 0, + n = static_cast(this->query_result_arrays_size()); i < n; i++) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessageToArray( + 1, this->query_result_arrays(static_cast(i)), target); + } + + if (_internal_metadata_.have_unknown_fields()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:milvus.grpc.TopKQueryResult) + return target; +} + +size_t TopKQueryResult::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:milvus.grpc.TopKQueryResult) + size_t total_size = 0; + + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( + _internal_metadata_.unknown_fields()); + } + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; + { + unsigned int count = static_cast(this->query_result_arrays_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + this->query_result_arrays(static_cast(i))); + } + } + + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void TopKQueryResult::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:milvus.grpc.TopKQueryResult) + GOOGLE_DCHECK_NE(&from, this); + const TopKQueryResult* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.grpc.TopKQueryResult) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.grpc.TopKQueryResult) + MergeFrom(*source); + } +} + +void TopKQueryResult::MergeFrom(const TopKQueryResult& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:milvus.grpc.TopKQueryResult) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + query_result_arrays_.MergeFrom(from.query_result_arrays_); +} + +void TopKQueryResult::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:milvus.grpc.TopKQueryResult) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void TopKQueryResult::CopyFrom(const TopKQueryResult& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:milvus.grpc.TopKQueryResult) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool TopKQueryResult::IsInitialized() const { + return true; +} + +void TopKQueryResult::InternalSwap(TopKQueryResult* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + CastToBase(&query_result_arrays_)->InternalSwap(CastToBase(&other->query_result_arrays_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata TopKQueryResult::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void TopKQueryResultList::InitAsDefaultInstance() { + ::milvus::grpc::_TopKQueryResultList_default_instance_._instance.get_mutable()->status_ = const_cast< ::milvus::grpc::Status*>( + ::milvus::grpc::Status::internal_default_instance()); +} +class TopKQueryResultList::_Internal { + public: + static const ::milvus::grpc::Status& status(const TopKQueryResultList* msg); +}; + +const ::milvus::grpc::Status& +TopKQueryResultList::_Internal::status(const TopKQueryResultList* msg) { + return *msg->status_; +} +void TopKQueryResultList::clear_status() { + if (GetArenaNoVirtual() == nullptr && status_ != nullptr) { + delete status_; + } + status_ = nullptr; +} +TopKQueryResultList::TopKQueryResultList() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:milvus.grpc.TopKQueryResultList) +} +TopKQueryResultList::TopKQueryResultList(const TopKQueryResultList& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr), + topk_query_result_(from.topk_query_result_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_status()) { + status_ = new ::milvus::grpc::Status(*from.status_); + } else { + status_ = nullptr; + } + // @@protoc_insertion_point(copy_constructor:milvus.grpc.TopKQueryResultList) +} + +void TopKQueryResultList::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TopKQueryResultList_milvus_2eproto.base); + status_ = nullptr; +} + +TopKQueryResultList::~TopKQueryResultList() { + // @@protoc_insertion_point(destructor:milvus.grpc.TopKQueryResultList) + SharedDtor(); +} + +void TopKQueryResultList::SharedDtor() { + if (this != internal_default_instance()) delete status_; +} + +void TopKQueryResultList::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const TopKQueryResultList& TopKQueryResultList::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TopKQueryResultList_milvus_2eproto.base); + return *internal_default_instance(); +} + + +void TopKQueryResultList::Clear() { +// @@protoc_insertion_point(message_clear_start:milvus.grpc.TopKQueryResultList) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + topk_query_result_.Clear(); if (GetArenaNoVirtual() == nullptr && status_ != nullptr) { delete status_; } @@ -3810,7 +4102,7 @@ void TopKQueryResult::Clear() { } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -const char* TopKQueryResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +const char* TopKQueryResultList::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; @@ -3824,13 +4116,13 @@ const char* TopKQueryResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); } else goto handle_unusual; continue; - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_query_result_arrays(), ptr); + ptr = ctx->ParseMessage(add_topk_query_result(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18); @@ -3856,11 +4148,11 @@ failure: #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool TopKQueryResult::MergePartialFromCodedStream( +bool TopKQueryResultList::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(parse_start:milvus.grpc.TopKQueryResultList) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; @@ -3877,11 +4169,11 @@ bool TopKQueryResult::MergePartialFromCodedStream( break; } - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_query_result_arrays())); + input, add_topk_query_result())); } else { goto handle_unusual; } @@ -3900,18 +4192,18 @@ bool TopKQueryResult::MergePartialFromCodedStream( } } success: - // @@protoc_insertion_point(parse_success:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(parse_success:milvus.grpc.TopKQueryResultList) return true; failure: - // @@protoc_insertion_point(parse_failure:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(parse_failure:milvus.grpc.TopKQueryResultList) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -void TopKQueryResult::SerializeWithCachedSizes( +void TopKQueryResultList::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(serialize_start:milvus.grpc.TopKQueryResultList) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; @@ -3921,12 +4213,12 @@ void TopKQueryResult::SerializeWithCachedSizes( 1, _Internal::status(this), output); } - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; for (unsigned int i = 0, - n = static_cast(this->query_result_arrays_size()); i < n; i++) { + n = static_cast(this->topk_query_result_size()); i < n; i++) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray( 2, - this->query_result_arrays(static_cast(i)), + this->topk_query_result(static_cast(i)), output); } @@ -3934,12 +4226,12 @@ void TopKQueryResult::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } - // @@protoc_insertion_point(serialize_end:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(serialize_end:milvus.grpc.TopKQueryResultList) } -::PROTOBUF_NAMESPACE_ID::uint8* TopKQueryResult::InternalSerializeWithCachedSizesToArray( +::PROTOBUF_NAMESPACE_ID::uint8* TopKQueryResultList::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(serialize_to_array_start:milvus.grpc.TopKQueryResultList) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; @@ -3950,24 +4242,24 @@ void TopKQueryResult::SerializeWithCachedSizes( 1, _Internal::status(this), target); } - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; for (unsigned int i = 0, - n = static_cast(this->query_result_arrays_size()); i < n; i++) { + n = static_cast(this->topk_query_result_size()); i < n; i++) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( - 2, this->query_result_arrays(static_cast(i)), target); + 2, this->topk_query_result(static_cast(i)), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } - // @@protoc_insertion_point(serialize_to_array_end:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(serialize_to_array_end:milvus.grpc.TopKQueryResultList) return target; } -size_t TopKQueryResult::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:milvus.grpc.TopKQueryResult) +size_t TopKQueryResultList::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:milvus.grpc.TopKQueryResultList) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { @@ -3979,14 +4271,14 @@ size_t TopKQueryResult::ByteSizeLong() const { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; { - unsigned int count = static_cast(this->query_result_arrays_size()); + unsigned int count = static_cast(this->topk_query_result_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( - this->query_result_arrays(static_cast(i))); + this->topk_query_result(static_cast(i))); } } @@ -4002,60 +4294,60 @@ size_t TopKQueryResult::ByteSizeLong() const { return total_size; } -void TopKQueryResult::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:milvus.grpc.TopKQueryResult) +void TopKQueryResultList::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:milvus.grpc.TopKQueryResultList) GOOGLE_DCHECK_NE(&from, this); - const TopKQueryResult* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + const TopKQueryResultList* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( &from); if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.grpc.TopKQueryResultList) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.grpc.TopKQueryResultList) MergeFrom(*source); } } -void TopKQueryResult::MergeFrom(const TopKQueryResult& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:milvus.grpc.TopKQueryResult) +void TopKQueryResultList::MergeFrom(const TopKQueryResultList& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:milvus.grpc.TopKQueryResultList) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; - query_result_arrays_.MergeFrom(from.query_result_arrays_); + topk_query_result_.MergeFrom(from.topk_query_result_); if (from.has_status()) { mutable_status()->::milvus::grpc::Status::MergeFrom(from.status()); } } -void TopKQueryResult::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:milvus.grpc.TopKQueryResult) +void TopKQueryResultList::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:milvus.grpc.TopKQueryResultList) if (&from == this) return; Clear(); MergeFrom(from); } -void TopKQueryResult::CopyFrom(const TopKQueryResult& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:milvus.grpc.TopKQueryResult) +void TopKQueryResultList::CopyFrom(const TopKQueryResultList& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:milvus.grpc.TopKQueryResultList) if (&from == this) return; Clear(); MergeFrom(from); } -bool TopKQueryResult::IsInitialized() const { +bool TopKQueryResultList::IsInitialized() const { return true; } -void TopKQueryResult::InternalSwap(TopKQueryResult* other) { +void TopKQueryResultList::InternalSwap(TopKQueryResultList* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); - CastToBase(&query_result_arrays_)->InternalSwap(CastToBase(&other->query_result_arrays_)); + CastToBase(&topk_query_result_)->InternalSwap(CastToBase(&other->topk_query_result_)); swap(status_, other->status_); } -::PROTOBUF_NAMESPACE_ID::Metadata TopKQueryResult::GetMetadata() const { +::PROTOBUF_NAMESPACE_ID::Metadata TopKQueryResultList::GetMetadata() const { return GetMetadataStatic(); } @@ -6323,6 +6615,9 @@ template<> PROTOBUF_NOINLINE ::milvus::grpc::QueryResult* Arena::CreateMaybeMess template<> PROTOBUF_NOINLINE ::milvus::grpc::TopKQueryResult* Arena::CreateMaybeMessage< ::milvus::grpc::TopKQueryResult >(Arena* arena) { return Arena::CreateInternal< ::milvus::grpc::TopKQueryResult >(arena); } +template<> PROTOBUF_NOINLINE ::milvus::grpc::TopKQueryResultList* Arena::CreateMaybeMessage< ::milvus::grpc::TopKQueryResultList >(Arena* arena) { + return Arena::CreateInternal< ::milvus::grpc::TopKQueryResultList >(arena); +} template<> PROTOBUF_NOINLINE ::milvus::grpc::StringReply* Arena::CreateMaybeMessage< ::milvus::grpc::StringReply >(Arena* arena) { return Arena::CreateInternal< ::milvus::grpc::StringReply >(arena); } diff --git a/cpp/src/grpc/gen-milvus/milvus.pb.h b/cpp/src/grpc/gen-milvus/milvus.pb.h index 374069d3..c9f95d79 100644 --- a/cpp/src/grpc/gen-milvus/milvus.pb.h +++ b/cpp/src/grpc/gen-milvus/milvus.pb.h @@ -48,7 +48,7 @@ struct TableStruct_milvus_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[17] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[18] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; @@ -105,6 +105,9 @@ extern TableSchemaDefaultTypeInternal _TableSchema_default_instance_; class TopKQueryResult; class TopKQueryResultDefaultTypeInternal; extern TopKQueryResultDefaultTypeInternal _TopKQueryResult_default_instance_; +class TopKQueryResultList; +class TopKQueryResultListDefaultTypeInternal; +extern TopKQueryResultListDefaultTypeInternal _TopKQueryResultList_default_instance_; class VectorIds; class VectorIdsDefaultTypeInternal; extern VectorIdsDefaultTypeInternal _VectorIds_default_instance_; @@ -127,6 +130,7 @@ template<> ::milvus::grpc::TableName* Arena::CreateMaybeMessage<::milvus::grpc:: template<> ::milvus::grpc::TableRowCount* Arena::CreateMaybeMessage<::milvus::grpc::TableRowCount>(Arena*); template<> ::milvus::grpc::TableSchema* Arena::CreateMaybeMessage<::milvus::grpc::TableSchema>(Arena*); template<> ::milvus::grpc::TopKQueryResult* Arena::CreateMaybeMessage<::milvus::grpc::TopKQueryResult>(Arena*); +template<> ::milvus::grpc::TopKQueryResultList* Arena::CreateMaybeMessage<::milvus::grpc::TopKQueryResultList>(Arena*); template<> ::milvus::grpc::VectorIds* Arena::CreateMaybeMessage<::milvus::grpc::VectorIds>(Arena*); PROTOBUF_NAMESPACE_CLOSE namespace milvus { @@ -1610,10 +1614,9 @@ class TopKQueryResult : // accessors ------------------------------------------------------- enum : int { - kQueryResultArraysFieldNumber = 2, - kStatusFieldNumber = 1, + kQueryResultArraysFieldNumber = 1, }; - // repeated .milvus.grpc.QueryResult query_result_arrays = 2; + // repeated .milvus.grpc.QueryResult query_result_arrays = 1; int query_result_arrays_size() const; void clear_query_result_arrays(); ::milvus::grpc::QueryResult* mutable_query_result_arrays(int index); @@ -1624,6 +1627,144 @@ class TopKQueryResult : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult >& query_result_arrays() const; + // @@protoc_insertion_point(class_scope:milvus.grpc.TopKQueryResult) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult > query_result_arrays_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_milvus_2eproto; +}; +// ------------------------------------------------------------------- + +class TopKQueryResultList : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.grpc.TopKQueryResultList) */ { + public: + TopKQueryResultList(); + virtual ~TopKQueryResultList(); + + TopKQueryResultList(const TopKQueryResultList& from); + TopKQueryResultList(TopKQueryResultList&& from) noexcept + : TopKQueryResultList() { + *this = ::std::move(from); + } + + inline TopKQueryResultList& operator=(const TopKQueryResultList& from) { + CopyFrom(from); + return *this; + } + inline TopKQueryResultList& operator=(TopKQueryResultList&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const TopKQueryResultList& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const TopKQueryResultList* internal_default_instance() { + return reinterpret_cast( + &_TopKQueryResultList_default_instance_); + } + static constexpr int kIndexInFileMessages = + 10; + + friend void swap(TopKQueryResultList& a, TopKQueryResultList& b) { + a.Swap(&b); + } + inline void Swap(TopKQueryResultList* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline TopKQueryResultList* New() const final { + return CreateMaybeMessage(nullptr); + } + + TopKQueryResultList* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const TopKQueryResultList& from); + void MergeFrom(const TopKQueryResultList& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + #else + bool MergePartialFromCodedStream( + ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; + #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER + void SerializeWithCachedSizes( + ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final; + ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( + ::PROTOBUF_NAMESPACE_ID::uint8* target) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TopKQueryResultList* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "milvus.grpc.TopKQueryResultList"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_milvus_2eproto); + return ::descriptor_table_milvus_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTopkQueryResultFieldNumber = 2, + kStatusFieldNumber = 1, + }; + // repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; + int topk_query_result_size() const; + void clear_topk_query_result(); + ::milvus::grpc::TopKQueryResult* mutable_topk_query_result(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::TopKQueryResult >* + mutable_topk_query_result(); + const ::milvus::grpc::TopKQueryResult& topk_query_result(int index) const; + ::milvus::grpc::TopKQueryResult* add_topk_query_result(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::TopKQueryResult >& + topk_query_result() const; + // .milvus.grpc.Status status = 1; bool has_status() const; void clear_status(); @@ -1632,12 +1773,12 @@ class TopKQueryResult : ::milvus::grpc::Status* mutable_status(); void set_allocated_status(::milvus::grpc::Status* status); - // @@protoc_insertion_point(class_scope:milvus.grpc.TopKQueryResult) + // @@protoc_insertion_point(class_scope:milvus.grpc.TopKQueryResultList) private: class _Internal; ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult > query_result_arrays_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::TopKQueryResult > topk_query_result_; ::milvus::grpc::Status* status_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_milvus_2eproto; @@ -1686,7 +1827,7 @@ class StringReply : &_StringReply_default_instance_); } static constexpr int kIndexInFileMessages = - 10; + 11; friend void swap(StringReply& a, StringReply& b) { a.Swap(&b); @@ -1833,7 +1974,7 @@ class BoolReply : &_BoolReply_default_instance_); } static constexpr int kIndexInFileMessages = - 11; + 12; friend void swap(BoolReply& a, BoolReply& b) { a.Swap(&b); @@ -1974,7 +2115,7 @@ class TableRowCount : &_TableRowCount_default_instance_); } static constexpr int kIndexInFileMessages = - 12; + 13; friend void swap(TableRowCount& a, TableRowCount& b) { a.Swap(&b); @@ -2115,7 +2256,7 @@ class Command : &_Command_default_instance_); } static constexpr int kIndexInFileMessages = - 13; + 14; friend void swap(Command& a, Command& b) { a.Swap(&b); @@ -2252,7 +2393,7 @@ class Index : &_Index_default_instance_); } static constexpr int kIndexInFileMessages = - 14; + 15; friend void swap(Index& a, Index& b) { a.Swap(&b); @@ -2397,7 +2538,7 @@ class IndexParam : &_IndexParam_default_instance_); } static constexpr int kIndexInFileMessages = - 15; + 16; friend void swap(IndexParam& a, IndexParam& b) { a.Swap(&b); @@ -2541,7 +2682,7 @@ class DeleteByRangeParam : &_DeleteByRangeParam_default_instance_); } static constexpr int kIndexInFileMessages = - 16; + 17; friend void swap(DeleteByRangeParam& a, DeleteByRangeParam& b) { a.Swap(&b); @@ -3467,33 +3608,67 @@ inline void QueryResult::set_distance(double value) { // TopKQueryResult +// repeated .milvus.grpc.QueryResult query_result_arrays = 1; +inline int TopKQueryResult::query_result_arrays_size() const { + return query_result_arrays_.size(); +} +inline void TopKQueryResult::clear_query_result_arrays() { + query_result_arrays_.Clear(); +} +inline ::milvus::grpc::QueryResult* TopKQueryResult::mutable_query_result_arrays(int index) { + // @@protoc_insertion_point(field_mutable:milvus.grpc.TopKQueryResult.query_result_arrays) + return query_result_arrays_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult >* +TopKQueryResult::mutable_query_result_arrays() { + // @@protoc_insertion_point(field_mutable_list:milvus.grpc.TopKQueryResult.query_result_arrays) + return &query_result_arrays_; +} +inline const ::milvus::grpc::QueryResult& TopKQueryResult::query_result_arrays(int index) const { + // @@protoc_insertion_point(field_get:milvus.grpc.TopKQueryResult.query_result_arrays) + return query_result_arrays_.Get(index); +} +inline ::milvus::grpc::QueryResult* TopKQueryResult::add_query_result_arrays() { + // @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.query_result_arrays) + return query_result_arrays_.Add(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult >& +TopKQueryResult::query_result_arrays() const { + // @@protoc_insertion_point(field_list:milvus.grpc.TopKQueryResult.query_result_arrays) + return query_result_arrays_; +} + +// ------------------------------------------------------------------- + +// TopKQueryResultList + // .milvus.grpc.Status status = 1; -inline bool TopKQueryResult::has_status() const { +inline bool TopKQueryResultList::has_status() const { return this != internal_default_instance() && status_ != nullptr; } -inline const ::milvus::grpc::Status& TopKQueryResult::status() const { +inline const ::milvus::grpc::Status& TopKQueryResultList::status() const { const ::milvus::grpc::Status* p = status_; - // @@protoc_insertion_point(field_get:milvus.grpc.TopKQueryResult.status) + // @@protoc_insertion_point(field_get:milvus.grpc.TopKQueryResultList.status) return p != nullptr ? *p : *reinterpret_cast( &::milvus::grpc::_Status_default_instance_); } -inline ::milvus::grpc::Status* TopKQueryResult::release_status() { - // @@protoc_insertion_point(field_release:milvus.grpc.TopKQueryResult.status) +inline ::milvus::grpc::Status* TopKQueryResultList::release_status() { + // @@protoc_insertion_point(field_release:milvus.grpc.TopKQueryResultList.status) ::milvus::grpc::Status* temp = status_; status_ = nullptr; return temp; } -inline ::milvus::grpc::Status* TopKQueryResult::mutable_status() { +inline ::milvus::grpc::Status* TopKQueryResultList::mutable_status() { if (status_ == nullptr) { auto* p = CreateMaybeMessage<::milvus::grpc::Status>(GetArenaNoVirtual()); status_ = p; } - // @@protoc_insertion_point(field_mutable:milvus.grpc.TopKQueryResult.status) + // @@protoc_insertion_point(field_mutable:milvus.grpc.TopKQueryResultList.status) return status_; } -inline void TopKQueryResult::set_allocated_status(::milvus::grpc::Status* status) { +inline void TopKQueryResultList::set_allocated_status(::milvus::grpc::Status* status) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(status_); @@ -3509,37 +3684,37 @@ inline void TopKQueryResult::set_allocated_status(::milvus::grpc::Status* status } status_ = status; - // @@protoc_insertion_point(field_set_allocated:milvus.grpc.TopKQueryResult.status) + // @@protoc_insertion_point(field_set_allocated:milvus.grpc.TopKQueryResultList.status) } -// repeated .milvus.grpc.QueryResult query_result_arrays = 2; -inline int TopKQueryResult::query_result_arrays_size() const { - return query_result_arrays_.size(); +// repeated .milvus.grpc.TopKQueryResult topk_query_result = 2; +inline int TopKQueryResultList::topk_query_result_size() const { + return topk_query_result_.size(); } -inline void TopKQueryResult::clear_query_result_arrays() { - query_result_arrays_.Clear(); +inline void TopKQueryResultList::clear_topk_query_result() { + topk_query_result_.Clear(); } -inline ::milvus::grpc::QueryResult* TopKQueryResult::mutable_query_result_arrays(int index) { - // @@protoc_insertion_point(field_mutable:milvus.grpc.TopKQueryResult.query_result_arrays) - return query_result_arrays_.Mutable(index); +inline ::milvus::grpc::TopKQueryResult* TopKQueryResultList::mutable_topk_query_result(int index) { + // @@protoc_insertion_point(field_mutable:milvus.grpc.TopKQueryResultList.topk_query_result) + return topk_query_result_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult >* -TopKQueryResult::mutable_query_result_arrays() { - // @@protoc_insertion_point(field_mutable_list:milvus.grpc.TopKQueryResult.query_result_arrays) - return &query_result_arrays_; +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::TopKQueryResult >* +TopKQueryResultList::mutable_topk_query_result() { + // @@protoc_insertion_point(field_mutable_list:milvus.grpc.TopKQueryResultList.topk_query_result) + return &topk_query_result_; } -inline const ::milvus::grpc::QueryResult& TopKQueryResult::query_result_arrays(int index) const { - // @@protoc_insertion_point(field_get:milvus.grpc.TopKQueryResult.query_result_arrays) - return query_result_arrays_.Get(index); +inline const ::milvus::grpc::TopKQueryResult& TopKQueryResultList::topk_query_result(int index) const { + // @@protoc_insertion_point(field_get:milvus.grpc.TopKQueryResultList.topk_query_result) + return topk_query_result_.Get(index); } -inline ::milvus::grpc::QueryResult* TopKQueryResult::add_query_result_arrays() { - // @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.query_result_arrays) - return query_result_arrays_.Add(); +inline ::milvus::grpc::TopKQueryResult* TopKQueryResultList::add_topk_query_result() { + // @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResultList.topk_query_result) + return topk_query_result_.Add(); } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::QueryResult >& -TopKQueryResult::query_result_arrays() const { - // @@protoc_insertion_point(field_list:milvus.grpc.TopKQueryResult.query_result_arrays) - return query_result_arrays_; +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::grpc::TopKQueryResult >& +TopKQueryResultList::topk_query_result() const { + // @@protoc_insertion_point(field_list:milvus.grpc.TopKQueryResultList.topk_query_result) + return topk_query_result_; } // ------------------------------------------------------------------- @@ -4116,6 +4291,8 @@ inline void DeleteByRangeParam::set_allocated_table_name(std::string* table_name // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/cpp/src/grpc/milvus.proto b/cpp/src/grpc/milvus.proto index ff95a305..d2b7a022 100644 --- a/cpp/src/grpc/milvus.proto +++ b/cpp/src/grpc/milvus.proto @@ -84,8 +84,15 @@ message QueryResult { * @brief TopK query result */ message TopKQueryResult { + repeated QueryResult query_result_arrays = 1; +} + +/** + * @brief List of topK query result + */ +message TopKQueryResultList { Status status = 1; - repeated QueryResult query_result_arrays = 2; + repeated TopKQueryResult topk_query_result = 2; } /** @@ -211,7 +218,7 @@ service MilvusService { * * @return query result array. */ - rpc Search(SearchParam) returns (stream TopKQueryResult) {} + rpc Search(SearchParam) returns (TopKQueryResultList) {} /** * @brief Internal use query interface @@ -225,7 +232,7 @@ service MilvusService { * * @return query result array. */ - rpc SearchInFiles(SearchInFilesParam) returns (stream TopKQueryResult) {} + rpc SearchInFiles(SearchInFilesParam) returns (TopKQueryResultList) {} /** * @brief Get table schema diff --git a/cpp/src/scheduler/SchedInst.cpp b/cpp/src/scheduler/SchedInst.cpp index 54548540..35c8eeb1 100644 --- a/cpp/src/scheduler/SchedInst.cpp +++ b/cpp/src/scheduler/SchedInst.cpp @@ -21,50 +21,62 @@ std::mutex SchedInst::mutex_; void StartSchedulerService() { - server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE); - auto resources = config.GetChild(server::CONFIG_RESOURCES).GetChildren(); - for (auto &resource : resources) { - auto &resname = resource.first; - auto &resconf = resource.second; - auto type = resconf.GetValue(server::CONFIG_RESOURCE_TYPE); + try{ + server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE); + +// if (config.GetSequences().empty() || config.GetChildren().empty()) throw ...; + + auto resources = config.GetChild(server::CONFIG_RESOURCES).GetChildren(); + +// if (resources.empty()) throw ...; + + for (auto &resource : resources) { + auto &resname = resource.first; + auto &resconf = resource.second; + auto type = resconf.GetValue(server::CONFIG_RESOURCE_TYPE); // auto memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_MEMORY); - auto device_id = resconf.GetInt64Value(server::CONFIG_RESOURCE_DEVICE_ID); - auto enable_loader = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_LOADER); - auto enable_executor = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_EXECUTOR); - auto pinned_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_PIN_MEMORY); - auto temp_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_TEMP_MEMORY); - auto resource_num = resconf.GetInt64Value(server::CONFIG_RESOURCE_NUM); - - ResMgrInst::GetInstance()->Add(ResourceFactory::Create(resname, - type, - device_id, - enable_loader, - enable_executor)); - - pinned_memory = 1024 * 1024 * pinned_memory; - temp_memory = 1024 * 1024 * temp_memory; - knowhere::FaissGpuResourceMgr::GetInstance().InitDevice(device_id, pinned_memory, temp_memory, resource_num); - } + auto device_id = resconf.GetInt64Value(server::CONFIG_RESOURCE_DEVICE_ID); + auto enable_loader = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_LOADER); + auto enable_executor = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_EXECUTOR); + auto pinned_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_PIN_MEMORY); + auto temp_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_TEMP_MEMORY); + auto resource_num = resconf.GetInt64Value(server::CONFIG_RESOURCE_NUM); - knowhere::FaissGpuResourceMgr::GetInstance().InitResource(); + ResMgrInst::GetInstance()->Add(ResourceFactory::Create(resname, + type, + device_id, + enable_loader, + enable_executor)); + + pinned_memory = 1024 * 1024 * pinned_memory; + temp_memory = 1024 * 1024 * temp_memory; + knowhere::FaissGpuResourceMgr::GetInstance().InitDevice(device_id, pinned_memory, temp_memory, resource_num); + } + + knowhere::FaissGpuResourceMgr::GetInstance().InitResource(); // auto default_connection = Connection("default_connection", 500.0); - auto connections = config.GetChild(server::CONFIG_RESOURCE_CONNECTIONS).GetChildren(); - for (auto &conn : connections) { - auto &connect_name = conn.first; - auto &connect_conf = conn.second; - auto connect_speed = connect_conf.GetInt64Value(server::CONFIG_SPEED_CONNECTIONS); - auto connect_endpoint = connect_conf.GetValue(server::CONFIG_ENDPOINT_CONNECTIONS); - - std::string delimiter = "==="; - std::string left = connect_endpoint.substr(0, connect_endpoint.find(delimiter)); - std::string right = connect_endpoint.substr(connect_endpoint.find(delimiter) + 3, - connect_endpoint.length()); - - auto connection = Connection(connect_name, connect_speed); - ResMgrInst::GetInstance()->Connect(left, right, connection); + auto connections = config.GetChild(server::CONFIG_RESOURCE_CONNECTIONS).GetChildren(); + for (auto &conn : connections) { + auto &connect_name = conn.first; + auto &connect_conf = conn.second; + auto connect_speed = connect_conf.GetInt64Value(server::CONFIG_SPEED_CONNECTIONS); + auto connect_endpoint = connect_conf.GetValue(server::CONFIG_ENDPOINT_CONNECTIONS); + + std::string delimiter = "==="; + std::string left = connect_endpoint.substr(0, connect_endpoint.find(delimiter)); + std::string right = connect_endpoint.substr(connect_endpoint.find(delimiter) + 3, + connect_endpoint.length()); + + auto connection = Connection(connect_name, connect_speed); + ResMgrInst::GetInstance()->Connect(left, right, connection); + } + } catch (...) { +// log <<< ; +// exit(-1); } + ResMgrInst::GetInstance()->Start(); SchedInst::GetInstance()->Start(); } diff --git a/cpp/src/scheduler/task/SearchTask.cpp b/cpp/src/scheduler/task/SearchTask.cpp index 3ddc2beb..56885bae 100644 --- a/cpp/src/scheduler/task/SearchTask.cpp +++ b/cpp/src/scheduler/task/SearchTask.cpp @@ -157,12 +157,19 @@ XSearchTask::Execute() { try { //step 2: search + auto start = std::chrono::high_resolution_clock::now(); index_engine_->Search(context->nq(), context->vectors(), inner_k, nprobe, output_distence.data(), output_ids.data()); + auto finish = std::chrono::high_resolution_clock::now(); +// std::cout << "Knowhere COST: " << std::chrono::duration_cast>(finish - start).count() << "s\n"; +// std::cout << "********************************************************\n"; + double span = rc.RecordSection("do search for context:" + context->Identity()); context->AccumSearchCost(span); + start = std::chrono::high_resolution_clock::now(); + //step 3: cluster result SearchContext::ResultSet result_set; auto spec_k = index_engine_->Count() < context->topk() ? index_engine_->Count() : context->topk(); @@ -174,8 +181,11 @@ XSearchTask::Execute() { //step 4: pick up topk result XSearchTask::TopkResult(result_set, inner_k, metric_l2, context->GetResult()); - span = rc.RecordSection("reduce topk for context:" + context->Identity()); context->AccumReduceCost(span); + span = rc.RecordSection("reduce topk for context:" + context->Identity()); + finish = std::chrono::high_resolution_clock::now(); +// std::cout << "Reduce COST: " << std::chrono::duration_cast>(finish - start).count() << "s\n"; +// std::cout << "********************************************************\n"; } catch (std::exception &ex) { ENGINE_LOG_ERROR << "SearchTask encounter exception: " << ex.what(); @@ -188,7 +198,6 @@ XSearchTask::Execute() { } rc.ElapseFromBegin("totally cost"); - // release index in resource index_engine_ = nullptr; } diff --git a/cpp/src/sdk/grpc/ClientProxy.cpp b/cpp/src/sdk/grpc/ClientProxy.cpp index 32e1a6e8..113c0b63 100644 --- a/cpp/src/sdk/grpc/ClientProxy.cpp +++ b/cpp/src/sdk/grpc/ClientProxy.cpp @@ -240,16 +240,16 @@ ClientProxy::Search(const std::string &table_name, } //step 3: search vectors - std::vector<::milvus::grpc::TopKQueryResult> result_array; - Status status = client_ptr_->Search(result_array, search_param); + ::milvus::grpc::TopKQueryResultList topk_query_result_list; + Status status = client_ptr_->Search(topk_query_result_list, search_param); //step 4: convert result array - for (auto &grpc_topk_result : result_array) { + for (uint64_t i = 0; i < topk_query_result_list.topk_query_result_size(); ++i) { TopKQueryResult result; - for (size_t i = 0; i < grpc_topk_result.query_result_arrays_size(); i++) { + for (uint64_t j = 0; j < topk_query_result_list.topk_query_result(i).query_result_arrays_size(); ++j) { QueryResult query_result; - query_result.id = grpc_topk_result.query_result_arrays(i).id(); - query_result.distance = grpc_topk_result.query_result_arrays(i).distance(); + query_result.id = topk_query_result_list.topk_query_result(i).query_result_arrays(j).id(); + query_result.distance = topk_query_result_list.topk_query_result(i).query_result_arrays(j).distance(); result.query_result_arrays.emplace_back(query_result); } diff --git a/cpp/src/sdk/grpc/GrpcClient.cpp b/cpp/src/sdk/grpc/GrpcClient.cpp index 49ce3556..4e028331 100644 --- a/cpp/src/sdk/grpc/GrpcClient.cpp +++ b/cpp/src/sdk/grpc/GrpcClient.cpp @@ -121,28 +121,21 @@ GrpcClient::Insert(::milvus::grpc::VectorIds& vector_ids, } Status -GrpcClient::Search(std::vector<::milvus::grpc::TopKQueryResult>& result_array, - const ::milvus::grpc::SearchParam& search_param) { +GrpcClient::Search(::milvus::grpc::TopKQueryResultList& topk_query_result_list, + const ::milvus::grpc::SearchParam &search_param) { ::milvus::grpc::TopKQueryResult query_result; ClientContext context; - std::unique_ptr > reader( - stub_->Search(&context, search_param)); - - while (reader->Read(&query_result)) { - result_array.emplace_back(query_result); - } - - ::grpc::Status grpc_status = reader->Finish(); + ::grpc::Status grpc_status = stub_->Search(&context, search_param, &topk_query_result_list); if (!grpc_status.ok()) { std::cerr << "SearchVector rpc failed!" << std::endl; std::cerr << grpc_status.error_message() << std::endl; return Status(StatusCode::RPCFailed, grpc_status.error_message()); } - if (query_result.status().error_code() != grpc::SUCCESS) { - std::cerr << query_result.status().reason() << std::endl; + if (topk_query_result_list.status().error_code() != grpc::SUCCESS) { + std::cerr << topk_query_result_list.status().reason() << std::endl; return Status(StatusCode::ServerFailed, - query_result.status().reason()); + topk_query_result_list.status().reason()); } return Status::OK(); diff --git a/cpp/src/sdk/grpc/GrpcClient.h b/cpp/src/sdk/grpc/GrpcClient.h index 512161a6..fb64fdb5 100644 --- a/cpp/src/sdk/grpc/GrpcClient.h +++ b/cpp/src/sdk/grpc/GrpcClient.h @@ -50,8 +50,8 @@ public: Status& status); Status - Search(std::vector& result_array, - const grpc::SearchParam& search_param); + Search(::milvus::grpc::TopKQueryResultList& topk_query_result_list, + const grpc::SearchParam &search_param); Status DescribeTable(grpc::TableSchema& grpc_schema, diff --git a/cpp/src/server/grpc_impl/GrpcMilvusServer.cpp b/cpp/src/server/grpc_impl/GrpcMilvusServer.cpp index 935f53b8..a6689700 100644 --- a/cpp/src/server/grpc_impl/GrpcMilvusServer.cpp +++ b/cpp/src/server/grpc_impl/GrpcMilvusServer.cpp @@ -52,32 +52,39 @@ GrpcMilvusServer::StartService() { StopService(); } - ServerConfig &config = ServerConfig::GetInstance(); - ConfigNode server_config = config.GetConfig(CONFIG_SERVER); - ConfigNode engine_config = config.GetConfig(CONFIG_ENGINE); - std::string address = server_config.GetValue(CONFIG_SERVER_ADDRESS, "127.0.0.1"); - int32_t port = server_config.GetInt32Value(CONFIG_SERVER_PORT, 19530); + try { + ServerConfig &config = ServerConfig::GetInstance(); + ConfigNode server_config = config.GetConfig(CONFIG_SERVER); + ConfigNode engine_config = config.GetConfig(CONFIG_ENGINE); + std::string address = server_config.GetValue(CONFIG_SERVER_ADDRESS, "127.0.0.1"); + int32_t port = server_config.GetInt32Value(CONFIG_SERVER_PORT, 19530); - faiss::distance_compute_blas_threshold = engine_config.GetInt32Value(CONFIG_DCBT, 20); + faiss::distance_compute_blas_threshold = engine_config.GetInt32Value(CONFIG_DCBT, 20); - std::string server_address(address + ":" + std::to_string(port)); + std::string server_address(address + ":" + std::to_string(port)); - ::grpc::ServerBuilder builder; - builder.SetOption(std::unique_ptr<::grpc::ServerBuilderOption>(new NoReusePortOption)); - builder.SetMaxReceiveMessageSize(MESSAGE_SIZE); //default 4 * 1024 * 1024 - builder.SetMaxSendMessageSize(MESSAGE_SIZE); + ::grpc::ServerBuilder builder; + builder.SetOption(std::unique_ptr<::grpc::ServerBuilderOption>(new NoReusePortOption)); + builder.SetMaxReceiveMessageSize(MESSAGE_SIZE); //default 4 * 1024 * 1024 + builder.SetMaxSendMessageSize(MESSAGE_SIZE); - builder.SetCompressionAlgorithmSupportStatus(GRPC_COMPRESS_STREAM_GZIP, true); - builder.SetDefaultCompressionAlgorithm(GRPC_COMPRESS_STREAM_GZIP); - builder.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_HIGH); + builder.SetCompressionAlgorithmSupportStatus(GRPC_COMPRESS_STREAM_GZIP, true); + builder.SetDefaultCompressionAlgorithm(GRPC_COMPRESS_STREAM_GZIP); + builder.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_HIGH); - GrpcRequestHandler service; + GrpcRequestHandler service; - builder.AddListeningPort(server_address, ::grpc::InsecureServerCredentials()); - builder.RegisterService(&service); + builder.AddListeningPort(server_address, ::grpc::InsecureServerCredentials()); + builder.RegisterService(&service); + + server = builder.BuildAndStart(); + server->Wait(); + + } catch (std::exception &ex) { + SERVER_LOG_ERROR << "Milvus server encounter exception: " << std::string(ex.what()) + << "Is another server instance running?"; + } - server = builder.BuildAndStart(); - server->Wait(); } void diff --git a/cpp/src/server/grpc_impl/GrpcRequestHandler.cpp b/cpp/src/server/grpc_impl/GrpcRequestHandler.cpp index 0ae711c3..70e294f2 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestHandler.cpp +++ b/cpp/src/server/grpc_impl/GrpcRequestHandler.cpp @@ -72,11 +72,11 @@ GrpcRequestHandler::Insert(::grpc::ServerContext *context, ::grpc::Status GrpcRequestHandler::Search(::grpc::ServerContext *context, - const ::milvus::grpc::SearchParam *request, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) { + const ::milvus::grpc::SearchParam *request, + ::milvus::grpc::TopKQueryResultList *response) { std::vector file_id_array; - BaseTaskPtr task_ptr = SearchTask::Create(request, file_id_array, writer); + BaseTaskPtr task_ptr = SearchTask::Create(request, file_id_array, response); ::milvus::grpc::Status grpc_status; GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status); if (grpc_status.error_code() != SERVER_SUCCESS) { @@ -89,15 +89,15 @@ GrpcRequestHandler::Search(::grpc::ServerContext *context, ::grpc::Status GrpcRequestHandler::SearchInFiles(::grpc::ServerContext *context, - const ::milvus::grpc::SearchInFilesParam *request, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) { + const ::milvus::grpc::SearchInFilesParam *request, + ::milvus::grpc::TopKQueryResultList *response) { std::vector file_id_array; - for(int i = 0; i < request->file_id_array_size(); i++) { + for (int i = 0; i < request->file_id_array_size(); i++) { file_id_array.push_back(request->file_id_array(i)); } ::milvus::grpc::SearchInFilesParam *request_mutable = const_cast<::milvus::grpc::SearchInFilesParam *>(request); - BaseTaskPtr task_ptr = SearchTask::Create(request_mutable->mutable_search_param(), file_id_array, writer); + BaseTaskPtr task_ptr = SearchTask::Create(request_mutable->mutable_search_param(), file_id_array, response); ::milvus::grpc::Status grpc_status; GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status); if (grpc_status.error_code() != SERVER_SUCCESS) { diff --git a/cpp/src/server/grpc_impl/GrpcRequestHandler.h b/cpp/src/server/grpc_impl/GrpcRequestHandler.h index 52f28981..40537c5e 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestHandler.h +++ b/cpp/src/server/grpc_impl/GrpcRequestHandler.h @@ -136,8 +136,8 @@ public: */ ::grpc::Status Search(::grpc::ServerContext *context, - const ::milvus::grpc::SearchParam *request, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) override; + const ::milvus::grpc::SearchParam *request, + ::milvus::grpc::TopKQueryResultList *response) override; /** * @brief Internal use query interface @@ -161,8 +161,8 @@ public: */ ::grpc::Status SearchInFiles(::grpc::ServerContext *context, - const ::milvus::grpc::SearchInFilesParam *request, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) override; + const ::milvus::grpc::SearchInFilesParam *request, + ::milvus::grpc::TopKQueryResultList *response) override; /** * @brief Get table schema diff --git a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp index 1b9bc935..b6f88d15 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp +++ b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp @@ -547,25 +547,25 @@ InsertTask::OnExecute() { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SearchTask::SearchTask(const ::milvus::grpc::SearchParam *search_vector_infos, - const std::vector &file_id_array, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) - : GrpcBaseTask(DQL_TASK_GROUP), - search_param_(search_vector_infos), - file_id_array_(file_id_array), - writer_(writer) { + const std::vector &file_id_array, + ::milvus::grpc::TopKQueryResultList *response) + : GrpcBaseTask(DQL_TASK_GROUP), + search_param_(search_vector_infos), + file_id_array_(file_id_array), + topk_result_list(response) { } BaseTaskPtr SearchTask::Create(const ::milvus::grpc::SearchParam *search_vector_infos, const std::vector &file_id_array, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) { + ::milvus::grpc::TopKQueryResultList *response) { if(search_vector_infos == nullptr) { SERVER_LOG_ERROR << "grpc input is null!"; return nullptr; } return std::shared_ptr(new SearchTask(search_vector_infos, file_id_array, - writer)); + response)); } ServerError @@ -683,18 +683,13 @@ SearchTask::OnExecute() { rc.ElapseFromBegin("do search"); //step 7: construct result array - for (uint64_t i = 0; i < record_count; i++) { - auto &result = results[i]; - const auto &record = search_param_->query_record_array(i); - ::milvus::grpc::TopKQueryResult grpc_topk_result; + for (auto &result : results) { + ::milvus::grpc::TopKQueryResult *topk_query_result = topk_result_list->add_topk_query_result(); for (auto &pair : result) { - ::milvus::grpc::QueryResult *grpc_result = grpc_topk_result.add_query_result_arrays(); + ::milvus::grpc::QueryResult *grpc_result = topk_query_result->add_query_result_arrays(); grpc_result->set_id(pair.first); grpc_result->set_distance(pair.second); } - if (!writer_->Write(grpc_topk_result)) { - return SetError(SERVER_WRITE_ERROR, "Write topk result failed!"); - } } #ifdef MILVUS_ENABLE_PROFILING diff --git a/cpp/src/server/grpc_impl/GrpcRequestTask.h b/cpp/src/server/grpc_impl/GrpcRequestTask.h index 91d7bbfe..c91847a4 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestTask.h +++ b/cpp/src/server/grpc_impl/GrpcRequestTask.h @@ -150,12 +150,12 @@ public: static BaseTaskPtr Create(const ::milvus::grpc::SearchParam *search_param, const std::vector &file_id_array, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer); + ::milvus::grpc::TopKQueryResultList *response); protected: SearchTask(const ::milvus::grpc::SearchParam *search_param, - const std::vector &file_id_array, - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer); + const std::vector &file_id_array, + ::milvus::grpc::TopKQueryResultList *response); ServerError OnExecute() override; @@ -163,7 +163,7 @@ protected: private: const ::milvus::grpc::SearchParam *search_param_; std::vector file_id_array_; - ::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer_; + ::milvus::grpc::TopKQueryResultList *topk_result_list; }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- GitLab