From 86ca848f2d8f68e0a31e729d3f6f620a9af8f2ee Mon Sep 17 00:00:00 2001 From: starlord Date: Sat, 24 Aug 2019 12:20:32 +0800 Subject: [PATCH] MS-413 Remove thrift dependency Former-commit-id: 00ef82d80e81b0076299436ec109025e6551e215 --- cpp/CHANGELOG.md | 1 + cpp/CMakeLists.txt | 4 - cpp/cmake/DefineOptions.cmake | 2 - cpp/cmake/ThirdPartyPackages.cmake | 148 +- cpp/conf/server_config.template | 1 - cpp/src/CMakeLists.txt | 98 +- cpp/src/grpc/milvus.proto | 2 +- cpp/src/sdk/CMakeLists.txt | 48 +- cpp/src/sdk/examples/CMakeLists.txt | 6 +- .../sdk/examples/thriftsimple/CMakeLists.txt | 24 - cpp/src/sdk/examples/thriftsimple/main.cpp | 68 - .../examples/thriftsimple/src/ClientTest.cpp | 288 - .../examples/thriftsimple/src/ClientTest.h | 13 - cpp/src/sdk/interface/ConnectionImpl.h | 4 - cpp/src/sdk/thrift/ClientProxy.cpp | 346 -- cpp/src/sdk/thrift/ClientProxy.h | 72 - cpp/src/sdk/thrift/ThriftClient.cpp | 102 - cpp/src/sdk/thrift/ThriftClient.h | 42 - cpp/src/server/Server.cpp | 14 - cpp/src/server/thrift_impl/MilvusServer.cpp | 106 - cpp/src/server/thrift_impl/MilvusServer.h | 23 - cpp/src/server/thrift_impl/RequestHandler.cpp | 124 - cpp/src/server/thrift_impl/RequestHandler.h | 206 - .../server/thrift_impl/RequestScheduler.cpp | 218 - cpp/src/server/thrift_impl/RequestScheduler.h | 88 - cpp/src/server/thrift_impl/RequestTask.cpp | 779 --- cpp/src/server/thrift_impl/RequestTask.h | 232 - .../server/thrift_impl/ThreadPoolServer.cpp | 36 - cpp/src/server/thrift_impl/ThreadPoolServer.h | 33 - cpp/src/thrift/cpp_gen.sh | 4 - cpp/src/thrift/gen-cpp/MilvusService.cpp | 5457 ----------------- cpp/src/thrift/gen-cpp/MilvusService.h | 1972 ------ .../gen-cpp/MilvusService_server.skeleton.cpp | 241 - cpp/src/thrift/gen-cpp/milvus_constants.cpp | 17 - cpp/src/thrift/gen-cpp/milvus_constants.h | 24 - cpp/src/thrift/gen-cpp/milvus_types.cpp | 899 --- cpp/src/thrift/gen-cpp/milvus_types.h | 394 -- cpp/src/thrift/milvus.thrift | 246 - cpp/thirdparty/versions.txt | 1 - 39 files changed, 48 insertions(+), 12335 deletions(-) delete mode 100644 cpp/src/sdk/examples/thriftsimple/CMakeLists.txt delete mode 100644 cpp/src/sdk/examples/thriftsimple/main.cpp delete mode 100644 cpp/src/sdk/examples/thriftsimple/src/ClientTest.cpp delete mode 100644 cpp/src/sdk/examples/thriftsimple/src/ClientTest.h delete mode 100644 cpp/src/sdk/thrift/ClientProxy.cpp delete mode 100644 cpp/src/sdk/thrift/ClientProxy.h delete mode 100644 cpp/src/sdk/thrift/ThriftClient.cpp delete mode 100644 cpp/src/sdk/thrift/ThriftClient.h delete mode 100644 cpp/src/server/thrift_impl/MilvusServer.cpp delete mode 100644 cpp/src/server/thrift_impl/MilvusServer.h delete mode 100644 cpp/src/server/thrift_impl/RequestHandler.cpp delete mode 100644 cpp/src/server/thrift_impl/RequestHandler.h delete mode 100644 cpp/src/server/thrift_impl/RequestScheduler.cpp delete mode 100644 cpp/src/server/thrift_impl/RequestScheduler.h delete mode 100644 cpp/src/server/thrift_impl/RequestTask.cpp delete mode 100644 cpp/src/server/thrift_impl/RequestTask.h delete mode 100644 cpp/src/server/thrift_impl/ThreadPoolServer.cpp delete mode 100644 cpp/src/server/thrift_impl/ThreadPoolServer.h delete mode 100755 cpp/src/thrift/cpp_gen.sh delete mode 100644 cpp/src/thrift/gen-cpp/MilvusService.cpp delete mode 100644 cpp/src/thrift/gen-cpp/MilvusService.h delete mode 100644 cpp/src/thrift/gen-cpp/MilvusService_server.skeleton.cpp delete mode 100644 cpp/src/thrift/gen-cpp/milvus_constants.cpp delete mode 100644 cpp/src/thrift/gen-cpp/milvus_constants.h delete mode 100644 cpp/src/thrift/gen-cpp/milvus_types.cpp delete mode 100644 cpp/src/thrift/gen-cpp/milvus_types.h delete mode 100644 cpp/src/thrift/milvus.thrift diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index c66b1df7fe..ff81e2acf2 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -47,6 +47,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-407 - Reconstruct MetricsCollector - MS-408 - Add device_id in resource construct function - MS-409 - Using new scheduler +- MS-413 - Remove thrift dependency ## New Feature - MS-343 - Implement ResourceMgr diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index c6320522ec..21ddb1c5f4 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -71,10 +71,6 @@ set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -O0 -g") message("CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}") message("CUDA_NVCC_FLAGS=${CUDA_NVCC_FLAGS}") -set(MILVUS_WITH_THRIFT "OFF") -set(GPU_VERSION "ON") -add_definitions("-DGPU_VERSION") - set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED on) diff --git a/cpp/cmake/DefineOptions.cmake b/cpp/cmake/DefineOptions.cmake index d0624bd0fd..2bf52f6a8e 100644 --- a/cpp/cmake/DefineOptions.cmake +++ b/cpp/cmake/DefineOptions.cmake @@ -90,8 +90,6 @@ define_option(MILVUS_WITH_SQLITE_ORM "Build with SQLite ORM library" ON) define_option(MILVUS_WITH_MYSQLPP "Build with MySQL++" ON) -define_option(MILVUS_WITH_THRIFT "Build with Apache Thrift library" OFF) - define_option(MILVUS_WITH_YAMLCPP "Build with yaml-cpp library" ON) define_option(MILVUS_WITH_ZLIB "Build with zlib compression" ON) diff --git a/cpp/cmake/ThirdPartyPackages.cmake b/cpp/cmake/ThirdPartyPackages.cmake index f9140b6d80..53d65bd906 100644 --- a/cpp/cmake/ThirdPartyPackages.cmake +++ b/cpp/cmake/ThirdPartyPackages.cmake @@ -84,8 +84,6 @@ macro(build_dependency DEPENDENCY_NAME) build_sqlite() elseif ("${DEPENDENCY_NAME}" STREQUAL "SQLite_ORM") build_sqlite_orm() - elseif("${DEPENDENCY_NAME}" STREQUAL "Thrift") - build_thrift() elseif("${DEPENDENCY_NAME}" STREQUAL "yaml-cpp") build_yamlcpp() elseif("${DEPENDENCY_NAME}" STREQUAL "ZLIB") @@ -403,14 +401,6 @@ else() endif() set(SQLITE_ORM_MD5 "ba9a405a8a1421c093aa8ce988ff8598") -if(DEFINED ENV{MILVUS_THRIFT_URL}) - set(THRIFT_SOURCE_URL "$ENV{MILVUS_THRIFT_URL}") -else() - set(THRIFT_SOURCE_URL - "https://github.com/apache/thrift/archive/${THRIFT_VERSION}.tar.gz") -endif() -set(THRIFT_MD5 "ff9af01fec424b5a279fa8a3c9e95c0c") - if(DEFINED ENV{MILVUS_YAMLCPP_URL}) set(YAMLCPP_SOURCE_URL "$ENV{MILVUS_YAMLCPP_URL}") else() @@ -1943,127 +1933,6 @@ if(MILVUS_WITH_SQLITE_ORM) include_directories(SYSTEM "${SQLITE_ORM_INCLUDE_DIR}") endif() -# ---------------------------------------------------------------------- -# Thrift - -macro(build_thrift) - message(STATUS "Building Apache Thrift-${THRIFT_VERSION} from source") - set(THRIFT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/thrift_ep-prefix/src/thrift_ep") - set(THRIFT_INCLUDE_DIR "${THRIFT_PREFIX}/include") - set(THRIFT_COMPILER "${THRIFT_PREFIX}/bin/thrift") - set(THRIFT_CMAKE_ARGS - ${EP_COMMON_CMAKE_ARGS} - "-DCMAKE_INSTALL_PREFIX=${THRIFT_PREFIX}" - "-DCMAKE_INSTALL_RPATH=${THRIFT_PREFIX}/lib" - -DBOOST_ROOT=${BOOST_PREFIX} - -DWITH_CPP=ON - -DWITH_STATIC_LIB=ON - -DBUILD_SHARED_LIBS=OFF - -DBUILD_TESTING=OFF - -DBUILD_EXAMPLES=OFF - -DBUILD_TUTORIALS=OFF - -DWITH_QT4=OFF - -DWITH_QT5=OFF - -DWITH_C_GLIB=OFF - -DWITH_JAVA=OFF - -DWITH_PYTHON=OFF - -DWITH_HASKELL=OFF - -DWITH_LIBEVENT=OFF - -DCMAKE_BUILD_TYPE=Release) - - # Thrift also uses boost. Forward important boost settings if there were ones passed. - if(DEFINED BOOST_ROOT) - set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DBOOST_ROOT=${BOOST_ROOT}") - endif() - if(DEFINED Boost_NAMESPACE) - set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DBoost_NAMESPACE=${Boost_NAMESPACE}") - endif() - - set(THRIFT_STATIC_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}thrift") - - set(THRIFT_STATIC_LIB - "${THRIFT_PREFIX}/lib/${THRIFT_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") - - if(ZLIB_SHARED_LIB) - set(THRIFT_CMAKE_ARGS "-DZLIB_LIBRARY=${ZLIB_SHARED_LIB}" ${THRIFT_CMAKE_ARGS}) - else() - set(THRIFT_CMAKE_ARGS "-DZLIB_LIBRARY=${ZLIB_STATIC_LIB}" ${THRIFT_CMAKE_ARGS}) - endif() - set(THRIFT_DEPENDENCIES ${THRIFT_DEPENDENCIES} ${ZLIB_LIBRARY}) - - if(USE_JFROG_CACHE STREQUAL "ON") - string(MD5 THRIFT_COMBINE_MD5 "${THRIFT_MD5}${ZLIB_MD5}") - set(THRIFT_CACHE_PACKAGE_NAME "thrift_${THRIFT_COMBINE_MD5}.tar.gz") - set(THRIFT_CACHE_URL "${JFROG_ARTFACTORY_CACHE_URL}/${THRIFT_CACHE_PACKAGE_NAME}") - set(THRIFT_CACHE_PACKAGE_PATH "${THIRDPARTY_PACKAGE_CACHE}/${THRIFT_CACHE_PACKAGE_NAME}") - - execute_process(COMMAND wget -q --method HEAD ${THRIFT_CACHE_URL} RESULT_VARIABLE return_code) - message(STATUS "Check the remote file ${THRIFT_CACHE_URL}. return code = ${return_code}") - if (NOT return_code EQUAL 0) - externalproject_add(thrift_ep - URL - ${THRIFT_SOURCE_URL} - BUILD_BYPRODUCTS - "${THRIFT_STATIC_LIB}" - "${THRIFT_COMPILER}" - BUILD_COMMAND - ${MAKE} - ${MAKE_BUILD_ARGS} - CMAKE_ARGS - ${THRIFT_CMAKE_ARGS} - INSTALL_COMMAND - ${MAKE} install - DEPENDS - ${THRIFT_DEPENDENCIES} - ${EP_LOG_OPTIONS}) - - ExternalProject_Create_Cache(thrift_ep ${THRIFT_CACHE_PACKAGE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/thrift_ep-prefix" ${JFROG_USER_NAME} ${JFROG_PASSWORD} ${THRIFT_CACHE_URL}) - else() - file(DOWNLOAD ${THRIFT_CACHE_URL} ${THRIFT_CACHE_PACKAGE_PATH} STATUS status) - list(GET status 0 status_code) - message(STATUS "DOWNLOADING FROM ${THRIFT_CACHE_URL} TO ${THRIFT_CACHE_PACKAGE_PATH}. STATUS = ${status_code}") - if (status_code EQUAL 0) - ExternalProject_Use_Cache(thrift_ep ${THRIFT_CACHE_PACKAGE_PATH} ${CMAKE_CURRENT_BINARY_DIR}) - endif() - endif() - else() - externalproject_add(thrift_ep - URL - ${THRIFT_SOURCE_URL} - BUILD_BYPRODUCTS - "${THRIFT_STATIC_LIB}" - "${THRIFT_COMPILER}" - BUILD_COMMAND - ${MAKE} - ${MAKE_BUILD_ARGS} - CMAKE_ARGS - ${THRIFT_CMAKE_ARGS} - INSTALL_COMMAND - ${MAKE} install - DEPENDS - ${THRIFT_DEPENDENCIES} - ${EP_LOG_OPTIONS}) - endif() - - # The include directory must exist before it is referenced by a target. - file(MAKE_DIRECTORY "${THRIFT_INCLUDE_DIR}") - add_library(thrift STATIC IMPORTED) - set_target_properties(thrift - PROPERTIES IMPORTED_LOCATION "${THRIFT_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}") - add_dependencies(thrift thrift_ep) -endmacro() - -if(MILVUS_WITH_THRIFT) - resolve_dependency(Thrift) - - link_directories(SYSTEM ${THRIFT_PREFIX}/lib/) - link_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/thrift_ep-prefix/src/thrift_ep-build/lib) - include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) - include_directories(SYSTEM ${THRIFT_PREFIX}/lib/cpp/src) - include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/thrift_ep-prefix/src/thrift_ep-build) -endif() - # ---------------------------------------------------------------------- # yaml-cpp @@ -2683,15 +2552,12 @@ macro(build_grpc) add_dependencies(grpc_protoc grpc_ep) endmacro() -if(NOT MILVUS_WITH_THRIFT STREQUAL "ON") - resolve_dependency(GRPC) +resolve_dependency(GRPC) - get_target_property(GRPC_INCLUDE_DIR grpc INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) - link_directories(SYSTEM ${GRPC_PREFIX}/lib) +get_target_property(GRPC_INCLUDE_DIR grpc INTERFACE_INCLUDE_DIRECTORIES) +include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) +link_directories(SYSTEM ${GRPC_PREFIX}/lib) - set(GRPC_THIRD_PARTY_DIR ${CMAKE_CURRENT_BINARY_DIR}/grpc_ep-prefix/src/grpc_ep/third_party) - include_directories(SYSTEM ${GRPC_THIRD_PARTY_DIR}/protobuf/src) - link_directories(SYSTEM ${GRPC_PROTOBUF_LIB_DIR}) - -endif() +set(GRPC_THIRD_PARTY_DIR ${CMAKE_CURRENT_BINARY_DIR}/grpc_ep-prefix/src/grpc_ep/third_party) +include_directories(SYSTEM ${GRPC_THIRD_PARTY_DIR}/protobuf/src) +link_directories(SYSTEM ${GRPC_PROTOBUF_LIB_DIR}) diff --git a/cpp/conf/server_config.template b/cpp/conf/server_config.template index 2792fbf5da..a4212e795e 100644 --- a/cpp/conf/server_config.template +++ b/cpp/conf/server_config.template @@ -37,7 +37,6 @@ cache_config: engine_config: use_blas_threshold: 20 - metric_type: L2 # compare vectors by euclidean distance(L2) or inner product(IP), optional: L2 or IP omp_thread_num: 0 # how many compute threads be used by engine, 0 means use all cpu core to compute resource_config: diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 9b7e28af5f..7af3c54787 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -8,7 +8,6 @@ aux_source_directory(cache cache_files) aux_source_directory(config config_files) aux_source_directory(server server_files) aux_source_directory(server/grpc_impl grpcserver_files) -aux_source_directory(server/thrift_impl thriftserver_files) aux_source_directory(utils utils_files) aux_source_directory(db db_main_files) aux_source_directory(db/engine db_engine_files) @@ -48,17 +47,6 @@ set(license_generator_files license/LicenseLibrary.cpp ) -if (MILVUS_WITH_THRIFT STREQUAL "ON") -set(thrift_service_files - thrift/gen-cpp/MilvusService.cpp - thrift/gen-cpp/milvus_constants.cpp - thrift/gen-cpp/milvus_types.cpp - metrics/SystemInfo.cpp - metrics/SystemInfo.h - server/thrift_impl/ThreadPoolServer.cpp - server/thrift_impl/ThreadPoolServer.h - ) -else() set(grpc_service_files metrics/SystemInfo.cpp metrics/SystemInfo.h @@ -67,7 +55,6 @@ set(grpc_service_files grpc/gen-status/status.grpc.pb.cc grpc/gen-status/status.pb.cc ) -endif() set(db_files ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp @@ -87,25 +74,16 @@ set(s3_client_files include_directories(/usr/include) include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include") -include_directories(thrift/gen-cpp) include_directories(/usr/include/mysql) include_directories(grpc/gen-status) include_directories(grpc/gen-milvus) -if (MILVUS_WITH_THRIFT STREQUAL "ON") - message("Build thrift server") - add_definitions("-DMILVUS_ENABLE_THRIFT") - set(client_thrift_lib - thrift) -else() - message("Build grpc server") - set(client_grpc_lib - grpcpp_channelz - grpc++ - grpc - grpc_protobuf - grpc_protoc) -endif() +set(client_grpc_lib + grpcpp_channelz + grpc++ + grpc + grpc_protobuf + grpc_protoc) set(third_party_libs knowhere @@ -117,7 +95,6 @@ set(third_party_libs lapack easyloggingpp sqlite - ${client_thrift_lib} ${client_grpc_lib} yaml-cpp prometheus-cpp-push @@ -138,9 +115,6 @@ set(third_party_libs cudart ) -if (MEGASEARCH_WITH_ARROW STREQUAL "ON") - set(third_party_libs ${third_party_libs} arrow) -endif() if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON") set(third_party_libs ${third_party_libs} ${MKL_LIBS}) @@ -156,23 +130,14 @@ if (MILVUS_ENABLE_PROFILING STREQUAL "ON") libunwind) endif() -if (GPU_VERSION STREQUAL "ON") - link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64") - set(engine_libs - pthread - libgomp.a - libgfortran.a - ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so - ) -else() - set(engine_libs - pthread - libgomp.a - libgfortran.a - ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so - ) -endif () +link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64") +set(engine_libs + pthread + libgomp.a + libgfortran.a + ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so + ) if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") set(engine_libs @@ -215,34 +180,17 @@ set(knowhere_libs tbb ) -if (MILVUS_WITH_THRIFT STREQUAL "ON") - add_executable(milvus_server - ${config_files} - ${server_files} - ${thriftserver_files} - ${utils_files} - ${thrift_service_files} - ${metrics_files} - ${scheduler_srcs} - ) -else() - add_executable(milvus_server - ${config_files} - ${server_files} - ${grpcserver_files} - ${utils_files} - ${grpc_service_files} - ${metrics_files} - ${scheduler_srcs} - ) -endif() - -if(MILVUS_WITH_THRIFT STREQUAL "ON") - target_link_libraries(milvus_server ${server_libs} ${knowhere_libs} ${third_party_libs}) -else() - target_link_libraries(milvus_server ${server_libs} ${knowhere_libs} ${third_party_libs}) -endif() +add_executable(milvus_server + ${config_files} + ${server_files} + ${grpcserver_files} + ${utils_files} + ${grpc_service_files} + ${metrics_files} + ${scheduler_srcs} + ) +target_link_libraries(milvus_server ${server_libs} ${knowhere_libs} ${third_party_libs}) install(TARGETS milvus_server DESTINATION bin) diff --git a/cpp/src/grpc/milvus.proto b/cpp/src/grpc/milvus.proto index f8058c1fe4..c20eab6e56 100644 --- a/cpp/src/grpc/milvus.proto +++ b/cpp/src/grpc/milvus.proto @@ -32,7 +32,7 @@ message Range { * @brief Record inserted */ message RowRecord { - repeated float vector_data = 1; //binary in thrift + repeated float vector_data = 1; //binary vector data } /** diff --git a/cpp/src/sdk/CMakeLists.txt b/cpp/src/sdk/CMakeLists.txt index 8dde7f9f9e..150a1fdf16 100644 --- a/cpp/src/sdk/CMakeLists.txt +++ b/cpp/src/sdk/CMakeLists.txt @@ -12,43 +12,25 @@ include_directories(/usr/include) include_directories(include) include_directories(/usr/local/include) -if (MILVUS_WITH_THRIFT STREQUAL "ON") - aux_source_directory(thrift thrift_client_files) - include_directories(thrift) - include_directories(${CMAKE_SOURCE_DIR}/src/thrift/gen-cpp) - set(thrift_service_files - ${CMAKE_SOURCE_DIR}/src/thrift/gen-cpp/MilvusService.cpp - ${CMAKE_SOURCE_DIR}/src/thrift/gen-cpp/milvus_constants.cpp - ${CMAKE_SOURCE_DIR}/src/thrift/gen-cpp/milvus_types.cpp - ) +aux_source_directory(grpc grpc_client_files) - add_library(milvus_sdk STATIC - ${interface_files} - ${thrift_client_files} - ${util_files} - ${thrift_service_files} - ) -else() - aux_source_directory(grpc grpc_client_files) +include_directories(${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus) +include_directories(${CMAKE_SOURCE_DIR}/src/grpc/gen-status) - include_directories(${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus) - include_directories(${CMAKE_SOURCE_DIR}/src/grpc/gen-status) +set(grpc_service_files + ${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus/milvus.grpc.pb.cc + ${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus/milvus.pb.cc + ${CMAKE_SOURCE_DIR}/src/grpc/gen-status/status.grpc.pb.cc + ${CMAKE_SOURCE_DIR}/src/grpc/gen-status/status.pb.cc + ) - set(grpc_service_files - ${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus/milvus.grpc.pb.cc - ${CMAKE_SOURCE_DIR}/src/grpc/gen-milvus/milvus.pb.cc - ${CMAKE_SOURCE_DIR}/src/grpc/gen-status/status.grpc.pb.cc - ${CMAKE_SOURCE_DIR}/src/grpc/gen-status/status.pb.cc - ) - - add_library(milvus_sdk STATIC - ${interface_files} - ${grpc_client_files} - ${util_files} - ${grpc_service_files} - ) -endif() +add_library(milvus_sdk STATIC + ${interface_files} + ${grpc_client_files} + ${util_files} + ${grpc_service_files} + ) target_link_libraries(milvus_sdk ${third_party_libs} diff --git a/cpp/src/sdk/examples/CMakeLists.txt b/cpp/src/sdk/examples/CMakeLists.txt index ceeb88c0e0..9e0437f157 100644 --- a/cpp/src/sdk/examples/CMakeLists.txt +++ b/cpp/src/sdk/examples/CMakeLists.txt @@ -4,8 +4,4 @@ # Proprietary and confidential. #------------------------------------------------------------------------------- -if (MILVUS_WITH_THRIFT STREQUAL "ON") - add_subdirectory(thriftsimple) -else() - add_subdirectory(grpcsimple) -endif() \ No newline at end of file +add_subdirectory(grpcsimple) diff --git a/cpp/src/sdk/examples/thriftsimple/CMakeLists.txt b/cpp/src/sdk/examples/thriftsimple/CMakeLists.txt deleted file mode 100644 index a288965aa3..0000000000 --- a/cpp/src/sdk/examples/thriftsimple/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved -# Unauthorized copying of this file, via any medium is strictly prohibited. -# Proprietary and confidential. -#------------------------------------------------------------------------------- - -aux_source_directory(src src_files) - -include_directories(src) -include_directories(../../include) - -link_directories(${CMAKE_BINARY_DIR}) - -add_executable(sdk_simple - ./main.cpp - ${src_files} - ) - -target_link_libraries(sdk_simple - milvus_sdk - pthread - ) - -install(TARGETS sdk_simple DESTINATION bin) diff --git a/cpp/src/sdk/examples/thriftsimple/main.cpp b/cpp/src/sdk/examples/thriftsimple/main.cpp deleted file mode 100644 index 499b8a9935..0000000000 --- a/cpp/src/sdk/examples/thriftsimple/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved -// Unauthorized copying of this file, via any medium is strictly prohibited. -// Proprietary and confidential. -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include - -#include "src/ClientTest.h" - -void print_help(const std::string &app_name); - - -int -main(int argc, char *argv[]) { - printf("Client start...\n"); - - std::string app_name = basename(argv[0]); - static struct option long_options[] = {{"server", optional_argument, 0, 's'}, - {"port", optional_argument, 0, 'p'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0}}; - - int option_index = 0; - std::string address = "127.0.0.1", port = "19530"; - app_name = argv[0]; - - int value; - while ((value = getopt_long(argc, argv, "s:p:h", long_options, &option_index)) != -1) { - switch (value) { - case 's': { - char *address_ptr = strdup(optarg); - address = address_ptr; - free(address_ptr); - break; - } - case 'p': { - char *port_ptr = strdup(optarg); - port = port_ptr; - free(port_ptr); - break; - } - case 'h': - default: - print_help(app_name); - return EXIT_SUCCESS; - } - } - - ClientTest test; - test.Test(address, port); - - printf("Client stop...\n"); - return 0; -} - -void -print_help(const std::string &app_name) { - printf("\n Usage: %s [OPTIONS]\n\n", app_name.c_str()); - printf(" Options:\n"); - printf(" -s --server Server address, default 127.0.0.1\n"); - printf(" -p --port Server port, default 19530\n"); - printf(" -h --help Print help information\n"); - printf("\n"); -} \ No newline at end of file diff --git a/cpp/src/sdk/examples/thriftsimple/src/ClientTest.cpp b/cpp/src/sdk/examples/thriftsimple/src/ClientTest.cpp deleted file mode 100644 index 38420c64e0..0000000000 --- a/cpp/src/sdk/examples/thriftsimple/src/ClientTest.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "ClientTest.h" -#include "MilvusApi.h" - -#include -#include -#include -#include - -using namespace ::milvus; - -namespace { - std::string GetTableName(); - - static const std::string TABLE_NAME = GetTableName(); - constexpr int64_t TABLE_DIMENSION = 512; - constexpr int64_t BATCH_ROW_COUNT = 100000; - constexpr int64_t NQ = 10; - constexpr int64_t TOP_K = 10; - constexpr int64_t SEARCH_TARGET = 5000; //change this value, result is different - constexpr int64_t ADD_VECTOR_LOOP = 5; - constexpr int64_t SECONDS_EACH_HOUR = 3600; - -#define BLOCK_SPLITER std::cout << "===========================================" << std::endl; - - void PrintTableSchema(const TableSchema& tb_schema) { - BLOCK_SPLITER - std::cout << "Table name: " << tb_schema.table_name << std::endl; - std::cout << "Table index type: " << (int)tb_schema.index_type << std::endl; - std::cout << "Table dimension: " << tb_schema.dimension << std::endl; - std::cout << "Table store raw data: " << (tb_schema.store_raw_vector ? "true" : "false") << std::endl; - BLOCK_SPLITER - } - - void PrintSearchResult(const std::vector>& search_record_array, - const std::vector& topk_query_result_array) { - BLOCK_SPLITER - std::cout << "Returned result count: " << topk_query_result_array.size() << std::endl; - - int32_t index = 0; - for(auto& result : topk_query_result_array) { - auto search_id = search_record_array[index].first; - index++; - std::cout << "No." << std::to_string(index) << " vector " << std::to_string(search_id) - << " top " << std::to_string(result.query_result_arrays.size()) - << " search result:" << std::endl; - for(auto& item : result.query_result_arrays) { - std::cout << "\t" << std::to_string(item.id) << "\tdistance:" << std::to_string(item.distance); - std::cout << std::endl; - } - } - - BLOCK_SPLITER - } - - std::string CurrentTime() { - time_t tt; - time( &tt ); - tt = tt + 8*SECONDS_EACH_HOUR; - tm* t= gmtime( &tt ); - - std::string str = std::to_string(t->tm_year + 1900) + "_" + std::to_string(t->tm_mon + 1) - + "_" + std::to_string(t->tm_mday) + "_" + std::to_string(t->tm_hour) - + "_" + std::to_string(t->tm_min) + "_" + std::to_string(t->tm_sec); - - return str; - } - - std::string CurrentTmDate(int64_t offset_day = 0) { - time_t tt; - time( &tt ); - tt = tt + 8*SECONDS_EACH_HOUR; - tt = tt + 24*SECONDS_EACH_HOUR*offset_day; - tm* t= gmtime( &tt ); - - std::string str = std::to_string(t->tm_year + 1900) + "-" + std::to_string(t->tm_mon + 1) - + "-" + std::to_string(t->tm_mday); - - return str; - } - - std::string GetTableName() { - static std::string s_id(CurrentTime()); - return "tbl_" + s_id; - } - - TableSchema BuildTableSchema() { - TableSchema tb_schema; - tb_schema.table_name = TABLE_NAME; - tb_schema.index_type = IndexType::gpu_ivfflat; - tb_schema.dimension = TABLE_DIMENSION; - tb_schema.store_raw_vector = true; - - return tb_schema; - } - - void BuildVectors(int64_t from, int64_t to, - std::vector& vector_record_array) { - if(to <= from){ - return; - } - - vector_record_array.clear(); - for (int64_t k = from; k < to; k++) { - RowRecord record; - record.data.resize(TABLE_DIMENSION); - for(int64_t i = 0; i < TABLE_DIMENSION; i++) { - record.data[i] = (float)(k%(i+1)); - } - - vector_record_array.emplace_back(record); - } - } - - void Sleep(int seconds) { - std::cout << "Waiting " << seconds << " seconds ..." << std::endl; - sleep(seconds); - } - - class TimeRecorder { - public: - TimeRecorder(const std::string& title) - : title_(title) { - start_ = std::chrono::system_clock::now(); - } - - ~TimeRecorder() { - std::chrono::system_clock::time_point end = std::chrono::system_clock::now(); - long span = (std::chrono::duration_cast (end - start_)).count(); - std::cout << title_ << " totally cost: " << span << " ms" << std::endl; - } - - private: - std::string title_; - std::chrono::system_clock::time_point start_; - }; - - void CheckResult(const std::vector>& search_record_array, - const std::vector& topk_query_result_array) { - BLOCK_SPLITER - int64_t index = 0; - for(auto& result : topk_query_result_array) { - auto result_id = result.query_result_arrays[0].id; - auto search_id = search_record_array[index++].first; - if(result_id != search_id) { - std::cout << "The top 1 result is wrong: " << result_id - << " vs. " << search_id << std::endl; - } else { - std::cout << "No." << index-1 << " Check result successfully" << std::endl; - } - } - BLOCK_SPLITER - } - - void DoSearch(std::shared_ptr conn, - const std::vector>& search_record_array, - const std::string& phase_name) { - std::vector query_range_array; - Range rg; - rg.start_value = CurrentTmDate(); - rg.end_value = CurrentTmDate(1); - query_range_array.emplace_back(rg); - - std::vector record_array; - for(auto& pair : search_record_array) { - record_array.push_back(pair.second); - } - - std::vector topk_query_result_array; - { - TimeRecorder rc(phase_name); - Status stat = conn->Search(TABLE_NAME, record_array, query_range_array, TOP_K, topk_query_result_array); - std::cout << "SearchVector function call status: " << stat.ToString() << std::endl; - } - - PrintSearchResult(search_record_array, topk_query_result_array); - CheckResult(search_record_array, topk_query_result_array); - } -} - -void -ClientTest::Test(const std::string& address, const std::string& port) { - std::shared_ptr conn = Connection::Create(); - - {//connect server - ConnectParam param = {address, port}; - Status stat = conn->Connect(param); - std::cout << "Connect function call status: " << stat.ToString() << std::endl; - } - - {//server version - std::string version = conn->ServerVersion(); - std::cout << "Server version: " << version << std::endl; - } - - {//sdk version - std::string version = conn->ClientVersion(); - std::cout << "SDK version: " << version << std::endl; - } - - { - std::vector tables; - Status stat = conn->ShowTables(tables); - std::cout << "ShowTables function call status: " << stat.ToString() << std::endl; - std::cout << "All tables: " << std::endl; - for(auto& table : tables) { - int64_t row_count = 0; - stat = conn->CountTable(table, row_count); - std::cout << "\t" << table << "(" << row_count << " rows)" << std::endl; - } - } - - {//create table - TableSchema tb_schema = BuildTableSchema(); - Status stat = conn->CreateTable(tb_schema); - std::cout << "CreateTable function call status: " << stat.ToString() << std::endl; - PrintTableSchema(tb_schema); - - bool has_table = conn->HasTable(tb_schema.table_name); - if(has_table) { - std::cout << "Table is created" << std::endl; - } - } - - {//describe table - TableSchema tb_schema; - Status stat = conn->DescribeTable(TABLE_NAME, tb_schema); - std::cout << "DescribeTable function call status: " << stat.ToString() << std::endl; - PrintTableSchema(tb_schema); - } - - //add vectors - std::vector> search_record_array; - for (int i = 0; i < ADD_VECTOR_LOOP; i++) { - TimeRecorder recorder("Add vector No." + std::to_string(i)); - std::vector record_array; - int64_t begin_index = i * BATCH_ROW_COUNT; - BuildVectors(begin_index, begin_index + BATCH_ROW_COUNT, record_array); - std::vector record_ids; - Status stat = conn->Insert(TABLE_NAME, record_array, record_ids); - std::cout << "AddVector function call status: " << stat.ToString() << std::endl; - std::cout << "Returned id array count: " << record_ids.size() << std::endl; - - if(i == 0) { - for(int64_t k = SEARCH_TARGET; k < SEARCH_TARGET + NQ; k++) { - search_record_array.push_back( - std::make_pair(record_ids[k], record_array[k])); - } - } - } - - {//search vectors without index - Sleep(2); - DoSearch(conn, search_record_array, "Search without index"); - } - - {//wait unit build index finish - TimeRecorder recorder("Build index"); - std::cout << "Wait until build all index done" << std::endl; - IndexParam index_param; - index_param.table_name = TABLE_NAME; - Status stat = conn->CreateIndex(index_param); - std::cout << "BuildIndex function call status: " << stat.ToString() << std::endl; - } - - {//search vectors after build index finish - DoSearch(conn, search_record_array, "Search after build index finish"); - } - - {//delete table - Status stat = conn->DropTable(TABLE_NAME); - std::cout << "DeleteTable function call status: " << stat.ToString() << std::endl; - } - - {//server status - std::string status = conn->ServerStatus(); - std::cout << "Server status before disconnect: " << status << std::endl; - } - Connection::Destroy(conn); - {//server status - std::string status = conn->ServerStatus(); - std::cout << "Server status after disconnect: " << status << std::endl; - } -} \ No newline at end of file diff --git a/cpp/src/sdk/examples/thriftsimple/src/ClientTest.h b/cpp/src/sdk/examples/thriftsimple/src/ClientTest.h deleted file mode 100644 index effbaf9eb2..0000000000 --- a/cpp/src/sdk/examples/thriftsimple/src/ClientTest.h +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include - -class ClientTest { -public: - void Test(const std::string& address, const std::string& port); -}; diff --git a/cpp/src/sdk/interface/ConnectionImpl.h b/cpp/src/sdk/interface/ConnectionImpl.h index d304736b65..03f1fe550b 100644 --- a/cpp/src/sdk/interface/ConnectionImpl.h +++ b/cpp/src/sdk/interface/ConnectionImpl.h @@ -6,11 +6,7 @@ #pragma once #include "MilvusApi.h" -#ifdef MILVUS_ENABLE_THRIFT -#include "src/sdk/thrift/ClientProxy.h" -#else #include "src/sdk/grpc/ClientProxy.h" -#endif namespace milvus { diff --git a/cpp/src/sdk/thrift/ClientProxy.cpp b/cpp/src/sdk/thrift/ClientProxy.cpp deleted file mode 100644 index c258aeefad..0000000000 --- a/cpp/src/sdk/thrift/ClientProxy.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "ClientProxy.h" - -namespace milvus { - -std::shared_ptr& -ClientProxy::ClientPtr() const { - if(client_ptr == nullptr) { - client_ptr = std::make_shared(); - } - return client_ptr; -} - -bool ClientProxy::IsConnected() const { - return (client_ptr != nullptr && connected_); -} - -Status -ClientProxy::Connect(const ConnectParam ¶m) { - Disconnect(); - - int32_t port = atoi(param.port.c_str()); - Status status = ClientPtr()->Connect(param.ip_address, port, THRIFT_PROTOCOL_BINARY); - if(status.ok()) { - connected_ = true; - } - - return status; -} - -Status -ClientProxy::Connect(const std::string &uri) { - Disconnect(); - - size_t index = uri.find_first_of(":", 0); - if((index == std::string::npos)) { - return Status::Invalid("Invalid uri"); - } - - ConnectParam param; - param.ip_address = uri.substr(0, index); - param.port = uri.substr(index + 1); - - return Connect(param); -} - -Status -ClientProxy::Connected() const { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - std::string info; - ClientPtr()->interface()->Ping(info, ""); - } catch ( std::exception& ex) { - return Status(StatusCode::NotConnected, "connection lost: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::Disconnect() { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - connected_ = false; - return ClientPtr()->Disconnect(); -} - -std::string -ClientProxy::ClientVersion() const { - return ""; -} - -Status -ClientProxy::CreateTable(const TableSchema ¶m) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - - thrift::TableSchema schema; - schema.__set_table_name(param.table_name); - schema.__set_index_type((int)param.index_type); - schema.__set_dimension(param.dimension); - schema.__set_store_raw_vector(param.store_raw_vector); - - ClientPtr()->interface()->CreateTable(schema); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to create table: " + std::string(ex.what())); - } - - return Status::OK(); -} - -bool -ClientProxy::HasTable(const std::string &table_name) { - if(!IsConnected()) { - return false; - } - - return ClientPtr()->interface()->HasTable(table_name); -} - -Status -ClientProxy::DropTable(const std::string &table_name) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - ClientPtr()->interface()->DeleteTable(table_name); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to delete table: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::CreateIndex(const IndexParam &index_param) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - ClientPtr()->interface()->BuildIndex(index_param.table_name); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to build index: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::Insert(const std::string &table_name, - const std::vector &record_array, - std::vector &id_array) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - std::vector thrift_records; - for(auto& record : record_array) { - thrift::RowRecord thrift_record; - - thrift_record.vector_data.resize(record.data.size() * sizeof(double)); - double *dbl = (double *) (const_cast(thrift_record.vector_data.data())); - for (size_t i = 0; i < record.data.size(); i++) { - dbl[i] = (double) (record.data[i]); - } - - thrift_records.emplace_back(thrift_record); - } - ClientPtr()->interface()->AddVector(id_array, table_name, thrift_records); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to add vector: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::Search(const std::string &table_name, - const std::vector &query_record_array, - const std::vector &query_range_array, - int64_t topk, - std::vector &topk_query_result_array) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - - //step 1: convert vectors data - std::vector thrift_records; - for(auto& record : query_record_array) { - thrift::RowRecord thrift_record; - - thrift_record.vector_data.resize(record.data.size() * sizeof(double)); - auto dbl = (double *) (const_cast(thrift_record.vector_data.data())); - for (size_t i = 0; i < record.data.size(); i++) { - dbl[i] = (double) (record.data[i]); - } - - thrift_records.emplace_back(thrift_record); - } - - //step 2: convert range array - std::vector thrift_ranges; - for(auto& range : query_range_array) { - thrift::Range thrift_range; - thrift_range.__set_start_value(range.start_value); - thrift_range.__set_end_value(range.end_value); - - thrift_ranges.emplace_back(thrift_range); - } - - //step 3: search vectors - std::vector result_array; - ClientPtr()->interface()->SearchVector2(result_array, table_name, thrift_records, thrift_ranges, topk); - - //step 4: convert result array - for(auto& thrift_topk_result : result_array) { - TopKQueryResult result; - - size_t id_count = thrift_topk_result.id_array.size()/sizeof(int64_t); - size_t dist_count = thrift_topk_result.distance_array.size()/ sizeof(double); - if(id_count != dist_count) { - return Status(StatusCode::UnknownError, "illegal result"); - } - - auto id_ptr = (int64_t*)thrift_topk_result.id_array.data(); - auto dist_ptr = (double*)thrift_topk_result.distance_array.data(); - for(size_t i = 0; i < id_count; i++) { - QueryResult query_result; - query_result.id = id_ptr[i]; - query_result.distance = dist_ptr[i]; - result.query_result_arrays.emplace_back(query_result); - } - - topk_query_result_array.emplace_back(result); - } - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to search vectors: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::DescribeTable(const std::string &table_name, TableSchema &table_schema) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - thrift::TableSchema thrift_schema; - ClientPtr()->interface()->DescribeTable(thrift_schema, table_name); - - table_schema.table_name = thrift_schema.table_name; - table_schema.index_type = (IndexType)thrift_schema.index_type; - table_schema.dimension = thrift_schema.dimension; - table_schema.store_raw_vector = thrift_schema.store_raw_vector; - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to describe table: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::CountTable(const std::string &table_name, int64_t &row_count) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - row_count = ClientPtr()->interface()->GetTableRowCount(table_name); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to show tables: " + std::string(ex.what())); - } - - return Status::OK(); -} - -Status -ClientProxy::ShowTables(std::vector &table_array) { - if(!IsConnected()) { - return Status(StatusCode::NotConnected, "not connected to server"); - } - - try { - ClientPtr()->interface()->ShowTables(table_array); - - } catch ( std::exception& ex) { - return Status(StatusCode::UnknownError, "failed to show tables: " + std::string(ex.what())); - } - - return Status::OK(); -} - -std::string -ClientProxy::ServerVersion() const { - if(!IsConnected()) { - return ""; - } - - try { - std::string version; - ClientPtr()->interface()->Ping(version, "version"); - return version; - } catch ( std::exception& ex) { - return ""; - } -} - -std::string -ClientProxy::ServerStatus() const { - if(!IsConnected()) { - return "not connected to server"; - } - - try { - std::string dummy; - ClientPtr()->interface()->Ping(dummy, ""); - return "server alive"; - } catch ( std::exception& ex) { - return "connection lost"; - } -} - -Status ClientProxy::DeleteByRange(Range &range, const std::string &table_name) { - return Status::OK(); -} - -Status ClientProxy::PreloadTable(const std::string &table_name) const { - return Status::OK(); -} - -Status ClientProxy::DescribeIndex(const std::string &table_name, IndexParam &index_param) const { - index_param.table_name = table_name; - return index_param; -} - -Status ClientProxy::DropIndex(const std::string &table_name) const { - return Status::OK(); -} - -} diff --git a/cpp/src/sdk/thrift/ClientProxy.h b/cpp/src/sdk/thrift/ClientProxy.h deleted file mode 100644 index 27dafc92a6..0000000000 --- a/cpp/src/sdk/thrift/ClientProxy.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include "MilvusApi.h" -#include "ThriftClient.h" - -namespace milvus { - -class ClientProxy : public Connection { -public: - // Implementations of the Connection interface - virtual Status Connect(const ConnectParam ¶m) override; - - virtual Status Connect(const std::string &uri) override; - - virtual Status Connected() const override; - - virtual Status Disconnect() override; - - virtual Status CreateTable(const TableSchema ¶m) override; - - virtual bool HasTable(const std::string &table_name) override; - - virtual Status DropTable(const std::string &table_name) override; - - virtual Status CreateIndex(const IndexParam &index_param) override; - - virtual Status Insert(const std::string &table_name, - const std::vector &record_array, - std::vector &id_array) override; - - virtual Status Search(const std::string &table_name, - const std::vector &query_record_array, - const std::vector &query_range_array, - int64_t topk, - std::vector &topk_query_result_array) override; - - virtual Status DescribeTable(const std::string &table_name, TableSchema &table_schema) override; - - virtual Status CountTable(const std::string &table_name, int64_t &row_count) override; - - virtual Status ShowTables(std::vector &table_array) override; - - virtual std::string ClientVersion() const override; - - virtual std::string ServerVersion() const override; - - virtual std::string ServerStatus() const override; - - virtual Status DeleteByRange(Range &range, const std::string &table_name) override; - - virtual Status PreloadTable(const std::string &table_name) const override; - - virtual Status DescribeIndex(const std::string &table_name, IndexParam &index_param) const override; - - virtual Status DropIndex(const std::string &table_name) const override; - -private: - std::shared_ptr& ClientPtr() const; - - bool IsConnected() const; - -private: - mutable std::shared_ptr client_ptr; - bool connected_ = false; -}; - -} diff --git a/cpp/src/sdk/thrift/ThriftClient.cpp b/cpp/src/sdk/thrift/ThriftClient.cpp deleted file mode 100644 index 99b1c7cf2e..0000000000 --- a/cpp/src/sdk/thrift/ThriftClient.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "ThriftClient.h" - -#include "milvus_types.h" -#include "milvus_constants.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace milvus { - -using namespace ::apache::thrift; -using namespace ::apache::thrift::protocol; -using namespace ::apache::thrift::transport; -using namespace ::apache::thrift::concurrency; - -ThriftClient::ThriftClient() { - -} - -ThriftClient::~ThriftClient() { - -} - -ServiceClientPtr -ThriftClient::interface() { - if(client_ == nullptr) { - throw std::exception(); - } - return client_; -} - -Status -ThriftClient::Connect(const std::string& address, int32_t port, const std::string& protocol) { - try { - stdcxx::shared_ptr socket_ptr(new transport::TSocket(address, port)); - stdcxx::shared_ptr transport_ptr(new TBufferedTransport(socket_ptr)); - stdcxx::shared_ptr protocol_ptr; - if(protocol == THRIFT_PROTOCOL_BINARY) { - protocol_ptr.reset(new TBinaryProtocol(transport_ptr)); - } else if(protocol == THRIFT_PROTOCOL_JSON) { - protocol_ptr.reset(new TJSONProtocol(transport_ptr)); - } else if(protocol == THRIFT_PROTOCOL_COMPACT) { - protocol_ptr.reset(new TCompactProtocol(transport_ptr)); - } else { - //CLIENT_LOG_ERROR << "Service protocol: " << protocol << " is not supported currently"; - return Status(StatusCode::InvalidAgument, "unsupported protocol"); - } - - transport_ptr->open(); - client_ = std::make_shared(protocol_ptr); - } catch ( std::exception& ex) { - //CLIENT_LOG_ERROR << "connect encounter exception: " << ex.what(); - return Status(StatusCode::NotConnected, "failed to connect server" + std::string(ex.what())); - } - - return Status::OK(); -} -Status -ThriftClient::Disconnect() { - try { - if(client_ != nullptr) { - auto protocol = client_->getInputProtocol(); - if(protocol != nullptr) { - auto transport = protocol->getTransport(); - if(transport != nullptr) { - transport->close(); - } - } - } - } catch ( std::exception& ex) { - //CLIENT_LOG_ERROR << "disconnect encounter exception: " << ex.what(); - return Status(StatusCode::UnknownError, "failed to disconnect: " + std::string(ex.what())); - } - - return Status::OK(); -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -ThriftClientSession::ThriftClientSession(const std::string& address, int32_t port, const std::string& protocol) { - Connect(address, port, protocol); -} - -ThriftClientSession::~ThriftClientSession() { - Disconnect(); -} - -} \ No newline at end of file diff --git a/cpp/src/sdk/thrift/ThriftClient.h b/cpp/src/sdk/thrift/ThriftClient.h deleted file mode 100644 index ed77179b96..0000000000 --- a/cpp/src/sdk/thrift/ThriftClient.h +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include "MilvusService.h" -#include "Status.h" - -#include - -namespace milvus { - -using ServiceClientPtr = std::shared_ptr<::milvus::thrift::MilvusServiceClient>; - -static const char* THRIFT_PROTOCOL_JSON = "json"; -static const char* THRIFT_PROTOCOL_BINARY = "binary"; -static const char* THRIFT_PROTOCOL_COMPACT = "compact"; - -class ThriftClient { -public: - ThriftClient(); - virtual ~ThriftClient(); - - ServiceClientPtr interface(); - - Status Connect(const std::string& address, int32_t port, const std::string& protocol); - Status Disconnect(); - -private: - ServiceClientPtr client_; -}; - - -class ThriftClientSession : public ThriftClient { -public: - ThriftClientSession(const std::string& address, int32_t port, const std::string& protocol); - ~ThriftClientSession(); -}; - -} diff --git a/cpp/src/server/Server.cpp b/cpp/src/server/Server.cpp index f1b40de43e..5c0229e319 100644 --- a/cpp/src/server/Server.cpp +++ b/cpp/src/server/Server.cpp @@ -5,13 +5,7 @@ //////////////////////////////////////////////////////////////////////////////// #include #include "Server.h" -//#include "ServerConfig.h" -#ifdef MILVUS_ENABLE_THRIFT -#include "server/thrift_impl/MilvusServer.h" -#else #include "server/grpc_impl/GrpcMilvusServer.h" -#endif - #include "utils/Log.h" #include "utils/SignalUtil.h" #include "utils/TimeRecorder.h" @@ -227,20 +221,12 @@ Server::LoadConfig() { void Server::StartService() { -#ifdef MILVUS_ENABLE_THRIFT - MilvusServer::StartService(); -#else grpc::GrpcMilvusServer::StartService(); -#endif } void Server::StopService() { -#ifdef MILVUS_ENABLE_THRIFT - MilvusServer::StopService(); -#else grpc::GrpcMilvusServer::StopService(); -#endif } } diff --git a/cpp/src/server/thrift_impl/MilvusServer.cpp b/cpp/src/server/thrift_impl/MilvusServer.cpp deleted file mode 100644 index 8cea768283..0000000000 --- a/cpp/src/server/thrift_impl/MilvusServer.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "MilvusServer.h" -#include "RequestHandler.h" -#include "src/server/ServerConfig.h" -#include "ThreadPoolServer.h" -#include "src/server/DBWrapper.h" -#include "utils/Log.h" - -#include "milvus_types.h" -#include "milvus_constants.h" -#include "faiss/utils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -//extern int distance_compute_blas_threshold; - -namespace zilliz { -namespace milvus { -namespace server { - -using namespace ::milvus::thrift; -using namespace ::apache::thrift; -using namespace ::apache::thrift::protocol; -using namespace ::apache::thrift::transport; -using namespace ::apache::thrift::server; -using namespace ::apache::thrift::concurrency; - -static stdcxx::shared_ptr s_server; - -void -MilvusServer::StartService() { - if(s_server != nullptr){ - 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); - std::string protocol = server_config.GetValue(CONFIG_SERVER_PROTOCOL, "binary"); - faiss::distance_compute_blas_threshold = engine_config.GetInt32Value(CONFIG_DCBT,20); -// std::cout<<"distance_compute_blas_threshold = "<< faiss::distance_compute_blas_threshold << std::endl; - try { - DBWrapper::DB();//initialize db - - stdcxx::shared_ptr handler(new RequestHandler()); - stdcxx::shared_ptr processor(new MilvusServiceProcessor(handler)); - stdcxx::shared_ptr server_transport(new TServerSocket(address, port)); - stdcxx::shared_ptr transport_factory(new TBufferedTransportFactory()); - - stdcxx::shared_ptr protocol_factory; - if (protocol == "binary") { - protocol_factory.reset(new TBinaryProtocolFactory()); - } else if (protocol == "json") { - protocol_factory.reset(new TJSONProtocolFactory()); - } else if (protocol == "compact") { - protocol_factory.reset(new TCompactProtocolFactory()); - } else { - // SERVER_LOG_INFO << "Service protocol: " << protocol << " is not supported currently"; - return; - } - - stdcxx::shared_ptr threadManager(ThreadManager::newSimpleThreadManager(16)); - stdcxx::shared_ptr threadFactory(new PosixThreadFactory()); - threadManager->threadFactory(threadFactory); - threadManager->start(); - - s_server.reset(new ThreadPoolServer(processor, - server_transport, - transport_factory, - protocol_factory, - threadManager)); - s_server->serve(); - - } catch (apache::thrift::TException& ex) { - std::cout << "ERROR! " << ex.what() << std::endl; - kill(0, SIGUSR1); - } -} - -void -MilvusServer::StopService() { - if(s_server != nullptr) { - s_server->stop(); - } -} - -} -} -} \ No newline at end of file diff --git a/cpp/src/server/thrift_impl/MilvusServer.h b/cpp/src/server/thrift_impl/MilvusServer.h deleted file mode 100644 index b71cf1ef42..0000000000 --- a/cpp/src/server/thrift_impl/MilvusServer.h +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include -#include - -namespace zilliz { -namespace milvus { -namespace server { - -class MilvusServer { -public: - static void StartService(); - static void StopService(); -}; - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestHandler.cpp b/cpp/src/server/thrift_impl/RequestHandler.cpp deleted file mode 100644 index e7c8e8b1b5..0000000000 --- a/cpp/src/server/thrift_impl/RequestHandler.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ - -#include "RequestHandler.h" -#include "RequestTask.h" -#include "utils/TimeRecorder.h" - -namespace zilliz { -namespace milvus { -namespace server { - -using namespace ::milvus; - -RequestHandler::RequestHandler() { - -} - -void -RequestHandler::CreateTable(const thrift::TableSchema ¶m) { - BaseTaskPtr task_ptr = CreateTableTask::Create(param); - RequestScheduler::ExecTask(task_ptr); -} - -bool -RequestHandler::HasTable(const std::string &table_name) { - bool has_table = false; - BaseTaskPtr task_ptr = HasTableTask::Create(table_name, has_table); - RequestScheduler::ExecTask(task_ptr); - - return has_table; -} - -void -RequestHandler::DeleteTable(const std::string &table_name) { - BaseTaskPtr task_ptr = DeleteTableTask::Create(table_name); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::BuildIndex(const std::string &table_name) { - BaseTaskPtr task_ptr = BuildIndexTask::Create(table_name); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::AddVector(std::vector &_return, - const std::string &table_name, - const std::vector &record_array) { - BaseTaskPtr task_ptr = AddVectorTask::Create(table_name, record_array, _return); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::SearchVector(std::vector &_return, - const std::string &table_name, - const std::vector &query_record_array, - const std::vector &query_range_array, - const int64_t topk) { -// SERVER_LOG_DEBUG << "Entering RequestHandler::SearchVector"; - BaseTaskPtr task_ptr = SearchVectorTask1::Create(table_name, std::vector(), query_record_array, - query_range_array, topk, _return); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::SearchVector2(std::vector & _return, - const std::string& table_name, - const std::vector & query_record_array, - const std::vector & query_range_array, - const int64_t topk) { - BaseTaskPtr task_ptr = SearchVectorTask2::Create(table_name, std::vector(), query_record_array, - query_range_array, topk, _return); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::SearchVectorInFiles(std::vector<::milvus::thrift::TopKQueryResult> &_return, - const std::string& table_name, - const std::vector &file_id_array, - const std::vector<::milvus::thrift::RowRecord> &query_record_array, - const std::vector<::milvus::thrift::Range> &query_range_array, - const int64_t topk) { -// SERVER_LOG_DEBUG << "Entering RequestHandler::SearchVectorInFiles. file_id_array size = " << std::to_string(file_id_array.size()); - BaseTaskPtr task_ptr = SearchVectorTask1::Create(table_name, file_id_array, query_record_array, - query_range_array, topk, _return); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::DescribeTable(thrift::TableSchema &_return, const std::string &table_name) { - BaseTaskPtr task_ptr = DescribeTableTask::Create(table_name, _return); - RequestScheduler::ExecTask(task_ptr); -} - -int64_t -RequestHandler::GetTableRowCount(const std::string& table_name) { - int64_t row_count = 0; - { - BaseTaskPtr task_ptr = GetTableRowCountTask::Create(table_name, row_count); - RequestScheduler::ExecTask(task_ptr); - task_ptr->WaitToFinish(); - } - - return row_count; -} - -void -RequestHandler::ShowTables(std::vector &_return) { - BaseTaskPtr task_ptr = ShowTablesTask::Create(_return); - RequestScheduler::ExecTask(task_ptr); -} - -void -RequestHandler::Ping(std::string& _return, const std::string& cmd) { - BaseTaskPtr task_ptr = PingTask::Create(cmd, _return); - RequestScheduler::ExecTask(task_ptr); -} - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestHandler.h b/cpp/src/server/thrift_impl/RequestHandler.h deleted file mode 100644 index a79830b512..0000000000 --- a/cpp/src/server/thrift_impl/RequestHandler.h +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include -#include - -#include "MilvusService.h" - -namespace zilliz { -namespace milvus { -namespace server { - -class RequestHandler : virtual public ::milvus::thrift::MilvusServiceIf { -public: - RequestHandler(); - - /** - * @brief Create table method - * - * This method is used to create table - * - * @param param, use to provide table information to be created. - * - * - * @param param - */ - void CreateTable(const ::milvus::thrift::TableSchema ¶m); - - /** - * @brief Test table existence method - * - * This method is used to test table existence. - * - * @param table_name, table name is going to be tested. - * - * - * @param table_name - */ - bool HasTable(const std::string &table_name); - - /** - * @brief Delete table method - * - * This method is used to delete table. - * - * @param table_name, table name is going to be deleted. - * - * - * @param table_name - */ - void DeleteTable(const std::string& table_name); - - /** - * @brief build index by table method - * - * This method is used to build index by table in sync. - * - * @param table_name, table name is going to be built index. - * - * - * @param table_name - */ - void BuildIndex(const std::string &table_name); - - /** - * @brief Add vector array to table - * - * This method is used to add vector array to table. - * - * @param table_name, table_name is inserted. - * @param record_array, vector array is inserted. - * - * @return vector id array - * - * @param table_name - * @param record_array - */ - void AddVector(std::vector & _return, - const std::string& table_name, - const std::vector<::milvus::thrift::RowRecord> & record_array); - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - void SearchVector(std::vector<::milvus::thrift::TopKQueryResult> & _return, - const std::string& table_name, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t topk); - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query binary result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - void SearchVector2(std::vector<::milvus::thrift::TopKQueryBinResult> & _return, - const std::string& table_name, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t topk); - - /** - * @brief Internal use query interface - * - * This method is used to query vector in specified files. - * - * @param file_id_array, specified files id array, queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param file_id_array - * @param query_record_array - * @param query_range_array - * @param topk - */ - virtual void SearchVectorInFiles(std::vector<::milvus::thrift::TopKQueryResult> & _return, - const std::string& table_name, - const std::vector & file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t topk); - - /** - * @brief Get table schema - * - * This method is used to get table schema. - * - * @param table_name, target table name. - * - * @return table schema - * - * @param table_name - */ - void DescribeTable(::milvus::thrift::TableSchema& _return, const std::string& table_name); - - /** - * @brief Get table row count - * - * This method is used to get table row count. - * - * @param table_name, target table name. - * - * @return table row count - * - * @param table_name - */ - int64_t GetTableRowCount(const std::string& table_name); - - /** - * @brief List all tables in database - * - * This method is used to list all tables. - * - * - * @return table names. - */ - void ShowTables(std::vector & _return); - - /** - * @brief Give the server status - * - * This method is used to give the server status. - * - * @return Server status. - * - * @param cmd - */ - void Ping(std::string& _return, const std::string& cmd); -}; - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestScheduler.cpp b/cpp/src/server/thrift_impl/RequestScheduler.cpp deleted file mode 100644 index 73c09c8bd4..0000000000 --- a/cpp/src/server/thrift_impl/RequestScheduler.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "RequestScheduler.h" -#include "utils/Log.h" - -#include "milvus_types.h" -#include "milvus_constants.h" - -namespace zilliz { -namespace milvus { -namespace server { - -using namespace ::milvus; - -namespace { - const std::map &ErrorMap() { - static const std::map code_map = { - {SERVER_UNEXPECTED_ERROR, thrift::ErrorCode::UNEXPECTED_ERROR}, - {SERVER_UNSUPPORTED_ERROR, thrift::ErrorCode::UNEXPECTED_ERROR}, - {SERVER_NULL_POINTER, thrift::ErrorCode::UNEXPECTED_ERROR}, - {SERVER_INVALID_ARGUMENT, thrift::ErrorCode::ILLEGAL_ARGUMENT}, - {SERVER_FILE_NOT_FOUND, thrift::ErrorCode::FILE_NOT_FOUND}, - {SERVER_NOT_IMPLEMENT, thrift::ErrorCode::UNEXPECTED_ERROR}, - {SERVER_BLOCKING_QUEUE_EMPTY, thrift::ErrorCode::UNEXPECTED_ERROR}, - {SERVER_CANNOT_CREATE_FOLDER, thrift::ErrorCode::CANNOT_CREATE_FOLDER}, - {SERVER_CANNOT_CREATE_FILE, thrift::ErrorCode::CANNOT_CREATE_FILE}, - {SERVER_CANNOT_DELETE_FOLDER, thrift::ErrorCode::CANNOT_DELETE_FOLDER}, - {SERVER_CANNOT_DELETE_FILE, thrift::ErrorCode::CANNOT_DELETE_FILE}, - {SERVER_TABLE_NOT_EXIST, thrift::ErrorCode::TABLE_NOT_EXISTS}, - {SERVER_INVALID_TABLE_NAME, thrift::ErrorCode::ILLEGAL_TABLE_NAME}, - {SERVER_INVALID_TABLE_DIMENSION, thrift::ErrorCode::ILLEGAL_DIMENSION}, - {SERVER_INVALID_TIME_RANGE, thrift::ErrorCode::ILLEGAL_RANGE}, - {SERVER_INVALID_VECTOR_DIMENSION, thrift::ErrorCode::ILLEGAL_DIMENSION}, - - {SERVER_INVALID_INDEX_TYPE, thrift::ErrorCode::ILLEGAL_INDEX_TYPE}, - {SERVER_INVALID_ROWRECORD, thrift::ErrorCode::ILLEGAL_ROWRECORD}, - {SERVER_INVALID_ROWRECORD_ARRAY, thrift::ErrorCode::ILLEGAL_ROWRECORD}, - {SERVER_INVALID_TOPK, thrift::ErrorCode::ILLEGAL_TOPK}, - {SERVER_ILLEGAL_VECTOR_ID, thrift::ErrorCode::ILLEGAL_VECTOR_ID}, - {SERVER_ILLEGAL_SEARCH_RESULT, thrift::ErrorCode::ILLEGAL_SEARCH_RESULT}, - {SERVER_CACHE_ERROR, thrift::ErrorCode::CACHE_FAILED}, - {DB_META_TRANSACTION_FAILED, thrift::ErrorCode::META_FAILED}, - {SERVER_BUILD_INDEX_ERROR, thrift::ErrorCode::BUILD_INDEX_ERROR}, - }; - - return code_map; - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -BaseTask::BaseTask(const std::string& task_group, bool async) - : task_group_(task_group), - async_(async), - done_(false), - error_code_(SERVER_SUCCESS) { - -} - -BaseTask::~BaseTask() { - WaitToFinish(); -} - -ServerError BaseTask::Execute() { - error_code_ = OnExecute(); - done_ = true; - finish_cond_.notify_all(); - return error_code_; -} - -ServerError BaseTask::SetError(ServerError error_code, const std::string& error_msg) { - error_code_ = error_code; - error_msg_ = error_msg; - - SERVER_LOG_ERROR << error_msg_; - return error_code_; -} - -ServerError BaseTask::WaitToFinish() { - std::unique_lock lock(finish_mtx_); - finish_cond_.wait(lock, [this] { return done_; }); - - return error_code_; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -RequestScheduler::RequestScheduler() -: stopped_(false) { - Start(); -} - -RequestScheduler::~RequestScheduler() { - Stop(); -} - -void RequestScheduler::ExecTask(BaseTaskPtr& task_ptr) { - if(task_ptr == nullptr) { - return; - } - - RequestScheduler& scheduler = RequestScheduler::GetInstance(); - scheduler.ExecuteTask(task_ptr); - - if(!task_ptr->IsAsync()) { - task_ptr->WaitToFinish(); - ServerError err = task_ptr->ErrorCode(); - if (err != SERVER_SUCCESS) { - thrift::Exception ex; - ex.__set_code(ErrorMap().at(err)); - std::string msg = task_ptr->ErrorMsg(); - if(msg.empty()){ - msg = "Error message not set"; - } - ex.__set_reason(msg); - throw ex; - } - } -} - -void RequestScheduler::Start() { - if(!stopped_) { - return; - } - - stopped_ = false; -} - -void RequestScheduler::Stop() { - if(stopped_) { - return; - } - - SERVER_LOG_INFO << "Scheduler gonna stop..."; - { - std::lock_guard lock(queue_mtx_); - for(auto iter : task_groups_) { - if(iter.second != nullptr) { - iter.second->Put(nullptr); - } - } - } - - for(auto iter : execute_threads_) { - if(iter == nullptr) - continue; - - iter->join(); - } - stopped_ = true; - SERVER_LOG_INFO << "Scheduler stopped"; -} - -ServerError RequestScheduler::ExecuteTask(const BaseTaskPtr& task_ptr) { - if(task_ptr == nullptr) { - return SERVER_NULL_POINTER; - } - - ServerError err = PutTaskToQueue(task_ptr); - if(err != SERVER_SUCCESS) { - return err; - } - - if(task_ptr->IsAsync()) { - return SERVER_SUCCESS;//async execution, caller need to call WaitToFinish at somewhere - } - - return task_ptr->WaitToFinish();//sync execution -} - -namespace { - void TakeTaskToExecute(TaskQueuePtr task_queue) { - if(task_queue == nullptr) { - return; - } - - while(true) { - BaseTaskPtr task = task_queue->Take(); - if (task == nullptr) { - break;//stop the thread - } - - try { - ServerError err = task->Execute(); - if(err != SERVER_SUCCESS) { - SERVER_LOG_ERROR << "Task failed with code: " << err; - } - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "Task failed to execute: " << ex.what(); - } - } - } -} - -ServerError RequestScheduler::PutTaskToQueue(const BaseTaskPtr& task_ptr) { - std::lock_guard lock(queue_mtx_); - - std::string group_name = task_ptr->TaskGroup(); - if(task_groups_.count(group_name) > 0) { - task_groups_[group_name]->Put(task_ptr); - } else { - TaskQueuePtr queue = std::make_shared(); - queue->Put(task_ptr); - task_groups_.insert(std::make_pair(group_name, queue)); - - //start a thread - ThreadPtr thread = std::make_shared(&TakeTaskToExecute, queue); - execute_threads_.push_back(thread); - SERVER_LOG_INFO << "Create new thread for task group: " << group_name; - } - - return SERVER_SUCCESS; -} - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestScheduler.h b/cpp/src/server/thrift_impl/RequestScheduler.h deleted file mode 100644 index d4b1e1c826..0000000000 --- a/cpp/src/server/thrift_impl/RequestScheduler.h +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include "utils/BlockingQueue.h" - -#include -#include -#include - -namespace zilliz { -namespace milvus { -namespace server { - -class BaseTask { -protected: - BaseTask(const std::string& task_group, bool async = false); - virtual ~BaseTask(); - -public: - ServerError Execute(); - ServerError WaitToFinish(); - - std::string TaskGroup() const { return task_group_; } - - ServerError ErrorCode() const { return error_code_; } - std::string ErrorMsg() const { return error_msg_; } - - bool IsAsync() const { return async_; } - -protected: - virtual ServerError OnExecute() = 0; - - ServerError SetError(ServerError error_code, const std::string& msg); - -protected: - mutable std::mutex finish_mtx_; - std::condition_variable finish_cond_; - - std::string task_group_; - bool async_; - bool done_; - ServerError error_code_; - std::string error_msg_; -}; - -using BaseTaskPtr = std::shared_ptr; -using TaskQueue = BlockingQueue; -using TaskQueuePtr = std::shared_ptr; -using ThreadPtr = std::shared_ptr; - -class RequestScheduler { -public: - static RequestScheduler& GetInstance() { - static RequestScheduler scheduler; - return scheduler; - } - - void Start(); - void Stop(); - - ServerError ExecuteTask(const BaseTaskPtr& task_ptr); - - static void ExecTask(BaseTaskPtr& task_ptr); - -protected: - RequestScheduler(); - virtual ~RequestScheduler(); - - ServerError PutTaskToQueue(const BaseTaskPtr& task_ptr); - -private: - mutable std::mutex queue_mtx_; - - std::map task_groups_; - - std::vector execute_threads_; - - bool stopped_; -}; - - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestTask.cpp b/cpp/src/server/thrift_impl/RequestTask.cpp deleted file mode 100644 index f7f63f03b5..0000000000 --- a/cpp/src/server/thrift_impl/RequestTask.cpp +++ /dev/null @@ -1,779 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "RequestTask.h" -#include "src/server/ServerConfig.h" -#include "utils/CommonUtil.h" -#include "utils/Log.h" -#include "utils/TimeRecorder.h" -#include "utils/ValidationUtil.h" -#include "src/server/DBWrapper.h" -#include "version.h" - -#ifdef MILVUS_ENABLE_PROFILING -#include "gperftools/profiler.h" -#endif - -namespace zilliz { -namespace milvus { -namespace server { - -using namespace ::milvus; - -static const char* DQL_TASK_GROUP = "dql"; -static const char* DDL_DML_TASK_GROUP = "ddl_dml"; -static const char* PING_TASK_GROUP = "ping"; - -using DB_META = zilliz::milvus::engine::meta::Meta; -using DB_DATE = zilliz::milvus::engine::meta::DateT; - -namespace { - engine::EngineType EngineType(int type) { - static std::map map_type = { - {0, engine::EngineType::INVALID}, - {1, engine::EngineType::FAISS_IDMAP}, - {2, engine::EngineType::FAISS_IVFFLAT}, - {3, engine::EngineType::FAISS_IVFSQ8}, - {4, engine::EngineType::NSG_MIX}, - }; - - if(map_type.find(type) == map_type.end()) { - return engine::EngineType::INVALID; - } - - return map_type[type]; - } - - int IndexType(engine::EngineType type) { - static std::map map_type = { - {engine::EngineType::INVALID, 0}, - {engine::EngineType::FAISS_IDMAP, 1}, - {engine::EngineType::FAISS_IVFFLAT, 2}, - {engine::EngineType::FAISS_IVFSQ8, 3}, - {engine::EngineType::NSG_MIX, 4}, - }; - - if(map_type.find(type) == map_type.end()) { - return 0; - } - - return map_type[type]; - } - - void - ConvertRowRecordToFloatArray(const std::vector& record_array, - uint64_t dimension, - std::vector& float_array, - ServerError& error_code, - std::string& error_msg) { - uint64_t vec_count = record_array.size(); - float_array.resize(vec_count*dimension);//allocate enough memory - for(uint64_t i = 0; i < vec_count; i++) { - const auto& record = record_array[i]; - if(record.vector_data.empty()) { - error_code = SERVER_INVALID_ROWRECORD; - error_msg = "Rowrecord float array is empty"; - return; - } - uint64_t vec_dim = record.vector_data.size()/sizeof(double);//how many double value? - if(vec_dim != dimension) { - error_code = SERVER_INVALID_VECTOR_DIMENSION; - error_msg = "Invalid rowrecord dimension: " + std::to_string(vec_dim) - + " vs. table dimension:" + std::to_string(dimension); - return; - } - - //convert double array to float array(thrift has no float type) - const double* d_p = reinterpret_cast(record.vector_data.data()); - for(uint64_t d = 0; d < vec_dim; d++) { - float_array[i*vec_dim + d] = (float)(d_p[d]); - } - } - } - - static constexpr long DAY_SECONDS = 86400; - - void - ConvertTimeRangeToDBDates(const std::vector &range_array, - std::vector& dates, - ServerError& error_code, - std::string& error_msg) { - dates.clear(); - for(auto& range : range_array) { - time_t tt_start, tt_end; - tm tm_start, tm_end; - if(!CommonUtil::TimeStrToTime(range.start_value, tt_start, tm_start)){ - error_code = SERVER_INVALID_TIME_RANGE; - error_msg = "Invalid time range: " + range.start_value; - return; - } - - if(!CommonUtil::TimeStrToTime(range.end_value, tt_end, tm_end)){ - error_code = SERVER_INVALID_TIME_RANGE; - error_msg = "Invalid time range: " + range.start_value; - return; - } - - long days = (tt_end > tt_start) ? (tt_end - tt_start)/DAY_SECONDS : (tt_start - tt_end)/DAY_SECONDS; - if(days == 0) { - error_code = SERVER_INVALID_TIME_RANGE; - error_msg = "Invalid time range: " + range.start_value + " to " + range.end_value; - return ; - } - - for(long i = 0; i < days; i++) { - time_t tt_day = tt_start + DAY_SECONDS*i; - tm tm_day; - CommonUtil::ConvertTime(tt_day, tm_day); - - long date = tm_day.tm_year*10000 + tm_day.tm_mon*100 + tm_day.tm_mday;//according to db logic - dates.push_back(date); - } - } - } - - std::string - GetCurrTimeStr() { - char tm_buf[20] = {0}; - time_t tt; - time(&tt); - tt = tt + 8 * 60 * 60; - tm* t = gmtime(&tt); - sprintf(tm_buf, "%4d%02d%02d_%02d%02d%02d", (t->tm_year+1900), (t->tm_mon+1), (t->tm_mday), - (t->tm_hour), (t->tm_min), (t->tm_sec)); - return tm_buf; - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -CreateTableTask::CreateTableTask(const thrift::TableSchema& schema) -: BaseTask(DDL_DML_TASK_GROUP), - schema_(schema) { - -} - -BaseTaskPtr CreateTableTask::Create(const thrift::TableSchema& schema) { - return std::shared_ptr(new CreateTableTask(schema)); -} - -ServerError CreateTableTask::OnExecute() { - TimeRecorder rc("CreateTableTask"); - - try { - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(schema_.table_name); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + schema_.table_name); - } - - res = ValidationUtil::ValidateTableDimension(schema_.dimension); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table dimension: " + std::to_string(schema_.dimension)); - } - - res = ValidationUtil::ValidateTableIndexType(schema_.index_type); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid index type: " + std::to_string(schema_.index_type)); - } - - //step 2: construct table schema - engine::meta::TableSchema table_info; - table_info.dimension_ = (uint16_t)schema_.dimension; - table_info.table_id_ = schema_.table_name; - table_info.engine_type_ = (int)EngineType(schema_.index_type); - table_info.store_raw_data_ = schema_.store_raw_vector; - - //step 3: create table - engine::Status stat = DBWrapper::DB()->CreateTable(table_info); - if(!stat.ok()) {//table could exist - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "CreateTableTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - rc.ElapseFromBegin("totally cost"); - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -DescribeTableTask::DescribeTableTask(const std::string &table_name, thrift::TableSchema &schema) - : BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name), - schema_(schema) { - schema_.table_name = table_name_; -} - -BaseTaskPtr DescribeTableTask::Create(const std::string& table_name, thrift::TableSchema& schema) { - return std::shared_ptr(new DescribeTableTask(table_name, schema)); -} - -ServerError DescribeTableTask::OnExecute() { - TimeRecorder rc("DescribeTableTask"); - - try { - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - //step 2: get table info - engine::meta::TableSchema table_info; - table_info.table_id_ = table_name_; - engine::Status stat = DBWrapper::DB()->DescribeTable(table_info); - if(!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - schema_.table_name = table_info.table_id_; - schema_.index_type = IndexType((engine::EngineType)table_info.engine_type_); - schema_.dimension = table_info.dimension_; - schema_.store_raw_vector = table_info.store_raw_data_; - - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "DescribeTableTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - rc.ElapseFromBegin("totally cost"); - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -BuildIndexTask::BuildIndexTask(const std::string& table_name) - : BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name) { -} - -BaseTaskPtr BuildIndexTask::Create(const std::string& table_name) { - return std::shared_ptr(new BuildIndexTask(table_name)); -} - -ServerError BuildIndexTask::OnExecute() { - try { - TimeRecorder rc("BuildIndexTask"); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - bool has_table = false; - engine::Status stat = DBWrapper::DB()->HasTable(table_name_, has_table); - if(!has_table) { - return SetError(SERVER_TABLE_NOT_EXIST, "Table " + table_name_ + " not exists"); - } - - //step 2: check table existence - stat = DBWrapper::DB()->BuildIndex(table_name_); - if(!stat.ok()) { - return SetError(SERVER_BUILD_INDEX_ERROR, "Engine failed: " + stat.ToString()); - } - - rc.ElapseFromBegin("totally cost"); - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "BuildIndexTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -HasTableTask::HasTableTask(const std::string& table_name, bool& has_table) - : BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name), - has_table_(has_table) { - -} - -BaseTaskPtr HasTableTask::Create(const std::string& table_name, bool& has_table) { - return std::shared_ptr(new HasTableTask(table_name, has_table)); -} - -ServerError HasTableTask::OnExecute() { - try { - TimeRecorder rc("HasTableTask"); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - //step 2: check table existence - engine::Status stat = DBWrapper::DB()->HasTable(table_name_, has_table_); - if(!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - rc.ElapseFromBegin("totally cost"); - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "HasTableTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -DeleteTableTask::DeleteTableTask(const std::string& table_name) - : BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name) { - -} - -BaseTaskPtr DeleteTableTask::Create(const std::string& table_name) { - return std::shared_ptr(new DeleteTableTask(table_name)); -} - -ServerError DeleteTableTask::OnExecute() { - try { - TimeRecorder rc("DeleteTableTask"); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - //step 2: check table existence - engine::meta::TableSchema table_info; - table_info.table_id_ = table_name_; - engine::Status stat = DBWrapper::DB()->DescribeTable(table_info); - if(!stat.ok()) { - if(stat.IsNotFound()) { - return SetError(SERVER_TABLE_NOT_EXIST, "Table " + table_name_ + " not exists"); - } else { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - } - - //step 3: delete table - std::vector dates; - stat = DBWrapper::DB()->DeleteTable(table_name_, dates); - if(!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - rc.ElapseFromBegin("totally cost"); - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "DeleteTableTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -ShowTablesTask::ShowTablesTask(std::vector& tables) - : BaseTask(DDL_DML_TASK_GROUP), - tables_(tables) { - -} - -BaseTaskPtr ShowTablesTask::Create(std::vector& tables) { - return std::shared_ptr(new ShowTablesTask(tables)); -} - -ServerError ShowTablesTask::OnExecute() { - std::vector schema_array; - engine::Status stat = DBWrapper::DB()->AllTables(schema_array); - if(!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - tables_.clear(); - for(auto& schema : schema_array) { - tables_.push_back(schema.table_id_); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -AddVectorTask::AddVectorTask(const std::string& table_name, - const std::vector& record_array, - std::vector& record_ids) - : BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name), - record_array_(record_array), - record_ids_(record_ids) { - record_ids_.clear(); -} - -BaseTaskPtr AddVectorTask::Create(const std::string& table_name, - const std::vector& record_array, - std::vector& record_ids) { - return std::shared_ptr(new AddVectorTask(table_name, record_array, record_ids)); -} - -ServerError AddVectorTask::OnExecute() { - try { - TimeRecorder rc("AddVectorTask"); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - if(record_array_.empty()) { - return SetError(SERVER_INVALID_ROWRECORD_ARRAY, "Row record array is empty"); - } - - //step 2: check table existence - engine::meta::TableSchema table_info; - table_info.table_id_ = table_name_; - engine::Status stat = DBWrapper::DB()->DescribeTable(table_info); - if(!stat.ok()) { - if(stat.IsNotFound()) { - return SetError(SERVER_TABLE_NOT_EXIST, "Table " + table_name_ + " not exists"); - } else { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - } - - rc.RecordSection("check validation"); - -#ifdef MILVUS_ENABLE_PROFILING - std::string fname = "/tmp/insert_" + std::to_string(this->record_array_.size()) + - "_" + GetCurrTimeStr() + ".profiling"; - ProfilerStart(fname.c_str()); -#endif - - //step 3: prepare float data - std::vector vec_f; - ServerError error_code = SERVER_SUCCESS; - std::string error_msg; - ConvertRowRecordToFloatArray(record_array_, table_info.dimension_, vec_f, error_code, error_msg); - if(error_code != SERVER_SUCCESS) { - return SetError(error_code, error_msg); - } - - rc.RecordSection("prepare vectors data"); - - //step 4: insert vectors - uint64_t vec_count = (uint64_t)record_array_.size(); - stat = DBWrapper::DB()->InsertVectors(table_name_, vec_count, vec_f.data(), record_ids_); - if(!stat.ok()) { - return SetError(SERVER_CACHE_ERROR, "Cache error: " + stat.ToString()); - } - - if(record_ids_.size() != vec_count) { - std::string msg = "Add " + std::to_string(vec_count) + " vectors but only return " - + std::to_string(record_ids_.size()) + " id"; - return SetError(SERVER_ILLEGAL_VECTOR_ID, msg); - } - -#ifdef MILVUS_ENABLE_PROFILING - ProfilerStop(); -#endif - - rc.RecordSection("add vectors to engine"); - rc.ElapseFromBegin("totally cost"); - - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "AddVectorTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -SearchVectorTaskBase::SearchVectorTaskBase(const std::string &table_name, - const std::vector& file_id_array, - const std::vector &query_record_array, - const std::vector &query_range_array, - const int64_t top_k) - : BaseTask(DQL_TASK_GROUP), - table_name_(table_name), - file_id_array_(file_id_array), - record_array_(query_record_array), - range_array_(query_range_array), - top_k_(top_k) { - -} - -ServerError SearchVectorTaskBase::OnExecute() { - try { - std::string title = "SearchVectorTask(n=" + std::to_string(record_array_.size()) - + " k=" + std::to_string(top_k_) + ")"; - TimeRecorder rc(title); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - if(top_k_ <= 0 || top_k_ > 1024) { - return SetError(SERVER_INVALID_TOPK, "Invalid topk: " + std::to_string(top_k_)); - } - if(record_array_.empty()) { - return SetError(SERVER_INVALID_ROWRECORD_ARRAY, "Row record array is empty"); - } - - //step 2: check table existence - engine::meta::TableSchema table_info; - table_info.table_id_ = table_name_; - engine::Status stat = DBWrapper::DB()->DescribeTable(table_info); - if(!stat.ok()) { - if(stat.IsNotFound()) { - return SetError(SERVER_TABLE_NOT_EXIST, "Table " + table_name_ + " not exists"); - } else { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - } - - //step 3: check date range, and convert to db dates - std::vector dates; - ServerError error_code = SERVER_SUCCESS; - std::string error_msg; - ConvertTimeRangeToDBDates(range_array_, dates, error_code, error_msg); - if(error_code != SERVER_SUCCESS) { - return SetError(error_code, error_msg); - } - - double span_check = rc.RecordSection("check validation"); - -#ifdef MILVUS_ENABLE_PROFILING - std::string fname = "/tmp/search_nq_" + std::to_string(this->record_array_.size()) + - "_top_" + std::to_string(this->top_k_) + "_" + - GetCurrTimeStr() + ".profiling"; - ProfilerStart(fname.c_str()); -#endif - - //step 3: prepare float data - std::vector vec_f; - ConvertRowRecordToFloatArray(record_array_, table_info.dimension_, vec_f, error_code, error_msg); - if(error_code != SERVER_SUCCESS) { - return SetError(error_code, error_msg); - } - - double span_prepare = rc.RecordSection("prepare vector data"); - - //step 4: search vectors - engine::QueryResults results; - uint64_t record_count = (uint64_t)record_array_.size(); - - if(file_id_array_.empty()) { - stat = DBWrapper::DB()->Query(table_name_, (size_t) top_k_, record_count, vec_f.data(), dates, results); - } else { - stat = DBWrapper::DB()->Query(table_name_, file_id_array_, (size_t) top_k_, record_count, vec_f.data(), dates, results); - } - - double span_search = rc.RecordSection("search vectors from engine"); - if(!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - if(results.empty()) { - return SERVER_SUCCESS; //empty table - } - - if(results.size() != record_count) { - std::string msg = "Search " + std::to_string(record_count) + " vectors but only return " - + std::to_string(results.size()) + " results"; - return SetError(SERVER_ILLEGAL_SEARCH_RESULT, msg); - } - - //step 5: construct result array - ConstructResult(results); - -#ifdef MILVUS_ENABLE_PROFILING - ProfilerStop(); -#endif - - double span_result = rc.RecordSection("construct result"); - rc.ElapseFromBegin("totally cost"); - - //step 6: print time cost percent - double total_cost = span_check + span_prepare + span_search + span_result; - SERVER_LOG_DEBUG << title << ": check validation(" << (span_check/total_cost)*100.0 << "%)" - << " prepare data(" << (span_prepare/total_cost)*100.0 << "%)" - << " search(" << (span_search/total_cost)*100.0 << "%)" - << " construct result(" << (span_result/total_cost)*100.0 << "%)"; - - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "SearchVectorTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -SearchVectorTask1::SearchVectorTask1(const std::string &table_name, - const std::vector& file_id_array, - const std::vector &query_record_array, - const std::vector &query_range_array, - const int64_t top_k, - std::vector &result_array) - : SearchVectorTaskBase(table_name, file_id_array, query_record_array, query_range_array, top_k), - result_array_(result_array) { - -} - -BaseTaskPtr SearchVectorTask1::Create(const std::string& table_name, - const std::vector& file_id_array, - const std::vector & query_record_array, - const std::vector & query_range_array, - const int64_t top_k, - std::vector& result_array) { - return std::shared_ptr(new SearchVectorTask1(table_name, file_id_array, - query_record_array, query_range_array, top_k, result_array)); -} - -ServerError SearchVectorTask1::ConstructResult(engine::QueryResults& results) { - for(uint64_t i = 0; i < results.size(); i++) { - auto& result = results[i]; - const auto& record = record_array_[i]; - - thrift::TopKQueryResult thrift_topk_result; - for(auto& pair : result) { - thrift::QueryResult thrift_result; - thrift_result.__set_id(pair.first); - thrift_result.__set_distance(pair.second); - - thrift_topk_result.query_result_arrays.emplace_back(thrift_result); - } - - result_array_.emplace_back(thrift_topk_result); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -SearchVectorTask2::SearchVectorTask2(const std::string &table_name, - const std::vector& file_id_array, - const std::vector &query_record_array, - const std::vector &query_range_array, - const int64_t top_k, - std::vector &result_array) - : SearchVectorTaskBase(table_name, file_id_array, query_record_array, query_range_array, top_k), - result_array_(result_array) { - -} - -BaseTaskPtr SearchVectorTask2::Create(const std::string& table_name, - const std::vector& file_id_array, - const std::vector & query_record_array, - const std::vector & query_range_array, - const int64_t top_k, - std::vector& result_array) { - return std::shared_ptr(new SearchVectorTask2(table_name, file_id_array, - query_record_array, query_range_array, top_k, result_array)); -} - -ServerError SearchVectorTask2::ConstructResult(engine::QueryResults& results) { - for(size_t i = 0; i < results.size(); i++) { - auto& result = results[i]; - - thrift::TopKQueryBinResult thrift_topk_result; - if(result.empty()) { - result_array_.emplace_back(thrift_topk_result); - continue; - } - - std::string str_ids, str_distances; - str_ids.resize(sizeof(engine::IDNumber)*result.size()); - str_distances.resize(sizeof(double)*result.size()); - - engine::IDNumber* ids_ptr = (engine::IDNumber*)str_ids.data(); - double* distance_ptr = (double*)str_distances.data(); - for(size_t k = 0; k < result.size(); k++) { - auto& pair = result[k]; - ids_ptr[k] = pair.first; - distance_ptr[k] = pair.second; - } - - thrift_topk_result.__set_id_array(str_ids); - thrift_topk_result.__set_distance_array(str_distances); - result_array_.emplace_back(thrift_topk_result); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -GetTableRowCountTask::GetTableRowCountTask(const std::string& table_name, int64_t& row_count) -: BaseTask(DDL_DML_TASK_GROUP), - table_name_(table_name), - row_count_(row_count) { - -} - -BaseTaskPtr GetTableRowCountTask::Create(const std::string& table_name, int64_t& row_count) { - return std::shared_ptr(new GetTableRowCountTask(table_name, row_count)); -} - -ServerError GetTableRowCountTask::OnExecute() { - try { - TimeRecorder rc("GetTableRowCountTask"); - - //step 1: check arguments - ServerError res = SERVER_SUCCESS; - res = ValidationUtil::ValidateTableName(table_name_); - if(res != SERVER_SUCCESS) { - return SetError(res, "Invalid table name: " + table_name_); - } - - //step 2: get row count - uint64_t row_count = 0; - engine::Status stat = DBWrapper::DB()->GetTableRowCount(table_name_, row_count); - if (!stat.ok()) { - return SetError(DB_META_TRANSACTION_FAILED, "Engine failed: " + stat.ToString()); - } - - row_count_ = (int64_t) row_count; - - rc.ElapseFromBegin("totally cost"); - - } catch (std::exception& ex) { - SERVER_LOG_ERROR << "GetTableRowCountTask encounter exception: " << ex.what(); - return SetError(SERVER_UNEXPECTED_ERROR, ex.what()); - } - - return SERVER_SUCCESS; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -PingTask::PingTask(const std::string& cmd, std::string& result) - : BaseTask(PING_TASK_GROUP), - cmd_(cmd), - result_(result) { - -} - -BaseTaskPtr PingTask::Create(const std::string& cmd, std::string& result) { - return std::shared_ptr(new PingTask(cmd, result)); -} - -ServerError PingTask::OnExecute() { - if(cmd_ == "version") { - result_ = MILVUS_VERSION; - } - - return SERVER_SUCCESS; -} - -} -} -} diff --git a/cpp/src/server/thrift_impl/RequestTask.h b/cpp/src/server/thrift_impl/RequestTask.h deleted file mode 100644 index 4a95ef5b61..0000000000 --- a/cpp/src/server/thrift_impl/RequestTask.h +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#pragma once - -#include "RequestScheduler.h" -#include "utils/Error.h" -#include "db/Types.h" - -#include "milvus_types.h" - -#include -#include - -namespace zilliz { -namespace milvus { -namespace server { - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class CreateTableTask : public BaseTask { -public: - static BaseTaskPtr Create(const ::milvus::thrift::TableSchema& schema); - -protected: - CreateTableTask(const ::milvus::thrift::TableSchema& schema); - - ServerError OnExecute() override; - -private: - const ::milvus::thrift::TableSchema& schema_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class HasTableTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name, bool& has_table); - -protected: - HasTableTask(const std::string& table_name, bool& has_table); - - ServerError OnExecute() override; - - -private: - std::string table_name_; - bool& has_table_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class DescribeTableTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name, ::milvus::thrift::TableSchema& schema); - -protected: - DescribeTableTask(const std::string& table_name, ::milvus::thrift::TableSchema& schema); - - ServerError OnExecute() override; - - -private: - std::string table_name_; - ::milvus::thrift::TableSchema& schema_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class DeleteTableTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name); - -protected: - DeleteTableTask(const std::string& table_name); - - ServerError OnExecute() override; - - -private: - std::string table_name_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class BuildIndexTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name); - -protected: - BuildIndexTask(const std::string& table_name); - - ServerError OnExecute() override; - - -private: - std::string table_name_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class ShowTablesTask : public BaseTask { -public: - static BaseTaskPtr Create(std::vector& tables); - -protected: - ShowTablesTask(std::vector& tables); - - ServerError OnExecute() override; - -private: - std::vector& tables_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class AddVectorTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name, - const std::vector<::milvus::thrift::RowRecord>& record_array, - std::vector& record_ids_); - -protected: - AddVectorTask(const std::string& table_name, - const std::vector<::milvus::thrift::RowRecord>& record_array, - std::vector& record_ids_); - - ServerError OnExecute() override; - -private: - std::string table_name_; - const std::vector<::milvus::thrift::RowRecord>& record_array_; - std::vector& record_ids_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class SearchVectorTaskBase : public BaseTask { -protected: - SearchVectorTaskBase(const std::string& table_name, - const std::vector& file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t top_k); - - ServerError OnExecute() override; - - virtual ServerError ConstructResult(engine::QueryResults& results) = 0; - -protected: - std::string table_name_; - std::vector file_id_array_; - int64_t top_k_; - const std::vector<::milvus::thrift::RowRecord>& record_array_; - const std::vector<::milvus::thrift::Range>& range_array_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class SearchVectorTask1 : public SearchVectorTaskBase { -public: - static BaseTaskPtr Create(const std::string& table_name, - const std::vector& file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t top_k, - std::vector<::milvus::thrift::TopKQueryResult>& result_array); - -protected: - SearchVectorTask1(const std::string& table_name, - const std::vector& file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t top_k, - std::vector<::milvus::thrift::TopKQueryResult>& result_array); - - ServerError ConstructResult(engine::QueryResults& results) override; - -private: - std::vector<::milvus::thrift::TopKQueryResult>& result_array_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class SearchVectorTask2 : public SearchVectorTaskBase { -public: - static BaseTaskPtr Create(const std::string& table_name, - const std::vector& file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t top_k, - std::vector<::milvus::thrift::TopKQueryBinResult>& result_array); - -protected: - SearchVectorTask2(const std::string& table_name, - const std::vector& file_id_array, - const std::vector<::milvus::thrift::RowRecord> & query_record_array, - const std::vector<::milvus::thrift::Range> & query_range_array, - const int64_t top_k, - std::vector<::milvus::thrift::TopKQueryBinResult>& result_array); - - ServerError ConstructResult(engine::QueryResults& results) override; - -private: - std::vector<::milvus::thrift::TopKQueryBinResult>& result_array_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class GetTableRowCountTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& table_name, int64_t& row_count); - -protected: - GetTableRowCountTask(const std::string& table_name, int64_t& row_count); - - ServerError OnExecute() override; - -private: - std::string table_name_; - int64_t& row_count_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class PingTask : public BaseTask { -public: - static BaseTaskPtr Create(const std::string& cmd, std::string& result); - -protected: - PingTask(const std::string& cmd, std::string& result); - - ServerError OnExecute() override; - -private: - std::string cmd_; - std::string& result_; -}; - -} -} -} diff --git a/cpp/src/server/thrift_impl/ThreadPoolServer.cpp b/cpp/src/server/thrift_impl/ThreadPoolServer.cpp deleted file mode 100644 index 507ff3b9ed..0000000000 --- a/cpp/src/server/thrift_impl/ThreadPoolServer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -#include "metrics/Metrics.h" -#include "ThreadPoolServer.h" - -namespace zilliz { -namespace milvus { -namespace server { - -void -ThreadPoolServer::onClientConnected(const std::shared_ptr &pClient) { - server::Metrics::GetInstance().ConnectionGaugeIncrement(); - TThreadPoolServer::onClientConnected(pClient); -} - -void -ThreadPoolServer::onClientDisconnected(apache::thrift::server::TConnectedClient *pClient) { - server::Metrics::GetInstance().ConnectionGaugeDecrement(); - TThreadPoolServer::onClientDisconnected(pClient); -} - -zilliz::milvus::server::ThreadPoolServer::ThreadPoolServer(const std::shared_ptr &processor, - const std::shared_ptr &serverTransport, - const std::shared_ptr &transportFactory, - const std::shared_ptr &protocolFactory, - const std::shared_ptr &threadManager) - : TThreadPoolServer(processor, serverTransport, transportFactory, protocolFactory, threadManager) { - -} - -} -} -} \ No newline at end of file diff --git a/cpp/src/server/thrift_impl/ThreadPoolServer.h b/cpp/src/server/thrift_impl/ThreadPoolServer.h deleted file mode 100644 index 501ebc6e1d..0000000000 --- a/cpp/src/server/thrift_impl/ThreadPoolServer.h +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ - -#pragma once - -#include - - -namespace zilliz { -namespace milvus { -namespace server { - -class ThreadPoolServer : public apache::thrift::server::TThreadPoolServer { - public: - ThreadPoolServer( - const std::shared_ptr& processor, - const std::shared_ptr& serverTransport, - const std::shared_ptr& transportFactory, - const std::shared_ptr& protocolFactory, - const std::shared_ptr& threadManager - = apache::thrift::concurrency::ThreadManager::newSimpleThreadManager()); - - protected: - void onClientConnected(const std::shared_ptr& pClient) override ; - void onClientDisconnected(apache::thrift::server::TConnectedClient* pClient) override ; -}; - -} -} -} \ No newline at end of file diff --git a/cpp/src/thrift/cpp_gen.sh b/cpp/src/thrift/cpp_gen.sh deleted file mode 100755 index 69f73c87f4..0000000000 --- a/cpp/src/thrift/cpp_gen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -thrift -r --gen cpp ./milvus.thrift - diff --git a/cpp/src/thrift/gen-cpp/MilvusService.cpp b/cpp/src/thrift/gen-cpp/MilvusService.cpp deleted file mode 100644 index 3420b92b5d..0000000000 --- a/cpp/src/thrift/gen-cpp/MilvusService.cpp +++ /dev/null @@ -1,5457 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "MilvusService.h" - -namespace milvus { namespace thrift { - - -MilvusService_CreateTable_args::~MilvusService_CreateTable_args() throw() { -} - - -uint32_t MilvusService_CreateTable_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->param.read(iprot); - this->__isset.param = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_CreateTable_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_CreateTable_args"); - - xfer += oprot->writeFieldBegin("param", ::apache::thrift::protocol::T_STRUCT, 2); - xfer += this->param.write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_CreateTable_pargs::~MilvusService_CreateTable_pargs() throw() { -} - - -uint32_t MilvusService_CreateTable_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_CreateTable_pargs"); - - xfer += oprot->writeFieldBegin("param", ::apache::thrift::protocol::T_STRUCT, 2); - xfer += (*(this->param)).write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_CreateTable_result::~MilvusService_CreateTable_result() throw() { -} - - -uint32_t MilvusService_CreateTable_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_CreateTable_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_CreateTable_result"); - - if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_CreateTable_presult::~MilvusService_CreateTable_presult() throw() { -} - - -uint32_t MilvusService_CreateTable_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_HasTable_args::~MilvusService_HasTable_args() throw() { -} - - -uint32_t MilvusService_HasTable_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_HasTable_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_HasTable_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_HasTable_pargs::~MilvusService_HasTable_pargs() throw() { -} - - -uint32_t MilvusService_HasTable_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_HasTable_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_HasTable_result::~MilvusService_HasTable_result() throw() { -} - - -uint32_t MilvusService_HasTable_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->success); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_HasTable_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_HasTable_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 0); - xfer += oprot->writeBool(this->success); - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_HasTable_presult::~MilvusService_HasTable_presult() throw() { -} - - -uint32_t MilvusService_HasTable_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool((*(this->success))); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_DeleteTable_args::~MilvusService_DeleteTable_args() throw() { -} - - -uint32_t MilvusService_DeleteTable_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_DeleteTable_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_DeleteTable_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DeleteTable_pargs::~MilvusService_DeleteTable_pargs() throw() { -} - - -uint32_t MilvusService_DeleteTable_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_DeleteTable_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DeleteTable_result::~MilvusService_DeleteTable_result() throw() { -} - - -uint32_t MilvusService_DeleteTable_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_DeleteTable_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_DeleteTable_result"); - - if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DeleteTable_presult::~MilvusService_DeleteTable_presult() throw() { -} - - -uint32_t MilvusService_DeleteTable_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_BuildIndex_args::~MilvusService_BuildIndex_args() throw() { -} - - -uint32_t MilvusService_BuildIndex_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_BuildIndex_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_BuildIndex_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_BuildIndex_pargs::~MilvusService_BuildIndex_pargs() throw() { -} - - -uint32_t MilvusService_BuildIndex_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_BuildIndex_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_BuildIndex_result::~MilvusService_BuildIndex_result() throw() { -} - - -uint32_t MilvusService_BuildIndex_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_BuildIndex_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_BuildIndex_result"); - - if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_BuildIndex_presult::~MilvusService_BuildIndex_presult() throw() { -} - - -uint32_t MilvusService_BuildIndex_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_AddVector_args::~MilvusService_AddVector_args() throw() { -} - - -uint32_t MilvusService_AddVector_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->record_array.clear(); - uint32_t _size21; - ::apache::thrift::protocol::TType _etype24; - xfer += iprot->readListBegin(_etype24, _size21); - this->record_array.resize(_size21); - uint32_t _i25; - for (_i25 = 0; _i25 < _size21; ++_i25) - { - xfer += this->record_array[_i25].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.record_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_AddVector_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_AddVector_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->record_array.size())); - std::vector ::const_iterator _iter26; - for (_iter26 = this->record_array.begin(); _iter26 != this->record_array.end(); ++_iter26) - { - xfer += (*_iter26).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_AddVector_pargs::~MilvusService_AddVector_pargs() throw() { -} - - -uint32_t MilvusService_AddVector_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_AddVector_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->record_array)).size())); - std::vector ::const_iterator _iter27; - for (_iter27 = (*(this->record_array)).begin(); _iter27 != (*(this->record_array)).end(); ++_iter27) - { - xfer += (*_iter27).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_AddVector_result::~MilvusService_AddVector_result() throw() { -} - - -uint32_t MilvusService_AddVector_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size28; - ::apache::thrift::protocol::TType _etype31; - xfer += iprot->readListBegin(_etype31, _size28); - this->success.resize(_size28); - uint32_t _i32; - for (_i32 = 0; _i32 < _size28; ++_i32) - { - xfer += iprot->readI64(this->success[_i32]); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_AddVector_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_AddVector_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast(this->success.size())); - std::vector ::const_iterator _iter33; - for (_iter33 = this->success.begin(); _iter33 != this->success.end(); ++_iter33) - { - xfer += oprot->writeI64((*_iter33)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_AddVector_presult::~MilvusService_AddVector_presult() throw() { -} - - -uint32_t MilvusService_AddVector_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size34; - ::apache::thrift::protocol::TType _etype37; - xfer += iprot->readListBegin(_etype37, _size34); - (*(this->success)).resize(_size34); - uint32_t _i38; - for (_i38 = 0; _i38 < _size34; ++_i38) - { - xfer += iprot->readI64((*(this->success))[_i38]); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_SearchVector_args::~MilvusService_SearchVector_args() throw() { -} - - -uint32_t MilvusService_SearchVector_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_record_array.clear(); - uint32_t _size39; - ::apache::thrift::protocol::TType _etype42; - xfer += iprot->readListBegin(_etype42, _size39); - this->query_record_array.resize(_size39); - uint32_t _i43; - for (_i43 = 0; _i43 < _size39; ++_i43) - { - xfer += this->query_record_array[_i43].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_record_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_range_array.clear(); - uint32_t _size44; - ::apache::thrift::protocol::TType _etype47; - xfer += iprot->readListBegin(_etype47, _size44); - this->query_range_array.resize(_size44); - uint32_t _i48; - for (_i48 = 0; _i48 < _size44; ++_i48) - { - xfer += this->query_range_array[_i48].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_range_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->topk); - this->__isset.topk = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVector_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVector_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_record_array.size())); - std::vector ::const_iterator _iter49; - for (_iter49 = this->query_record_array.begin(); _iter49 != this->query_record_array.end(); ++_iter49) - { - xfer += (*_iter49).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_range_array.size())); - std::vector ::const_iterator _iter50; - for (_iter50 = this->query_range_array.begin(); _iter50 != this->query_range_array.end(); ++_iter50) - { - xfer += (*_iter50).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5); - xfer += oprot->writeI64(this->topk); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector_pargs::~MilvusService_SearchVector_pargs() throw() { -} - - -uint32_t MilvusService_SearchVector_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVector_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_record_array)).size())); - std::vector ::const_iterator _iter51; - for (_iter51 = (*(this->query_record_array)).begin(); _iter51 != (*(this->query_record_array)).end(); ++_iter51) - { - xfer += (*_iter51).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_range_array)).size())); - std::vector ::const_iterator _iter52; - for (_iter52 = (*(this->query_range_array)).begin(); _iter52 != (*(this->query_range_array)).end(); ++_iter52) - { - xfer += (*_iter52).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5); - xfer += oprot->writeI64((*(this->topk))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector_result::~MilvusService_SearchVector_result() throw() { -} - - -uint32_t MilvusService_SearchVector_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size53; - ::apache::thrift::protocol::TType _etype56; - xfer += iprot->readListBegin(_etype56, _size53); - this->success.resize(_size53); - uint32_t _i57; - for (_i57 = 0; _i57 < _size53; ++_i57) - { - xfer += this->success[_i57].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVector_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_SearchVector_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); - std::vector ::const_iterator _iter58; - for (_iter58 = this->success.begin(); _iter58 != this->success.end(); ++_iter58) - { - xfer += (*_iter58).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector_presult::~MilvusService_SearchVector_presult() throw() { -} - - -uint32_t MilvusService_SearchVector_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size59; - ::apache::thrift::protocol::TType _etype62; - xfer += iprot->readListBegin(_etype62, _size59); - (*(this->success)).resize(_size59); - uint32_t _i63; - for (_i63 = 0; _i63 < _size59; ++_i63) - { - xfer += (*(this->success))[_i63].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_SearchVector2_args::~MilvusService_SearchVector2_args() throw() { -} - - -uint32_t MilvusService_SearchVector2_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_record_array.clear(); - uint32_t _size64; - ::apache::thrift::protocol::TType _etype67; - xfer += iprot->readListBegin(_etype67, _size64); - this->query_record_array.resize(_size64); - uint32_t _i68; - for (_i68 = 0; _i68 < _size64; ++_i68) - { - xfer += this->query_record_array[_i68].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_record_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_range_array.clear(); - uint32_t _size69; - ::apache::thrift::protocol::TType _etype72; - xfer += iprot->readListBegin(_etype72, _size69); - this->query_range_array.resize(_size69); - uint32_t _i73; - for (_i73 = 0; _i73 < _size69; ++_i73) - { - xfer += this->query_range_array[_i73].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_range_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->topk); - this->__isset.topk = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVector2_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVector2_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_record_array.size())); - std::vector ::const_iterator _iter74; - for (_iter74 = this->query_record_array.begin(); _iter74 != this->query_record_array.end(); ++_iter74) - { - xfer += (*_iter74).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_range_array.size())); - std::vector ::const_iterator _iter75; - for (_iter75 = this->query_range_array.begin(); _iter75 != this->query_range_array.end(); ++_iter75) - { - xfer += (*_iter75).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5); - xfer += oprot->writeI64(this->topk); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector2_pargs::~MilvusService_SearchVector2_pargs() throw() { -} - - -uint32_t MilvusService_SearchVector2_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVector2_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_record_array)).size())); - std::vector ::const_iterator _iter76; - for (_iter76 = (*(this->query_record_array)).begin(); _iter76 != (*(this->query_record_array)).end(); ++_iter76) - { - xfer += (*_iter76).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_range_array)).size())); - std::vector ::const_iterator _iter77; - for (_iter77 = (*(this->query_range_array)).begin(); _iter77 != (*(this->query_range_array)).end(); ++_iter77) - { - xfer += (*_iter77).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5); - xfer += oprot->writeI64((*(this->topk))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector2_result::~MilvusService_SearchVector2_result() throw() { -} - - -uint32_t MilvusService_SearchVector2_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size78; - ::apache::thrift::protocol::TType _etype81; - xfer += iprot->readListBegin(_etype81, _size78); - this->success.resize(_size78); - uint32_t _i82; - for (_i82 = 0; _i82 < _size78; ++_i82) - { - xfer += this->success[_i82].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVector2_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_SearchVector2_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); - std::vector ::const_iterator _iter83; - for (_iter83 = this->success.begin(); _iter83 != this->success.end(); ++_iter83) - { - xfer += (*_iter83).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVector2_presult::~MilvusService_SearchVector2_presult() throw() { -} - - -uint32_t MilvusService_SearchVector2_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size84; - ::apache::thrift::protocol::TType _etype87; - xfer += iprot->readListBegin(_etype87, _size84); - (*(this->success)).resize(_size84); - uint32_t _i88; - for (_i88 = 0; _i88 < _size84; ++_i88) - { - xfer += (*(this->success))[_i88].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_SearchVectorInFiles_args::~MilvusService_SearchVectorInFiles_args() throw() { -} - - -uint32_t MilvusService_SearchVectorInFiles_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->file_id_array.clear(); - uint32_t _size89; - ::apache::thrift::protocol::TType _etype92; - xfer += iprot->readListBegin(_etype92, _size89); - this->file_id_array.resize(_size89); - uint32_t _i93; - for (_i93 = 0; _i93 < _size89; ++_i93) - { - xfer += iprot->readString(this->file_id_array[_i93]); - } - xfer += iprot->readListEnd(); - } - this->__isset.file_id_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_record_array.clear(); - uint32_t _size94; - ::apache::thrift::protocol::TType _etype97; - xfer += iprot->readListBegin(_etype97, _size94); - this->query_record_array.resize(_size94); - uint32_t _i98; - for (_i98 = 0; _i98 < _size94; ++_i98) - { - xfer += this->query_record_array[_i98].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_record_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_range_array.clear(); - uint32_t _size99; - ::apache::thrift::protocol::TType _etype102; - xfer += iprot->readListBegin(_etype102, _size99); - this->query_range_array.resize(_size99); - uint32_t _i103; - for (_i103 = 0; _i103 < _size99; ++_i103) - { - xfer += this->query_range_array[_i103].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_range_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 6: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->topk); - this->__isset.topk = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVectorInFiles_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVectorInFiles_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("file_id_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->file_id_array.size())); - std::vector ::const_iterator _iter104; - for (_iter104 = this->file_id_array.begin(); _iter104 != this->file_id_array.end(); ++_iter104) - { - xfer += oprot->writeString((*_iter104)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_record_array.size())); - std::vector ::const_iterator _iter105; - for (_iter105 = this->query_record_array.begin(); _iter105 != this->query_record_array.end(); ++_iter105) - { - xfer += (*_iter105).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 5); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_range_array.size())); - std::vector ::const_iterator _iter106; - for (_iter106 = this->query_range_array.begin(); _iter106 != this->query_range_array.end(); ++_iter106) - { - xfer += (*_iter106).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 6); - xfer += oprot->writeI64(this->topk); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVectorInFiles_pargs::~MilvusService_SearchVectorInFiles_pargs() throw() { -} - - -uint32_t MilvusService_SearchVectorInFiles_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_SearchVectorInFiles_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("file_id_array", ::apache::thrift::protocol::T_LIST, 3); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->file_id_array)).size())); - std::vector ::const_iterator _iter107; - for (_iter107 = (*(this->file_id_array)).begin(); _iter107 != (*(this->file_id_array)).end(); ++_iter107) - { - xfer += oprot->writeString((*_iter107)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 4); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_record_array)).size())); - std::vector ::const_iterator _iter108; - for (_iter108 = (*(this->query_record_array)).begin(); _iter108 != (*(this->query_record_array)).end(); ++_iter108) - { - xfer += (*_iter108).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 5); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->query_range_array)).size())); - std::vector ::const_iterator _iter109; - for (_iter109 = (*(this->query_range_array)).begin(); _iter109 != (*(this->query_range_array)).end(); ++_iter109) - { - xfer += (*_iter109).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 6); - xfer += oprot->writeI64((*(this->topk))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVectorInFiles_result::~MilvusService_SearchVectorInFiles_result() throw() { -} - - -uint32_t MilvusService_SearchVectorInFiles_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size110; - ::apache::thrift::protocol::TType _etype113; - xfer += iprot->readListBegin(_etype113, _size110); - this->success.resize(_size110); - uint32_t _i114; - for (_i114 = 0; _i114 < _size110; ++_i114) - { - xfer += this->success[_i114].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_SearchVectorInFiles_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_SearchVectorInFiles_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); - std::vector ::const_iterator _iter115; - for (_iter115 = this->success.begin(); _iter115 != this->success.end(); ++_iter115) - { - xfer += (*_iter115).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_SearchVectorInFiles_presult::~MilvusService_SearchVectorInFiles_presult() throw() { -} - - -uint32_t MilvusService_SearchVectorInFiles_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size116; - ::apache::thrift::protocol::TType _etype119; - xfer += iprot->readListBegin(_etype119, _size116); - (*(this->success)).resize(_size116); - uint32_t _i120; - for (_i120 = 0; _i120 < _size116; ++_i120) - { - xfer += (*(this->success))[_i120].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_DescribeTable_args::~MilvusService_DescribeTable_args() throw() { -} - - -uint32_t MilvusService_DescribeTable_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_DescribeTable_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_DescribeTable_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DescribeTable_pargs::~MilvusService_DescribeTable_pargs() throw() { -} - - -uint32_t MilvusService_DescribeTable_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_DescribeTable_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DescribeTable_result::~MilvusService_DescribeTable_result() throw() { -} - - -uint32_t MilvusService_DescribeTable_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->success.read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_DescribeTable_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_DescribeTable_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); - xfer += this->success.write(oprot); - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_DescribeTable_presult::~MilvusService_DescribeTable_presult() throw() { -} - - -uint32_t MilvusService_DescribeTable_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += (*(this->success)).read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_GetTableRowCount_args::~MilvusService_GetTableRowCount_args() throw() { -} - - -uint32_t MilvusService_GetTableRowCount_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - this->__isset.table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_GetTableRowCount_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_GetTableRowCount_args"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_GetTableRowCount_pargs::~MilvusService_GetTableRowCount_pargs() throw() { -} - - -uint32_t MilvusService_GetTableRowCount_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_GetTableRowCount_pargs"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->table_name))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_GetTableRowCount_result::~MilvusService_GetTableRowCount_result() throw() { -} - - -uint32_t MilvusService_GetTableRowCount_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->success); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_GetTableRowCount_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_GetTableRowCount_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I64, 0); - xfer += oprot->writeI64(this->success); - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_GetTableRowCount_presult::~MilvusService_GetTableRowCount_presult() throw() { -} - - -uint32_t MilvusService_GetTableRowCount_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64((*(this->success))); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_ShowTables_args::~MilvusService_ShowTables_args() throw() { -} - - -uint32_t MilvusService_ShowTables_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - xfer += iprot->skip(ftype); - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_ShowTables_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_ShowTables_args"); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_ShowTables_pargs::~MilvusService_ShowTables_pargs() throw() { -} - - -uint32_t MilvusService_ShowTables_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_ShowTables_pargs"); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_ShowTables_result::~MilvusService_ShowTables_result() throw() { -} - - -uint32_t MilvusService_ShowTables_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size121; - ::apache::thrift::protocol::TType _etype124; - xfer += iprot->readListBegin(_etype124, _size121); - this->success.resize(_size121); - uint32_t _i125; - for (_i125 = 0; _i125 < _size121; ++_i125) - { - xfer += iprot->readString(this->success[_i125]); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_ShowTables_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_ShowTables_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->success.size())); - std::vector ::const_iterator _iter126; - for (_iter126 = this->success.begin(); _iter126 != this->success.end(); ++_iter126) - { - xfer += oprot->writeString((*_iter126)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_ShowTables_presult::~MilvusService_ShowTables_presult() throw() { -} - - -uint32_t MilvusService_ShowTables_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size127; - ::apache::thrift::protocol::TType _etype130; - xfer += iprot->readListBegin(_etype130, _size127); - (*(this->success)).resize(_size127); - uint32_t _i131; - for (_i131 = 0; _i131 < _size127; ++_i131) - { - xfer += iprot->readString((*(this->success))[_i131]); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -MilvusService_Ping_args::~MilvusService_Ping_args() throw() { -} - - -uint32_t MilvusService_Ping_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->cmd); - this->__isset.cmd = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_Ping_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_Ping_args"); - - xfer += oprot->writeFieldBegin("cmd", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->cmd); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_Ping_pargs::~MilvusService_Ping_pargs() throw() { -} - - -uint32_t MilvusService_Ping_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("MilvusService_Ping_pargs"); - - xfer += oprot->writeFieldBegin("cmd", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString((*(this->cmd))); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_Ping_result::~MilvusService_Ping_result() throw() { -} - - -uint32_t MilvusService_Ping_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->success); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t MilvusService_Ping_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("MilvusService_Ping_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); - xfer += oprot->writeString(this->success); - xfer += oprot->writeFieldEnd(); - } else if (this->__isset.e) { - xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->e.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -MilvusService_Ping_presult::~MilvusService_Ping_presult() throw() { -} - - -uint32_t MilvusService_Ping_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString((*(this->success))); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->e.read(iprot); - this->__isset.e = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -void MilvusServiceClient::CreateTable(const TableSchema& param) -{ - send_CreateTable(param); - recv_CreateTable(); -} - -void MilvusServiceClient::send_CreateTable(const TableSchema& param) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("CreateTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_CreateTable_pargs args; - args.param = ¶m; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_CreateTable() -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("CreateTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_CreateTable_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - throw result.e; - } - return; -} - -bool MilvusServiceClient::HasTable(const std::string& table_name) -{ - send_HasTable(table_name); - return recv_HasTable(); -} - -void MilvusServiceClient::send_HasTable(const std::string& table_name) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("HasTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_HasTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -bool MilvusServiceClient::recv_HasTable() -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("HasTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - bool _return; - MilvusService_HasTable_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - return _return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "HasTable failed: unknown result"); -} - -void MilvusServiceClient::DeleteTable(const std::string& table_name) -{ - send_DeleteTable(table_name); - recv_DeleteTable(); -} - -void MilvusServiceClient::send_DeleteTable(const std::string& table_name) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("DeleteTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_DeleteTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_DeleteTable() -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("DeleteTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_DeleteTable_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - throw result.e; - } - return; -} - -void MilvusServiceClient::BuildIndex(const std::string& table_name) -{ - send_BuildIndex(table_name); - recv_BuildIndex(); -} - -void MilvusServiceClient::send_BuildIndex(const std::string& table_name) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("BuildIndex", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_BuildIndex_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_BuildIndex() -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("BuildIndex") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_BuildIndex_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - throw result.e; - } - return; -} - -void MilvusServiceClient::AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array) -{ - send_AddVector(table_name, record_array); - recv_AddVector(_return); -} - -void MilvusServiceClient::send_AddVector(const std::string& table_name, const std::vector & record_array) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("AddVector", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_AddVector_pargs args; - args.table_name = &table_name; - args.record_array = &record_array; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_AddVector(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("AddVector") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_AddVector_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "AddVector failed: unknown result"); -} - -void MilvusServiceClient::SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - send_SearchVector(table_name, query_record_array, query_range_array, topk); - recv_SearchVector(_return); -} - -void MilvusServiceClient::send_SearchVector(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("SearchVector", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVector_pargs args; - args.table_name = &table_name; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_SearchVector(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVector") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_SearchVector_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector failed: unknown result"); -} - -void MilvusServiceClient::SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - send_SearchVector2(table_name, query_record_array, query_range_array, topk); - recv_SearchVector2(_return); -} - -void MilvusServiceClient::send_SearchVector2(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVector2_pargs args; - args.table_name = &table_name; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_SearchVector2(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVector2") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_SearchVector2_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector2 failed: unknown result"); -} - -void MilvusServiceClient::SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - send_SearchVectorInFiles(table_name, file_id_array, query_record_array, query_range_array, topk); - recv_SearchVectorInFiles(_return); -} - -void MilvusServiceClient::send_SearchVectorInFiles(const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("SearchVectorInFiles", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVectorInFiles_pargs args; - args.table_name = &table_name; - args.file_id_array = &file_id_array; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_SearchVectorInFiles(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVectorInFiles") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_SearchVectorInFiles_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVectorInFiles failed: unknown result"); -} - -void MilvusServiceClient::DescribeTable(TableSchema& _return, const std::string& table_name) -{ - send_DescribeTable(table_name); - recv_DescribeTable(_return); -} - -void MilvusServiceClient::send_DescribeTable(const std::string& table_name) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("DescribeTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_DescribeTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_DescribeTable(TableSchema& _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("DescribeTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_DescribeTable_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "DescribeTable failed: unknown result"); -} - -int64_t MilvusServiceClient::GetTableRowCount(const std::string& table_name) -{ - send_GetTableRowCount(table_name); - return recv_GetTableRowCount(); -} - -void MilvusServiceClient::send_GetTableRowCount(const std::string& table_name) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("GetTableRowCount", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_GetTableRowCount_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -int64_t MilvusServiceClient::recv_GetTableRowCount() -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("GetTableRowCount") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - int64_t _return; - MilvusService_GetTableRowCount_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - return _return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetTableRowCount failed: unknown result"); -} - -void MilvusServiceClient::ShowTables(std::vector & _return) -{ - send_ShowTables(); - recv_ShowTables(_return); -} - -void MilvusServiceClient::send_ShowTables() -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("ShowTables", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_ShowTables_pargs args; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_ShowTables(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("ShowTables") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_ShowTables_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "ShowTables failed: unknown result"); -} - -void MilvusServiceClient::Ping(std::string& _return, const std::string& cmd) -{ - send_Ping(cmd); - recv_Ping(_return); -} - -void MilvusServiceClient::send_Ping(const std::string& cmd) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("Ping", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_Ping_pargs args; - args.cmd = &cmd; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void MilvusServiceClient::recv_Ping(std::string& _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("Ping") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - MilvusService_Ping_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - if (result.__isset.e) { - throw result.e; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Ping failed: unknown result"); -} - -bool MilvusServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { - ProcessMap::iterator pfn; - pfn = processMap_.find(fname); - if (pfn == processMap_.end()) { - iprot->skip(::apache::thrift::protocol::T_STRUCT); - iprot->readMessageEnd(); - iprot->getTransport()->readEnd(); - ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); - oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return true; - } - (this->*(pfn->second))(seqid, iprot, oprot, callContext); - return true; -} - -void MilvusServiceProcessor::process_CreateTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.CreateTable", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.CreateTable"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.CreateTable"); - } - - MilvusService_CreateTable_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.CreateTable", bytes); - } - - MilvusService_CreateTable_result result; - try { - iface_->CreateTable(args.param); - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.CreateTable"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("CreateTable", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.CreateTable"); - } - - oprot->writeMessageBegin("CreateTable", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.CreateTable", bytes); - } -} - -void MilvusServiceProcessor::process_HasTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.HasTable", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.HasTable"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.HasTable"); - } - - MilvusService_HasTable_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.HasTable", bytes); - } - - MilvusService_HasTable_result result; - try { - result.success = iface_->HasTable(args.table_name); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.HasTable"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("HasTable", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.HasTable"); - } - - oprot->writeMessageBegin("HasTable", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.HasTable", bytes); - } -} - -void MilvusServiceProcessor::process_DeleteTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.DeleteTable", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.DeleteTable"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.DeleteTable"); - } - - MilvusService_DeleteTable_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.DeleteTable", bytes); - } - - MilvusService_DeleteTable_result result; - try { - iface_->DeleteTable(args.table_name); - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.DeleteTable"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("DeleteTable", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.DeleteTable"); - } - - oprot->writeMessageBegin("DeleteTable", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.DeleteTable", bytes); - } -} - -void MilvusServiceProcessor::process_BuildIndex(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.BuildIndex", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.BuildIndex"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.BuildIndex"); - } - - MilvusService_BuildIndex_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.BuildIndex", bytes); - } - - MilvusService_BuildIndex_result result; - try { - iface_->BuildIndex(args.table_name); - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.BuildIndex"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("BuildIndex", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.BuildIndex"); - } - - oprot->writeMessageBegin("BuildIndex", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.BuildIndex", bytes); - } -} - -void MilvusServiceProcessor::process_AddVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.AddVector", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.AddVector"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.AddVector"); - } - - MilvusService_AddVector_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.AddVector", bytes); - } - - MilvusService_AddVector_result result; - try { - iface_->AddVector(result.success, args.table_name, args.record_array); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.AddVector"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("AddVector", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.AddVector"); - } - - oprot->writeMessageBegin("AddVector", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.AddVector", bytes); - } -} - -void MilvusServiceProcessor::process_SearchVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.SearchVector", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.SearchVector"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.SearchVector"); - } - - MilvusService_SearchVector_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.SearchVector", bytes); - } - - MilvusService_SearchVector_result result; - try { - iface_->SearchVector(result.success, args.table_name, args.query_record_array, args.query_range_array, args.topk); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.SearchVector"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("SearchVector", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.SearchVector"); - } - - oprot->writeMessageBegin("SearchVector", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.SearchVector", bytes); - } -} - -void MilvusServiceProcessor::process_SearchVector2(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.SearchVector2", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.SearchVector2"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.SearchVector2"); - } - - MilvusService_SearchVector2_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.SearchVector2", bytes); - } - - MilvusService_SearchVector2_result result; - try { - iface_->SearchVector2(result.success, args.table_name, args.query_record_array, args.query_range_array, args.topk); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.SearchVector2"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.SearchVector2"); - } - - oprot->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.SearchVector2", bytes); - } -} - -void MilvusServiceProcessor::process_SearchVectorInFiles(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.SearchVectorInFiles", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.SearchVectorInFiles"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.SearchVectorInFiles"); - } - - MilvusService_SearchVectorInFiles_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.SearchVectorInFiles", bytes); - } - - MilvusService_SearchVectorInFiles_result result; - try { - iface_->SearchVectorInFiles(result.success, args.table_name, args.file_id_array, args.query_record_array, args.query_range_array, args.topk); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.SearchVectorInFiles"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("SearchVectorInFiles", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.SearchVectorInFiles"); - } - - oprot->writeMessageBegin("SearchVectorInFiles", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.SearchVectorInFiles", bytes); - } -} - -void MilvusServiceProcessor::process_DescribeTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.DescribeTable", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.DescribeTable"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.DescribeTable"); - } - - MilvusService_DescribeTable_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.DescribeTable", bytes); - } - - MilvusService_DescribeTable_result result; - try { - iface_->DescribeTable(result.success, args.table_name); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.DescribeTable"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("DescribeTable", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.DescribeTable"); - } - - oprot->writeMessageBegin("DescribeTable", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.DescribeTable", bytes); - } -} - -void MilvusServiceProcessor::process_GetTableRowCount(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.GetTableRowCount", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.GetTableRowCount"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.GetTableRowCount"); - } - - MilvusService_GetTableRowCount_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.GetTableRowCount", bytes); - } - - MilvusService_GetTableRowCount_result result; - try { - result.success = iface_->GetTableRowCount(args.table_name); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.GetTableRowCount"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("GetTableRowCount", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.GetTableRowCount"); - } - - oprot->writeMessageBegin("GetTableRowCount", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.GetTableRowCount", bytes); - } -} - -void MilvusServiceProcessor::process_ShowTables(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.ShowTables", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.ShowTables"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.ShowTables"); - } - - MilvusService_ShowTables_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.ShowTables", bytes); - } - - MilvusService_ShowTables_result result; - try { - iface_->ShowTables(result.success); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.ShowTables"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("ShowTables", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.ShowTables"); - } - - oprot->writeMessageBegin("ShowTables", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.ShowTables", bytes); - } -} - -void MilvusServiceProcessor::process_Ping(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("MilvusService.Ping", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.Ping"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "MilvusService.Ping"); - } - - MilvusService_Ping_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "MilvusService.Ping", bytes); - } - - MilvusService_Ping_result result; - try { - iface_->Ping(result.success, args.cmd); - result.__isset.success = true; - } catch (Exception &e) { - result.e = e; - result.__isset.e = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "MilvusService.Ping"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("Ping", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "MilvusService.Ping"); - } - - oprot->writeMessageBegin("Ping", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "MilvusService.Ping", bytes); - } -} - -::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > MilvusServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { - ::apache::thrift::ReleaseHandler< MilvusServiceIfFactory > cleanup(handlerFactory_); - ::apache::thrift::stdcxx::shared_ptr< MilvusServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new MilvusServiceProcessor(handler)); - return processor; -} - -void MilvusServiceConcurrentClient::CreateTable(const TableSchema& param) -{ - int32_t seqid = send_CreateTable(param); - recv_CreateTable(seqid); -} - -int32_t MilvusServiceConcurrentClient::send_CreateTable(const TableSchema& param) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("CreateTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_CreateTable_pargs args; - args.param = ¶m; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_CreateTable(const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("CreateTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_CreateTable_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - sentry.commit(); - return; - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -bool MilvusServiceConcurrentClient::HasTable(const std::string& table_name) -{ - int32_t seqid = send_HasTable(table_name); - return recv_HasTable(seqid); -} - -int32_t MilvusServiceConcurrentClient::send_HasTable(const std::string& table_name) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("HasTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_HasTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -bool MilvusServiceConcurrentClient::recv_HasTable(const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("HasTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - bool _return; - MilvusService_HasTable_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - sentry.commit(); - return _return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "HasTable failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::DeleteTable(const std::string& table_name) -{ - int32_t seqid = send_DeleteTable(table_name); - recv_DeleteTable(seqid); -} - -int32_t MilvusServiceConcurrentClient::send_DeleteTable(const std::string& table_name) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("DeleteTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_DeleteTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_DeleteTable(const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("DeleteTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_DeleteTable_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - sentry.commit(); - return; - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::BuildIndex(const std::string& table_name) -{ - int32_t seqid = send_BuildIndex(table_name); - recv_BuildIndex(seqid); -} - -int32_t MilvusServiceConcurrentClient::send_BuildIndex(const std::string& table_name) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("BuildIndex", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_BuildIndex_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_BuildIndex(const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("BuildIndex") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_BuildIndex_presult result; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - sentry.commit(); - return; - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array) -{ - int32_t seqid = send_AddVector(table_name, record_array); - recv_AddVector(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_AddVector(const std::string& table_name, const std::vector & record_array) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("AddVector", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_AddVector_pargs args; - args.table_name = &table_name; - args.record_array = &record_array; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_AddVector(std::vector & _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("AddVector") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_AddVector_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "AddVector failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t seqid = send_SearchVector(table_name, query_record_array, query_range_array, topk); - recv_SearchVector(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_SearchVector(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("SearchVector", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVector_pargs args; - args.table_name = &table_name; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_SearchVector(std::vector & _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVector") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_SearchVector_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t seqid = send_SearchVector2(table_name, query_record_array, query_range_array, topk); - recv_SearchVector2(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_SearchVector2(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVector2_pargs args; - args.table_name = &table_name; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_SearchVector2(std::vector & _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVector2") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_SearchVector2_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector2 failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t seqid = send_SearchVectorInFiles(table_name, file_id_array, query_record_array, query_range_array, topk); - recv_SearchVectorInFiles(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_SearchVectorInFiles(const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("SearchVectorInFiles", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_SearchVectorInFiles_pargs args; - args.table_name = &table_name; - args.file_id_array = &file_id_array; - args.query_record_array = &query_record_array; - args.query_range_array = &query_range_array; - args.topk = &topk; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_SearchVectorInFiles(std::vector & _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("SearchVectorInFiles") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_SearchVectorInFiles_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVectorInFiles failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::DescribeTable(TableSchema& _return, const std::string& table_name) -{ - int32_t seqid = send_DescribeTable(table_name); - recv_DescribeTable(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_DescribeTable(const std::string& table_name) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("DescribeTable", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_DescribeTable_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_DescribeTable(TableSchema& _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("DescribeTable") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_DescribeTable_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "DescribeTable failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -int64_t MilvusServiceConcurrentClient::GetTableRowCount(const std::string& table_name) -{ - int32_t seqid = send_GetTableRowCount(table_name); - return recv_GetTableRowCount(seqid); -} - -int32_t MilvusServiceConcurrentClient::send_GetTableRowCount(const std::string& table_name) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("GetTableRowCount", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_GetTableRowCount_pargs args; - args.table_name = &table_name; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -int64_t MilvusServiceConcurrentClient::recv_GetTableRowCount(const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("GetTableRowCount") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - int64_t _return; - MilvusService_GetTableRowCount_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - sentry.commit(); - return _return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetTableRowCount failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::ShowTables(std::vector & _return) -{ - int32_t seqid = send_ShowTables(); - recv_ShowTables(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_ShowTables() -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("ShowTables", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_ShowTables_pargs args; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_ShowTables(std::vector & _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("ShowTables") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_ShowTables_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "ShowTables failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -void MilvusServiceConcurrentClient::Ping(std::string& _return, const std::string& cmd) -{ - int32_t seqid = send_Ping(cmd); - recv_Ping(_return, seqid); -} - -int32_t MilvusServiceConcurrentClient::send_Ping(const std::string& cmd) -{ - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); - oprot_->writeMessageBegin("Ping", ::apache::thrift::protocol::T_CALL, cseqid); - - MilvusService_Ping_pargs args; - args.cmd = &cmd; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); - - sentry.commit(); - return cseqid; -} - -void MilvusServiceConcurrentClient::recv_Ping(std::string& _return, const int32_t seqid) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - // the read mutex gets dropped and reacquired as part of waitForWork() - // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); - - while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { - iprot_->readMessageBegin(fname, mtype, rseqid); - } - if(seqid == rseqid) { - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - sentry.commit(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("Ping") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - // in a bad state, don't commit - using ::apache::thrift::protocol::TProtocolException; - throw TProtocolException(TProtocolException::INVALID_DATA); - } - MilvusService_Ping_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - sentry.commit(); - return; - } - if (result.__isset.e) { - sentry.commit(); - throw result.e; - } - // in a bad state, don't commit - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Ping failed: unknown result"); - } - // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); - - // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); - } // end while(true) -} - -}} // namespace - diff --git a/cpp/src/thrift/gen-cpp/MilvusService.h b/cpp/src/thrift/gen-cpp/MilvusService.h deleted file mode 100644 index c18a33009a..0000000000 --- a/cpp/src/thrift/gen-cpp/MilvusService.h +++ /dev/null @@ -1,1972 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef MilvusService_H -#define MilvusService_H - -#include -#include -#include "milvus_types.h" - -namespace milvus { namespace thrift { - -#ifdef _MSC_VER - #pragma warning( push ) - #pragma warning (disable : 4250 ) //inheriting methods via dominance -#endif - -class MilvusServiceIf { - public: - virtual ~MilvusServiceIf() {} - - /** - * @brief Create table method - * - * This method is used to create table - * - * @param param, use to provide table information to be created. - * - * - * @param param - */ - virtual void CreateTable(const TableSchema& param) = 0; - - /** - * @brief Test table existence method - * - * This method is used to test table existence. - * - * @param table_name, table name is going to be tested. - * - * - * @param table_name - */ - virtual bool HasTable(const std::string& table_name) = 0; - - /** - * @brief Delete table method - * - * This method is used to delete table. - * - * @param table_name, table name is going to be deleted. - * - * - * @param table_name - */ - virtual void DeleteTable(const std::string& table_name) = 0; - - /** - * @brief Build index by table method - * - * This method is used to build index by table in sync mode. - * - * @param table_name, table is going to be built index. - * - * - * @param table_name - */ - virtual void BuildIndex(const std::string& table_name) = 0; - - /** - * @brief Add vector array to table - * - * This method is used to add vector array to table. - * - * @param table_name, table_name is inserted. - * @param record_array, vector array is inserted. - * - * @return vector id array - * - * @param table_name - * @param record_array - */ - virtual void AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array) = 0; - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - virtual void SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) = 0; - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query binary result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - virtual void SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) = 0; - - /** - * @brief Internal use query interface - * - * This method is used to query vector in specified files. - * - * @param file_id_array, specified files id array, queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param table_name - * @param file_id_array - * @param query_record_array - * @param query_range_array - * @param topk - */ - virtual void SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) = 0; - - /** - * @brief Get table schema - * - * This method is used to get table schema. - * - * @param table_name, target table name. - * - * @return table schema - * - * @param table_name - */ - virtual void DescribeTable(TableSchema& _return, const std::string& table_name) = 0; - - /** - * @brief Get table row count - * - * This method is used to get table row count. - * - * @param table_name, target table name. - * - * @return table row count - * - * @param table_name - */ - virtual int64_t GetTableRowCount(const std::string& table_name) = 0; - - /** - * @brief List all tables in database - * - * This method is used to list all tables. - * - * - * @return table names. - */ - virtual void ShowTables(std::vector & _return) = 0; - - /** - * @brief Give the server status - * - * This method is used to give the server status. - * - * @return Server status. - * - * @param cmd - */ - virtual void Ping(std::string& _return, const std::string& cmd) = 0; -}; - -class MilvusServiceIfFactory { - public: - typedef MilvusServiceIf Handler; - - virtual ~MilvusServiceIfFactory() {} - - virtual MilvusServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; - virtual void releaseHandler(MilvusServiceIf* /* handler */) = 0; -}; - -class MilvusServiceIfSingletonFactory : virtual public MilvusServiceIfFactory { - public: - MilvusServiceIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} - virtual ~MilvusServiceIfSingletonFactory() {} - - virtual MilvusServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(MilvusServiceIf* /* handler */) {} - - protected: - ::apache::thrift::stdcxx::shared_ptr iface_; -}; - -class MilvusServiceNull : virtual public MilvusServiceIf { - public: - virtual ~MilvusServiceNull() {} - void CreateTable(const TableSchema& /* param */) { - return; - } - bool HasTable(const std::string& /* table_name */) { - bool _return = false; - return _return; - } - void DeleteTable(const std::string& /* table_name */) { - return; - } - void BuildIndex(const std::string& /* table_name */) { - return; - } - void AddVector(std::vector & /* _return */, const std::string& /* table_name */, const std::vector & /* record_array */) { - return; - } - void SearchVector(std::vector & /* _return */, const std::string& /* table_name */, const std::vector & /* query_record_array */, const std::vector & /* query_range_array */, const int64_t /* topk */) { - return; - } - void SearchVector2(std::vector & /* _return */, const std::string& /* table_name */, const std::vector & /* query_record_array */, const std::vector & /* query_range_array */, const int64_t /* topk */) { - return; - } - void SearchVectorInFiles(std::vector & /* _return */, const std::string& /* table_name */, const std::vector & /* file_id_array */, const std::vector & /* query_record_array */, const std::vector & /* query_range_array */, const int64_t /* topk */) { - return; - } - void DescribeTable(TableSchema& /* _return */, const std::string& /* table_name */) { - return; - } - int64_t GetTableRowCount(const std::string& /* table_name */) { - int64_t _return = 0; - return _return; - } - void ShowTables(std::vector & /* _return */) { - return; - } - void Ping(std::string& /* _return */, const std::string& /* cmd */) { - return; - } -}; - -typedef struct _MilvusService_CreateTable_args__isset { - _MilvusService_CreateTable_args__isset() : param(false) {} - bool param :1; -} _MilvusService_CreateTable_args__isset; - -class MilvusService_CreateTable_args { - public: - - MilvusService_CreateTable_args(const MilvusService_CreateTable_args&); - MilvusService_CreateTable_args& operator=(const MilvusService_CreateTable_args&); - MilvusService_CreateTable_args() { - } - - virtual ~MilvusService_CreateTable_args() throw(); - TableSchema param; - - _MilvusService_CreateTable_args__isset __isset; - - void __set_param(const TableSchema& val); - - bool operator == (const MilvusService_CreateTable_args & rhs) const - { - if (!(param == rhs.param)) - return false; - return true; - } - bool operator != (const MilvusService_CreateTable_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_CreateTable_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_CreateTable_pargs { - public: - - - virtual ~MilvusService_CreateTable_pargs() throw(); - const TableSchema* param; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_CreateTable_result__isset { - _MilvusService_CreateTable_result__isset() : e(false) {} - bool e :1; -} _MilvusService_CreateTable_result__isset; - -class MilvusService_CreateTable_result { - public: - - MilvusService_CreateTable_result(const MilvusService_CreateTable_result&); - MilvusService_CreateTable_result& operator=(const MilvusService_CreateTable_result&); - MilvusService_CreateTable_result() { - } - - virtual ~MilvusService_CreateTable_result() throw(); - Exception e; - - _MilvusService_CreateTable_result__isset __isset; - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_CreateTable_result & rhs) const - { - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_CreateTable_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_CreateTable_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_CreateTable_presult__isset { - _MilvusService_CreateTable_presult__isset() : e(false) {} - bool e :1; -} _MilvusService_CreateTable_presult__isset; - -class MilvusService_CreateTable_presult { - public: - - - virtual ~MilvusService_CreateTable_presult() throw(); - Exception e; - - _MilvusService_CreateTable_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_HasTable_args__isset { - _MilvusService_HasTable_args__isset() : table_name(false) {} - bool table_name :1; -} _MilvusService_HasTable_args__isset; - -class MilvusService_HasTable_args { - public: - - MilvusService_HasTable_args(const MilvusService_HasTable_args&); - MilvusService_HasTable_args& operator=(const MilvusService_HasTable_args&); - MilvusService_HasTable_args() : table_name() { - } - - virtual ~MilvusService_HasTable_args() throw(); - std::string table_name; - - _MilvusService_HasTable_args__isset __isset; - - void __set_table_name(const std::string& val); - - bool operator == (const MilvusService_HasTable_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - return true; - } - bool operator != (const MilvusService_HasTable_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_HasTable_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_HasTable_pargs { - public: - - - virtual ~MilvusService_HasTable_pargs() throw(); - const std::string* table_name; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_HasTable_result__isset { - _MilvusService_HasTable_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_HasTable_result__isset; - -class MilvusService_HasTable_result { - public: - - MilvusService_HasTable_result(const MilvusService_HasTable_result&); - MilvusService_HasTable_result& operator=(const MilvusService_HasTable_result&); - MilvusService_HasTable_result() : success(0) { - } - - virtual ~MilvusService_HasTable_result() throw(); - bool success; - Exception e; - - _MilvusService_HasTable_result__isset __isset; - - void __set_success(const bool val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_HasTable_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_HasTable_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_HasTable_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_HasTable_presult__isset { - _MilvusService_HasTable_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_HasTable_presult__isset; - -class MilvusService_HasTable_presult { - public: - - - virtual ~MilvusService_HasTable_presult() throw(); - bool* success; - Exception e; - - _MilvusService_HasTable_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_DeleteTable_args__isset { - _MilvusService_DeleteTable_args__isset() : table_name(false) {} - bool table_name :1; -} _MilvusService_DeleteTable_args__isset; - -class MilvusService_DeleteTable_args { - public: - - MilvusService_DeleteTable_args(const MilvusService_DeleteTable_args&); - MilvusService_DeleteTable_args& operator=(const MilvusService_DeleteTable_args&); - MilvusService_DeleteTable_args() : table_name() { - } - - virtual ~MilvusService_DeleteTable_args() throw(); - std::string table_name; - - _MilvusService_DeleteTable_args__isset __isset; - - void __set_table_name(const std::string& val); - - bool operator == (const MilvusService_DeleteTable_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - return true; - } - bool operator != (const MilvusService_DeleteTable_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_DeleteTable_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_DeleteTable_pargs { - public: - - - virtual ~MilvusService_DeleteTable_pargs() throw(); - const std::string* table_name; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_DeleteTable_result__isset { - _MilvusService_DeleteTable_result__isset() : e(false) {} - bool e :1; -} _MilvusService_DeleteTable_result__isset; - -class MilvusService_DeleteTable_result { - public: - - MilvusService_DeleteTable_result(const MilvusService_DeleteTable_result&); - MilvusService_DeleteTable_result& operator=(const MilvusService_DeleteTable_result&); - MilvusService_DeleteTable_result() { - } - - virtual ~MilvusService_DeleteTable_result() throw(); - Exception e; - - _MilvusService_DeleteTable_result__isset __isset; - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_DeleteTable_result & rhs) const - { - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_DeleteTable_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_DeleteTable_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_DeleteTable_presult__isset { - _MilvusService_DeleteTable_presult__isset() : e(false) {} - bool e :1; -} _MilvusService_DeleteTable_presult__isset; - -class MilvusService_DeleteTable_presult { - public: - - - virtual ~MilvusService_DeleteTable_presult() throw(); - Exception e; - - _MilvusService_DeleteTable_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_BuildIndex_args__isset { - _MilvusService_BuildIndex_args__isset() : table_name(false) {} - bool table_name :1; -} _MilvusService_BuildIndex_args__isset; - -class MilvusService_BuildIndex_args { - public: - - MilvusService_BuildIndex_args(const MilvusService_BuildIndex_args&); - MilvusService_BuildIndex_args& operator=(const MilvusService_BuildIndex_args&); - MilvusService_BuildIndex_args() : table_name() { - } - - virtual ~MilvusService_BuildIndex_args() throw(); - std::string table_name; - - _MilvusService_BuildIndex_args__isset __isset; - - void __set_table_name(const std::string& val); - - bool operator == (const MilvusService_BuildIndex_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - return true; - } - bool operator != (const MilvusService_BuildIndex_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_BuildIndex_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_BuildIndex_pargs { - public: - - - virtual ~MilvusService_BuildIndex_pargs() throw(); - const std::string* table_name; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_BuildIndex_result__isset { - _MilvusService_BuildIndex_result__isset() : e(false) {} - bool e :1; -} _MilvusService_BuildIndex_result__isset; - -class MilvusService_BuildIndex_result { - public: - - MilvusService_BuildIndex_result(const MilvusService_BuildIndex_result&); - MilvusService_BuildIndex_result& operator=(const MilvusService_BuildIndex_result&); - MilvusService_BuildIndex_result() { - } - - virtual ~MilvusService_BuildIndex_result() throw(); - Exception e; - - _MilvusService_BuildIndex_result__isset __isset; - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_BuildIndex_result & rhs) const - { - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_BuildIndex_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_BuildIndex_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_BuildIndex_presult__isset { - _MilvusService_BuildIndex_presult__isset() : e(false) {} - bool e :1; -} _MilvusService_BuildIndex_presult__isset; - -class MilvusService_BuildIndex_presult { - public: - - - virtual ~MilvusService_BuildIndex_presult() throw(); - Exception e; - - _MilvusService_BuildIndex_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_AddVector_args__isset { - _MilvusService_AddVector_args__isset() : table_name(false), record_array(false) {} - bool table_name :1; - bool record_array :1; -} _MilvusService_AddVector_args__isset; - -class MilvusService_AddVector_args { - public: - - MilvusService_AddVector_args(const MilvusService_AddVector_args&); - MilvusService_AddVector_args& operator=(const MilvusService_AddVector_args&); - MilvusService_AddVector_args() : table_name() { - } - - virtual ~MilvusService_AddVector_args() throw(); - std::string table_name; - std::vector record_array; - - _MilvusService_AddVector_args__isset __isset; - - void __set_table_name(const std::string& val); - - void __set_record_array(const std::vector & val); - - bool operator == (const MilvusService_AddVector_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - if (!(record_array == rhs.record_array)) - return false; - return true; - } - bool operator != (const MilvusService_AddVector_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_AddVector_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_AddVector_pargs { - public: - - - virtual ~MilvusService_AddVector_pargs() throw(); - const std::string* table_name; - const std::vector * record_array; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_AddVector_result__isset { - _MilvusService_AddVector_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_AddVector_result__isset; - -class MilvusService_AddVector_result { - public: - - MilvusService_AddVector_result(const MilvusService_AddVector_result&); - MilvusService_AddVector_result& operator=(const MilvusService_AddVector_result&); - MilvusService_AddVector_result() { - } - - virtual ~MilvusService_AddVector_result() throw(); - std::vector success; - Exception e; - - _MilvusService_AddVector_result__isset __isset; - - void __set_success(const std::vector & val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_AddVector_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_AddVector_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_AddVector_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_AddVector_presult__isset { - _MilvusService_AddVector_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_AddVector_presult__isset; - -class MilvusService_AddVector_presult { - public: - - - virtual ~MilvusService_AddVector_presult() throw(); - std::vector * success; - Exception e; - - _MilvusService_AddVector_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_SearchVector_args__isset { - _MilvusService_SearchVector_args__isset() : table_name(false), query_record_array(false), query_range_array(false), topk(false) {} - bool table_name :1; - bool query_record_array :1; - bool query_range_array :1; - bool topk :1; -} _MilvusService_SearchVector_args__isset; - -class MilvusService_SearchVector_args { - public: - - MilvusService_SearchVector_args(const MilvusService_SearchVector_args&); - MilvusService_SearchVector_args& operator=(const MilvusService_SearchVector_args&); - MilvusService_SearchVector_args() : table_name(), topk(0) { - } - - virtual ~MilvusService_SearchVector_args() throw(); - std::string table_name; - std::vector query_record_array; - std::vector query_range_array; - int64_t topk; - - _MilvusService_SearchVector_args__isset __isset; - - void __set_table_name(const std::string& val); - - void __set_query_record_array(const std::vector & val); - - void __set_query_range_array(const std::vector & val); - - void __set_topk(const int64_t val); - - bool operator == (const MilvusService_SearchVector_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - if (!(query_record_array == rhs.query_record_array)) - return false; - if (!(query_range_array == rhs.query_range_array)) - return false; - if (!(topk == rhs.topk)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVector_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVector_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_SearchVector_pargs { - public: - - - virtual ~MilvusService_SearchVector_pargs() throw(); - const std::string* table_name; - const std::vector * query_record_array; - const std::vector * query_range_array; - const int64_t* topk; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVector_result__isset { - _MilvusService_SearchVector_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVector_result__isset; - -class MilvusService_SearchVector_result { - public: - - MilvusService_SearchVector_result(const MilvusService_SearchVector_result&); - MilvusService_SearchVector_result& operator=(const MilvusService_SearchVector_result&); - MilvusService_SearchVector_result() { - } - - virtual ~MilvusService_SearchVector_result() throw(); - std::vector success; - Exception e; - - _MilvusService_SearchVector_result__isset __isset; - - void __set_success(const std::vector & val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_SearchVector_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVector_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVector_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVector_presult__isset { - _MilvusService_SearchVector_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVector_presult__isset; - -class MilvusService_SearchVector_presult { - public: - - - virtual ~MilvusService_SearchVector_presult() throw(); - std::vector * success; - Exception e; - - _MilvusService_SearchVector_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_SearchVector2_args__isset { - _MilvusService_SearchVector2_args__isset() : table_name(false), query_record_array(false), query_range_array(false), topk(false) {} - bool table_name :1; - bool query_record_array :1; - bool query_range_array :1; - bool topk :1; -} _MilvusService_SearchVector2_args__isset; - -class MilvusService_SearchVector2_args { - public: - - MilvusService_SearchVector2_args(const MilvusService_SearchVector2_args&); - MilvusService_SearchVector2_args& operator=(const MilvusService_SearchVector2_args&); - MilvusService_SearchVector2_args() : table_name(), topk(0) { - } - - virtual ~MilvusService_SearchVector2_args() throw(); - std::string table_name; - std::vector query_record_array; - std::vector query_range_array; - int64_t topk; - - _MilvusService_SearchVector2_args__isset __isset; - - void __set_table_name(const std::string& val); - - void __set_query_record_array(const std::vector & val); - - void __set_query_range_array(const std::vector & val); - - void __set_topk(const int64_t val); - - bool operator == (const MilvusService_SearchVector2_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - if (!(query_record_array == rhs.query_record_array)) - return false; - if (!(query_range_array == rhs.query_range_array)) - return false; - if (!(topk == rhs.topk)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVector2_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVector2_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_SearchVector2_pargs { - public: - - - virtual ~MilvusService_SearchVector2_pargs() throw(); - const std::string* table_name; - const std::vector * query_record_array; - const std::vector * query_range_array; - const int64_t* topk; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVector2_result__isset { - _MilvusService_SearchVector2_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVector2_result__isset; - -class MilvusService_SearchVector2_result { - public: - - MilvusService_SearchVector2_result(const MilvusService_SearchVector2_result&); - MilvusService_SearchVector2_result& operator=(const MilvusService_SearchVector2_result&); - MilvusService_SearchVector2_result() { - } - - virtual ~MilvusService_SearchVector2_result() throw(); - std::vector success; - Exception e; - - _MilvusService_SearchVector2_result__isset __isset; - - void __set_success(const std::vector & val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_SearchVector2_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVector2_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVector2_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVector2_presult__isset { - _MilvusService_SearchVector2_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVector2_presult__isset; - -class MilvusService_SearchVector2_presult { - public: - - - virtual ~MilvusService_SearchVector2_presult() throw(); - std::vector * success; - Exception e; - - _MilvusService_SearchVector2_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_SearchVectorInFiles_args__isset { - _MilvusService_SearchVectorInFiles_args__isset() : table_name(false), file_id_array(false), query_record_array(false), query_range_array(false), topk(false) {} - bool table_name :1; - bool file_id_array :1; - bool query_record_array :1; - bool query_range_array :1; - bool topk :1; -} _MilvusService_SearchVectorInFiles_args__isset; - -class MilvusService_SearchVectorInFiles_args { - public: - - MilvusService_SearchVectorInFiles_args(const MilvusService_SearchVectorInFiles_args&); - MilvusService_SearchVectorInFiles_args& operator=(const MilvusService_SearchVectorInFiles_args&); - MilvusService_SearchVectorInFiles_args() : table_name(), topk(0) { - } - - virtual ~MilvusService_SearchVectorInFiles_args() throw(); - std::string table_name; - std::vector file_id_array; - std::vector query_record_array; - std::vector query_range_array; - int64_t topk; - - _MilvusService_SearchVectorInFiles_args__isset __isset; - - void __set_table_name(const std::string& val); - - void __set_file_id_array(const std::vector & val); - - void __set_query_record_array(const std::vector & val); - - void __set_query_range_array(const std::vector & val); - - void __set_topk(const int64_t val); - - bool operator == (const MilvusService_SearchVectorInFiles_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - if (!(file_id_array == rhs.file_id_array)) - return false; - if (!(query_record_array == rhs.query_record_array)) - return false; - if (!(query_range_array == rhs.query_range_array)) - return false; - if (!(topk == rhs.topk)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVectorInFiles_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVectorInFiles_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_SearchVectorInFiles_pargs { - public: - - - virtual ~MilvusService_SearchVectorInFiles_pargs() throw(); - const std::string* table_name; - const std::vector * file_id_array; - const std::vector * query_record_array; - const std::vector * query_range_array; - const int64_t* topk; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVectorInFiles_result__isset { - _MilvusService_SearchVectorInFiles_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVectorInFiles_result__isset; - -class MilvusService_SearchVectorInFiles_result { - public: - - MilvusService_SearchVectorInFiles_result(const MilvusService_SearchVectorInFiles_result&); - MilvusService_SearchVectorInFiles_result& operator=(const MilvusService_SearchVectorInFiles_result&); - MilvusService_SearchVectorInFiles_result() { - } - - virtual ~MilvusService_SearchVectorInFiles_result() throw(); - std::vector success; - Exception e; - - _MilvusService_SearchVectorInFiles_result__isset __isset; - - void __set_success(const std::vector & val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_SearchVectorInFiles_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_SearchVectorInFiles_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_SearchVectorInFiles_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_SearchVectorInFiles_presult__isset { - _MilvusService_SearchVectorInFiles_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_SearchVectorInFiles_presult__isset; - -class MilvusService_SearchVectorInFiles_presult { - public: - - - virtual ~MilvusService_SearchVectorInFiles_presult() throw(); - std::vector * success; - Exception e; - - _MilvusService_SearchVectorInFiles_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_DescribeTable_args__isset { - _MilvusService_DescribeTable_args__isset() : table_name(false) {} - bool table_name :1; -} _MilvusService_DescribeTable_args__isset; - -class MilvusService_DescribeTable_args { - public: - - MilvusService_DescribeTable_args(const MilvusService_DescribeTable_args&); - MilvusService_DescribeTable_args& operator=(const MilvusService_DescribeTable_args&); - MilvusService_DescribeTable_args() : table_name() { - } - - virtual ~MilvusService_DescribeTable_args() throw(); - std::string table_name; - - _MilvusService_DescribeTable_args__isset __isset; - - void __set_table_name(const std::string& val); - - bool operator == (const MilvusService_DescribeTable_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - return true; - } - bool operator != (const MilvusService_DescribeTable_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_DescribeTable_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_DescribeTable_pargs { - public: - - - virtual ~MilvusService_DescribeTable_pargs() throw(); - const std::string* table_name; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_DescribeTable_result__isset { - _MilvusService_DescribeTable_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_DescribeTable_result__isset; - -class MilvusService_DescribeTable_result { - public: - - MilvusService_DescribeTable_result(const MilvusService_DescribeTable_result&); - MilvusService_DescribeTable_result& operator=(const MilvusService_DescribeTable_result&); - MilvusService_DescribeTable_result() { - } - - virtual ~MilvusService_DescribeTable_result() throw(); - TableSchema success; - Exception e; - - _MilvusService_DescribeTable_result__isset __isset; - - void __set_success(const TableSchema& val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_DescribeTable_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_DescribeTable_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_DescribeTable_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_DescribeTable_presult__isset { - _MilvusService_DescribeTable_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_DescribeTable_presult__isset; - -class MilvusService_DescribeTable_presult { - public: - - - virtual ~MilvusService_DescribeTable_presult() throw(); - TableSchema* success; - Exception e; - - _MilvusService_DescribeTable_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_GetTableRowCount_args__isset { - _MilvusService_GetTableRowCount_args__isset() : table_name(false) {} - bool table_name :1; -} _MilvusService_GetTableRowCount_args__isset; - -class MilvusService_GetTableRowCount_args { - public: - - MilvusService_GetTableRowCount_args(const MilvusService_GetTableRowCount_args&); - MilvusService_GetTableRowCount_args& operator=(const MilvusService_GetTableRowCount_args&); - MilvusService_GetTableRowCount_args() : table_name() { - } - - virtual ~MilvusService_GetTableRowCount_args() throw(); - std::string table_name; - - _MilvusService_GetTableRowCount_args__isset __isset; - - void __set_table_name(const std::string& val); - - bool operator == (const MilvusService_GetTableRowCount_args & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - return true; - } - bool operator != (const MilvusService_GetTableRowCount_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_GetTableRowCount_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_GetTableRowCount_pargs { - public: - - - virtual ~MilvusService_GetTableRowCount_pargs() throw(); - const std::string* table_name; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_GetTableRowCount_result__isset { - _MilvusService_GetTableRowCount_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_GetTableRowCount_result__isset; - -class MilvusService_GetTableRowCount_result { - public: - - MilvusService_GetTableRowCount_result(const MilvusService_GetTableRowCount_result&); - MilvusService_GetTableRowCount_result& operator=(const MilvusService_GetTableRowCount_result&); - MilvusService_GetTableRowCount_result() : success(0) { - } - - virtual ~MilvusService_GetTableRowCount_result() throw(); - int64_t success; - Exception e; - - _MilvusService_GetTableRowCount_result__isset __isset; - - void __set_success(const int64_t val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_GetTableRowCount_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_GetTableRowCount_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_GetTableRowCount_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_GetTableRowCount_presult__isset { - _MilvusService_GetTableRowCount_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_GetTableRowCount_presult__isset; - -class MilvusService_GetTableRowCount_presult { - public: - - - virtual ~MilvusService_GetTableRowCount_presult() throw(); - int64_t* success; - Exception e; - - _MilvusService_GetTableRowCount_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - - -class MilvusService_ShowTables_args { - public: - - MilvusService_ShowTables_args(const MilvusService_ShowTables_args&); - MilvusService_ShowTables_args& operator=(const MilvusService_ShowTables_args&); - MilvusService_ShowTables_args() { - } - - virtual ~MilvusService_ShowTables_args() throw(); - - bool operator == (const MilvusService_ShowTables_args & /* rhs */) const - { - return true; - } - bool operator != (const MilvusService_ShowTables_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_ShowTables_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_ShowTables_pargs { - public: - - - virtual ~MilvusService_ShowTables_pargs() throw(); - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_ShowTables_result__isset { - _MilvusService_ShowTables_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_ShowTables_result__isset; - -class MilvusService_ShowTables_result { - public: - - MilvusService_ShowTables_result(const MilvusService_ShowTables_result&); - MilvusService_ShowTables_result& operator=(const MilvusService_ShowTables_result&); - MilvusService_ShowTables_result() { - } - - virtual ~MilvusService_ShowTables_result() throw(); - std::vector success; - Exception e; - - _MilvusService_ShowTables_result__isset __isset; - - void __set_success(const std::vector & val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_ShowTables_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_ShowTables_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_ShowTables_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_ShowTables_presult__isset { - _MilvusService_ShowTables_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_ShowTables_presult__isset; - -class MilvusService_ShowTables_presult { - public: - - - virtual ~MilvusService_ShowTables_presult() throw(); - std::vector * success; - Exception e; - - _MilvusService_ShowTables_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -typedef struct _MilvusService_Ping_args__isset { - _MilvusService_Ping_args__isset() : cmd(false) {} - bool cmd :1; -} _MilvusService_Ping_args__isset; - -class MilvusService_Ping_args { - public: - - MilvusService_Ping_args(const MilvusService_Ping_args&); - MilvusService_Ping_args& operator=(const MilvusService_Ping_args&); - MilvusService_Ping_args() : cmd() { - } - - virtual ~MilvusService_Ping_args() throw(); - std::string cmd; - - _MilvusService_Ping_args__isset __isset; - - void __set_cmd(const std::string& val); - - bool operator == (const MilvusService_Ping_args & rhs) const - { - if (!(cmd == rhs.cmd)) - return false; - return true; - } - bool operator != (const MilvusService_Ping_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_Ping_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class MilvusService_Ping_pargs { - public: - - - virtual ~MilvusService_Ping_pargs() throw(); - const std::string* cmd; - - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_Ping_result__isset { - _MilvusService_Ping_result__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_Ping_result__isset; - -class MilvusService_Ping_result { - public: - - MilvusService_Ping_result(const MilvusService_Ping_result&); - MilvusService_Ping_result& operator=(const MilvusService_Ping_result&); - MilvusService_Ping_result() : success() { - } - - virtual ~MilvusService_Ping_result() throw(); - std::string success; - Exception e; - - _MilvusService_Ping_result__isset __isset; - - void __set_success(const std::string& val); - - void __set_e(const Exception& val); - - bool operator == (const MilvusService_Ping_result & rhs) const - { - if (!(success == rhs.success)) - return false; - if (!(e == rhs.e)) - return false; - return true; - } - bool operator != (const MilvusService_Ping_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const MilvusService_Ping_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -typedef struct _MilvusService_Ping_presult__isset { - _MilvusService_Ping_presult__isset() : success(false), e(false) {} - bool success :1; - bool e :1; -} _MilvusService_Ping_presult__isset; - -class MilvusService_Ping_presult { - public: - - - virtual ~MilvusService_Ping_presult() throw(); - std::string* success; - Exception e; - - _MilvusService_Ping_presult__isset __isset; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - -}; - -class MilvusServiceClient : virtual public MilvusServiceIf { - public: - MilvusServiceClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { - setProtocol(prot); - } - MilvusServiceClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - setProtocol(iprot,oprot); - } - private: - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { - setProtocol(prot,prot); - } - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - piprot_=iprot; - poprot_=oprot; - iprot_ = iprot.get(); - oprot_ = oprot.get(); - } - public: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { - return piprot_; - } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { - return poprot_; - } - void CreateTable(const TableSchema& param); - void send_CreateTable(const TableSchema& param); - void recv_CreateTable(); - bool HasTable(const std::string& table_name); - void send_HasTable(const std::string& table_name); - bool recv_HasTable(); - void DeleteTable(const std::string& table_name); - void send_DeleteTable(const std::string& table_name); - void recv_DeleteTable(); - void BuildIndex(const std::string& table_name); - void send_BuildIndex(const std::string& table_name); - void recv_BuildIndex(); - void AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array); - void send_AddVector(const std::string& table_name, const std::vector & record_array); - void recv_AddVector(std::vector & _return); - void SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void send_SearchVector(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVector(std::vector & _return); - void SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void send_SearchVector2(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVector2(std::vector & _return); - void SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void send_SearchVectorInFiles(const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVectorInFiles(std::vector & _return); - void DescribeTable(TableSchema& _return, const std::string& table_name); - void send_DescribeTable(const std::string& table_name); - void recv_DescribeTable(TableSchema& _return); - int64_t GetTableRowCount(const std::string& table_name); - void send_GetTableRowCount(const std::string& table_name); - int64_t recv_GetTableRowCount(); - void ShowTables(std::vector & _return); - void send_ShowTables(); - void recv_ShowTables(std::vector & _return); - void Ping(std::string& _return, const std::string& cmd); - void send_Ping(const std::string& cmd); - void recv_Ping(std::string& _return); - protected: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; - ::apache::thrift::protocol::TProtocol* iprot_; - ::apache::thrift::protocol::TProtocol* oprot_; -}; - -class MilvusServiceProcessor : public ::apache::thrift::TDispatchProcessor { - protected: - ::apache::thrift::stdcxx::shared_ptr iface_; - virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); - private: - typedef void (MilvusServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); - typedef std::map ProcessMap; - ProcessMap processMap_; - void process_CreateTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_HasTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_DeleteTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_BuildIndex(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_AddVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_SearchVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_SearchVector2(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_SearchVectorInFiles(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_DescribeTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_GetTableRowCount(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_ShowTables(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_Ping(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - public: - MilvusServiceProcessor(::apache::thrift::stdcxx::shared_ptr iface) : - iface_(iface) { - processMap_["CreateTable"] = &MilvusServiceProcessor::process_CreateTable; - processMap_["HasTable"] = &MilvusServiceProcessor::process_HasTable; - processMap_["DeleteTable"] = &MilvusServiceProcessor::process_DeleteTable; - processMap_["BuildIndex"] = &MilvusServiceProcessor::process_BuildIndex; - processMap_["AddVector"] = &MilvusServiceProcessor::process_AddVector; - processMap_["SearchVector"] = &MilvusServiceProcessor::process_SearchVector; - processMap_["SearchVector2"] = &MilvusServiceProcessor::process_SearchVector2; - processMap_["SearchVectorInFiles"] = &MilvusServiceProcessor::process_SearchVectorInFiles; - processMap_["DescribeTable"] = &MilvusServiceProcessor::process_DescribeTable; - processMap_["GetTableRowCount"] = &MilvusServiceProcessor::process_GetTableRowCount; - processMap_["ShowTables"] = &MilvusServiceProcessor::process_ShowTables; - processMap_["Ping"] = &MilvusServiceProcessor::process_Ping; - } - - virtual ~MilvusServiceProcessor() {} -}; - -class MilvusServiceProcessorFactory : public ::apache::thrift::TProcessorFactory { - public: - MilvusServiceProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< MilvusServiceIfFactory >& handlerFactory) : - handlerFactory_(handlerFactory) {} - - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); - - protected: - ::apache::thrift::stdcxx::shared_ptr< MilvusServiceIfFactory > handlerFactory_; -}; - -class MilvusServiceMultiface : virtual public MilvusServiceIf { - public: - MilvusServiceMultiface(std::vector >& ifaces) : ifaces_(ifaces) { - } - virtual ~MilvusServiceMultiface() {} - protected: - std::vector > ifaces_; - MilvusServiceMultiface() {} - void add(::apache::thrift::stdcxx::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void CreateTable(const TableSchema& param) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->CreateTable(param); - } - ifaces_[i]->CreateTable(param); - } - - bool HasTable(const std::string& table_name) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->HasTable(table_name); - } - return ifaces_[i]->HasTable(table_name); - } - - void DeleteTable(const std::string& table_name) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->DeleteTable(table_name); - } - ifaces_[i]->DeleteTable(table_name); - } - - void BuildIndex(const std::string& table_name) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->BuildIndex(table_name); - } - ifaces_[i]->BuildIndex(table_name); - } - - void AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->AddVector(_return, table_name, record_array); - } - ifaces_[i]->AddVector(_return, table_name, record_array); - return; - } - - void SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->SearchVector(_return, table_name, query_record_array, query_range_array, topk); - } - ifaces_[i]->SearchVector(_return, table_name, query_record_array, query_range_array, topk); - return; - } - - void SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->SearchVector2(_return, table_name, query_record_array, query_range_array, topk); - } - ifaces_[i]->SearchVector2(_return, table_name, query_record_array, query_range_array, topk); - return; - } - - void SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->SearchVectorInFiles(_return, table_name, file_id_array, query_record_array, query_range_array, topk); - } - ifaces_[i]->SearchVectorInFiles(_return, table_name, file_id_array, query_record_array, query_range_array, topk); - return; - } - - void DescribeTable(TableSchema& _return, const std::string& table_name) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->DescribeTable(_return, table_name); - } - ifaces_[i]->DescribeTable(_return, table_name); - return; - } - - int64_t GetTableRowCount(const std::string& table_name) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->GetTableRowCount(table_name); - } - return ifaces_[i]->GetTableRowCount(table_name); - } - - void ShowTables(std::vector & _return) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->ShowTables(_return); - } - ifaces_[i]->ShowTables(_return); - return; - } - - void Ping(std::string& _return, const std::string& cmd) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->Ping(_return, cmd); - } - ifaces_[i]->Ping(_return, cmd); - return; - } - -}; - -// The 'concurrent' client is a thread safe client that correctly handles -// out of order responses. It is slower than the regular client, so should -// only be used when you need to share a connection among multiple threads -class MilvusServiceConcurrentClient : virtual public MilvusServiceIf { - public: - MilvusServiceConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { - setProtocol(prot); - } - MilvusServiceConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - setProtocol(iprot,oprot); - } - private: - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { - setProtocol(prot,prot); - } - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - piprot_=iprot; - poprot_=oprot; - iprot_ = iprot.get(); - oprot_ = oprot.get(); - } - public: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { - return piprot_; - } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { - return poprot_; - } - void CreateTable(const TableSchema& param); - int32_t send_CreateTable(const TableSchema& param); - void recv_CreateTable(const int32_t seqid); - bool HasTable(const std::string& table_name); - int32_t send_HasTable(const std::string& table_name); - bool recv_HasTable(const int32_t seqid); - void DeleteTable(const std::string& table_name); - int32_t send_DeleteTable(const std::string& table_name); - void recv_DeleteTable(const int32_t seqid); - void BuildIndex(const std::string& table_name); - int32_t send_BuildIndex(const std::string& table_name); - void recv_BuildIndex(const int32_t seqid); - void AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array); - int32_t send_AddVector(const std::string& table_name, const std::vector & record_array); - void recv_AddVector(std::vector & _return, const int32_t seqid); - void SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - int32_t send_SearchVector(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVector(std::vector & _return, const int32_t seqid); - void SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - int32_t send_SearchVector2(const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVector2(std::vector & _return, const int32_t seqid); - void SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - int32_t send_SearchVectorInFiles(const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk); - void recv_SearchVectorInFiles(std::vector & _return, const int32_t seqid); - void DescribeTable(TableSchema& _return, const std::string& table_name); - int32_t send_DescribeTable(const std::string& table_name); - void recv_DescribeTable(TableSchema& _return, const int32_t seqid); - int64_t GetTableRowCount(const std::string& table_name); - int32_t send_GetTableRowCount(const std::string& table_name); - int64_t recv_GetTableRowCount(const int32_t seqid); - void ShowTables(std::vector & _return); - int32_t send_ShowTables(); - void recv_ShowTables(std::vector & _return, const int32_t seqid); - void Ping(std::string& _return, const std::string& cmd); - int32_t send_Ping(const std::string& cmd); - void recv_Ping(std::string& _return, const int32_t seqid); - protected: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; - ::apache::thrift::protocol::TProtocol* iprot_; - ::apache::thrift::protocol::TProtocol* oprot_; - ::apache::thrift::async::TConcurrentClientSyncInfo sync_; -}; - -#ifdef _MSC_VER - #pragma warning( pop ) -#endif - -}} // namespace - -#endif diff --git a/cpp/src/thrift/gen-cpp/MilvusService_server.skeleton.cpp b/cpp/src/thrift/gen-cpp/MilvusService_server.skeleton.cpp deleted file mode 100644 index efa8e95034..0000000000 --- a/cpp/src/thrift/gen-cpp/MilvusService_server.skeleton.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// This autogenerated skeleton file illustrates how to build a server. -// You should copy it to another filename to avoid overwriting it. - -#include "MilvusService.h" -#include -#include -#include -#include - -using namespace ::apache::thrift; -using namespace ::apache::thrift::protocol; -using namespace ::apache::thrift::transport; -using namespace ::apache::thrift::server; - -using namespace ::milvus::thrift; - -class MilvusServiceHandler : virtual public MilvusServiceIf { - public: - MilvusServiceHandler() { - // Your initialization goes here - } - - /** - * @brief Create table method - * - * This method is used to create table - * - * @param param, use to provide table information to be created. - * - * - * @param param - */ - void CreateTable(const TableSchema& param) { - // Your implementation goes here - printf("CreateTable\n"); - } - - /** - * @brief Test table existence method - * - * This method is used to test table existence. - * - * @param table_name, table name is going to be tested. - * - * - * @param table_name - */ - bool HasTable(const std::string& table_name) { - // Your implementation goes here - printf("HasTable\n"); - } - - /** - * @brief Delete table method - * - * This method is used to delete table. - * - * @param table_name, table name is going to be deleted. - * - * - * @param table_name - */ - void DeleteTable(const std::string& table_name) { - // Your implementation goes here - printf("DeleteTable\n"); - } - - /** - * @brief Build index by table method - * - * This method is used to build index by table in sync mode. - * - * @param table_name, table is going to be built index. - * - * - * @param table_name - */ - void BuildIndex(const std::string& table_name) { - // Your implementation goes here - printf("BuildIndex\n"); - } - - /** - * @brief Add vector array to table - * - * This method is used to add vector array to table. - * - * @param table_name, table_name is inserted. - * @param record_array, vector array is inserted. - * - * @return vector id array - * - * @param table_name - * @param record_array - */ - void AddVector(std::vector & _return, const std::string& table_name, const std::vector & record_array) { - // Your implementation goes here - printf("AddVector\n"); - } - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - void SearchVector(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - // Your implementation goes here - printf("SearchVector\n"); - } - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query binary result array. - * - * @param table_name - * @param query_record_array - * @param query_range_array - * @param topk - */ - void SearchVector2(std::vector & _return, const std::string& table_name, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - // Your implementation goes here - printf("SearchVector2\n"); - } - - /** - * @brief Internal use query interface - * - * This method is used to query vector in specified files. - * - * @param file_id_array, specified files id array, queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - * - * @param table_name - * @param file_id_array - * @param query_record_array - * @param query_range_array - * @param topk - */ - void SearchVectorInFiles(std::vector & _return, const std::string& table_name, const std::vector & file_id_array, const std::vector & query_record_array, const std::vector & query_range_array, const int64_t topk) { - // Your implementation goes here - printf("SearchVectorInFiles\n"); - } - - /** - * @brief Get table schema - * - * This method is used to get table schema. - * - * @param table_name, target table name. - * - * @return table schema - * - * @param table_name - */ - void DescribeTable(TableSchema& _return, const std::string& table_name) { - // Your implementation goes here - printf("DescribeTable\n"); - } - - /** - * @brief Get table row count - * - * This method is used to get table row count. - * - * @param table_name, target table name. - * - * @return table row count - * - * @param table_name - */ - int64_t GetTableRowCount(const std::string& table_name) { - // Your implementation goes here - printf("GetTableRowCount\n"); - } - - /** - * @brief List all tables in database - * - * This method is used to list all tables. - * - * - * @return table names. - */ - void ShowTables(std::vector & _return) { - // Your implementation goes here - printf("ShowTables\n"); - } - - /** - * @brief Give the server status - * - * This method is used to give the server status. - * - * @return Server status. - * - * @param cmd - */ - void Ping(std::string& _return, const std::string& cmd) { - // Your implementation goes here - printf("Ping\n"); - } - -}; - -int main(int argc, char **argv) { - int port = 9090; - ::apache::thrift::stdcxx::shared_ptr handler(new MilvusServiceHandler()); - ::apache::thrift::stdcxx::shared_ptr processor(new MilvusServiceProcessor(handler)); - ::apache::thrift::stdcxx::shared_ptr serverTransport(new TServerSocket(port)); - ::apache::thrift::stdcxx::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::apache::thrift::stdcxx::shared_ptr protocolFactory(new TBinaryProtocolFactory()); - - TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); - server.serve(); - return 0; -} - diff --git a/cpp/src/thrift/gen-cpp/milvus_constants.cpp b/cpp/src/thrift/gen-cpp/milvus_constants.cpp deleted file mode 100644 index 00f0b4f060..0000000000 --- a/cpp/src/thrift/gen-cpp/milvus_constants.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "milvus_constants.h" - -namespace milvus { namespace thrift { - -const milvusConstants g_milvus_constants; - -milvusConstants::milvusConstants() { -} - -}} // namespace - diff --git a/cpp/src/thrift/gen-cpp/milvus_constants.h b/cpp/src/thrift/gen-cpp/milvus_constants.h deleted file mode 100644 index 36dbf70485..0000000000 --- a/cpp/src/thrift/gen-cpp/milvus_constants.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef milvus_CONSTANTS_H -#define milvus_CONSTANTS_H - -#include "milvus_types.h" - -namespace milvus { namespace thrift { - -class milvusConstants { - public: - milvusConstants(); - -}; - -extern const milvusConstants g_milvus_constants; - -}} // namespace - -#endif diff --git a/cpp/src/thrift/gen-cpp/milvus_types.cpp b/cpp/src/thrift/gen-cpp/milvus_types.cpp deleted file mode 100644 index a1ef24de52..0000000000 --- a/cpp/src/thrift/gen-cpp/milvus_types.cpp +++ /dev/null @@ -1,899 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "milvus_types.h" - -#include -#include - -#include - -namespace milvus { namespace thrift { - -int _kErrorCodeValues[] = { - ErrorCode::SUCCESS, - ErrorCode::UNEXPECTED_ERROR, - ErrorCode::CONNECT_FAILED, - ErrorCode::PERMISSION_DENIED, - ErrorCode::TABLE_NOT_EXISTS, - ErrorCode::ILLEGAL_ARGUMENT, - ErrorCode::ILLEGAL_RANGE, - ErrorCode::ILLEGAL_DIMENSION, - ErrorCode::ILLEGAL_INDEX_TYPE, - ErrorCode::ILLEGAL_TABLE_NAME, - ErrorCode::ILLEGAL_TOPK, - ErrorCode::ILLEGAL_ROWRECORD, - ErrorCode::ILLEGAL_VECTOR_ID, - ErrorCode::ILLEGAL_SEARCH_RESULT, - ErrorCode::FILE_NOT_FOUND, - ErrorCode::META_FAILED, - ErrorCode::CACHE_FAILED, - ErrorCode::CANNOT_CREATE_FOLDER, - ErrorCode::CANNOT_CREATE_FILE, - ErrorCode::CANNOT_DELETE_FOLDER, - ErrorCode::CANNOT_DELETE_FILE, - ErrorCode::BUILD_INDEX_ERROR -}; -const char* _kErrorCodeNames[] = { - "SUCCESS", - "UNEXPECTED_ERROR", - "CONNECT_FAILED", - "PERMISSION_DENIED", - "TABLE_NOT_EXISTS", - "ILLEGAL_ARGUMENT", - "ILLEGAL_RANGE", - "ILLEGAL_DIMENSION", - "ILLEGAL_INDEX_TYPE", - "ILLEGAL_TABLE_NAME", - "ILLEGAL_TOPK", - "ILLEGAL_ROWRECORD", - "ILLEGAL_VECTOR_ID", - "ILLEGAL_SEARCH_RESULT", - "FILE_NOT_FOUND", - "META_FAILED", - "CACHE_FAILED", - "CANNOT_CREATE_FOLDER", - "CANNOT_CREATE_FILE", - "CANNOT_DELETE_FOLDER", - "CANNOT_DELETE_FILE", - "BUILD_INDEX_ERROR" -}; -const std::map _ErrorCode_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(22, _kErrorCodeValues, _kErrorCodeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); - -std::ostream& operator<<(std::ostream& out, const ErrorCode::type& val) { - std::map::const_iterator it = _ErrorCode_VALUES_TO_NAMES.find(val); - if (it != _ErrorCode_VALUES_TO_NAMES.end()) { - out << it->second; - } else { - out << static_cast(val); - } - return out; -} - - -Exception::~Exception() throw() { -} - - -void Exception::__set_code(const ErrorCode::type val) { - this->code = val; -} - -void Exception::__set_reason(const std::string& val) { - this->reason = val; -} -std::ostream& operator<<(std::ostream& out, const Exception& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t Exception::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast0; - xfer += iprot->readI32(ecast0); - this->code = (ErrorCode::type)ecast0; - this->__isset.code = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->reason); - this->__isset.reason = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Exception::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("Exception"); - - xfer += oprot->writeFieldBegin("code", ::apache::thrift::protocol::T_I32, 1); - xfer += oprot->writeI32((int32_t)this->code); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("reason", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->reason); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(Exception &a, Exception &b) { - using ::std::swap; - swap(a.code, b.code); - swap(a.reason, b.reason); - swap(a.__isset, b.__isset); -} - -Exception::Exception(const Exception& other1) : TException() { - code = other1.code; - reason = other1.reason; - __isset = other1.__isset; -} -Exception& Exception::operator=(const Exception& other2) { - code = other2.code; - reason = other2.reason; - __isset = other2.__isset; - return *this; -} -void Exception::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "Exception("; - out << "code=" << to_string(code); - out << ", " << "reason=" << to_string(reason); - out << ")"; -} - -const char* Exception::what() const throw() { - try { - std::stringstream ss; - ss << "TException - service has thrown: " << *this; - this->thriftTExceptionMessageHolder_ = ss.str(); - return this->thriftTExceptionMessageHolder_.c_str(); - } catch (const std::exception&) { - return "TException - service has thrown: Exception"; - } -} - - -TableSchema::~TableSchema() throw() { -} - - -void TableSchema::__set_table_name(const std::string& val) { - this->table_name = val; -} - -void TableSchema::__set_index_type(const int32_t val) { - this->index_type = val; -} - -void TableSchema::__set_dimension(const int64_t val) { - this->dimension = val; -} - -void TableSchema::__set_store_raw_vector(const bool val) { - this->store_raw_vector = val; -} -std::ostream& operator<<(std::ostream& out, const TableSchema& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t TableSchema::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_table_name = false; - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->table_name); - isset_table_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->index_type); - this->__isset.index_type = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->dimension); - this->__isset.dimension = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->store_raw_vector); - this->__isset.store_raw_vector = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - if (!isset_table_name) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; -} - -uint32_t TableSchema::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("TableSchema"); - - xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->table_name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("index_type", ::apache::thrift::protocol::T_I32, 2); - xfer += oprot->writeI32(this->index_type); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("dimension", ::apache::thrift::protocol::T_I64, 3); - xfer += oprot->writeI64(this->dimension); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("store_raw_vector", ::apache::thrift::protocol::T_BOOL, 4); - xfer += oprot->writeBool(this->store_raw_vector); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(TableSchema &a, TableSchema &b) { - using ::std::swap; - swap(a.table_name, b.table_name); - swap(a.index_type, b.index_type); - swap(a.dimension, b.dimension); - swap(a.store_raw_vector, b.store_raw_vector); - swap(a.__isset, b.__isset); -} - -TableSchema::TableSchema(const TableSchema& other3) { - table_name = other3.table_name; - index_type = other3.index_type; - dimension = other3.dimension; - store_raw_vector = other3.store_raw_vector; - __isset = other3.__isset; -} -TableSchema& TableSchema::operator=(const TableSchema& other4) { - table_name = other4.table_name; - index_type = other4.index_type; - dimension = other4.dimension; - store_raw_vector = other4.store_raw_vector; - __isset = other4.__isset; - return *this; -} -void TableSchema::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "TableSchema("; - out << "table_name=" << to_string(table_name); - out << ", " << "index_type=" << to_string(index_type); - out << ", " << "dimension=" << to_string(dimension); - out << ", " << "store_raw_vector=" << to_string(store_raw_vector); - out << ")"; -} - - -Range::~Range() throw() { -} - - -void Range::__set_start_value(const std::string& val) { - this->start_value = val; -} - -void Range::__set_end_value(const std::string& val) { - this->end_value = val; -} -std::ostream& operator<<(std::ostream& out, const Range& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t Range::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->start_value); - this->__isset.start_value = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->end_value); - this->__isset.end_value = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Range::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("Range"); - - xfer += oprot->writeFieldBegin("start_value", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->start_value); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("end_value", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->end_value); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(Range &a, Range &b) { - using ::std::swap; - swap(a.start_value, b.start_value); - swap(a.end_value, b.end_value); - swap(a.__isset, b.__isset); -} - -Range::Range(const Range& other5) { - start_value = other5.start_value; - end_value = other5.end_value; - __isset = other5.__isset; -} -Range& Range::operator=(const Range& other6) { - start_value = other6.start_value; - end_value = other6.end_value; - __isset = other6.__isset; - return *this; -} -void Range::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "Range("; - out << "start_value=" << to_string(start_value); - out << ", " << "end_value=" << to_string(end_value); - out << ")"; -} - - -RowRecord::~RowRecord() throw() { -} - - -void RowRecord::__set_vector_data(const std::string& val) { - this->vector_data = val; -} -std::ostream& operator<<(std::ostream& out, const RowRecord& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t RowRecord::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_vector_data = false; - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readBinary(this->vector_data); - isset_vector_data = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - if (!isset_vector_data) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; -} - -uint32_t RowRecord::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("RowRecord"); - - xfer += oprot->writeFieldBegin("vector_data", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeBinary(this->vector_data); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(RowRecord &a, RowRecord &b) { - using ::std::swap; - swap(a.vector_data, b.vector_data); -} - -RowRecord::RowRecord(const RowRecord& other7) { - vector_data = other7.vector_data; -} -RowRecord& RowRecord::operator=(const RowRecord& other8) { - vector_data = other8.vector_data; - return *this; -} -void RowRecord::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "RowRecord("; - out << "vector_data=" << to_string(vector_data); - out << ")"; -} - - -QueryResult::~QueryResult() throw() { -} - - -void QueryResult::__set_id(const int64_t val) { - this->id = val; -} - -void QueryResult::__set_distance(const double val) { - this->distance = val; -} -std::ostream& operator<<(std::ostream& out, const QueryResult& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t QueryResult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->id); - this->__isset.id = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_DOUBLE) { - xfer += iprot->readDouble(this->distance); - this->__isset.distance = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t QueryResult::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("QueryResult"); - - xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I64, 1); - xfer += oprot->writeI64(this->id); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("distance", ::apache::thrift::protocol::T_DOUBLE, 2); - xfer += oprot->writeDouble(this->distance); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(QueryResult &a, QueryResult &b) { - using ::std::swap; - swap(a.id, b.id); - swap(a.distance, b.distance); - swap(a.__isset, b.__isset); -} - -QueryResult::QueryResult(const QueryResult& other9) { - id = other9.id; - distance = other9.distance; - __isset = other9.__isset; -} -QueryResult& QueryResult::operator=(const QueryResult& other10) { - id = other10.id; - distance = other10.distance; - __isset = other10.__isset; - return *this; -} -void QueryResult::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "QueryResult("; - out << "id=" << to_string(id); - out << ", " << "distance=" << to_string(distance); - out << ")"; -} - - -TopKQueryResult::~TopKQueryResult() throw() { -} - - -void TopKQueryResult::__set_query_result_arrays(const std::vector & val) { - this->query_result_arrays = val; -} -std::ostream& operator<<(std::ostream& out, const TopKQueryResult& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t TopKQueryResult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->query_result_arrays.clear(); - uint32_t _size11; - ::apache::thrift::protocol::TType _etype14; - xfer += iprot->readListBegin(_etype14, _size11); - this->query_result_arrays.resize(_size11); - uint32_t _i15; - for (_i15 = 0; _i15 < _size11; ++_i15) - { - xfer += this->query_result_arrays[_i15].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.query_result_arrays = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t TopKQueryResult::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("TopKQueryResult"); - - xfer += oprot->writeFieldBegin("query_result_arrays", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->query_result_arrays.size())); - std::vector ::const_iterator _iter16; - for (_iter16 = this->query_result_arrays.begin(); _iter16 != this->query_result_arrays.end(); ++_iter16) - { - xfer += (*_iter16).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(TopKQueryResult &a, TopKQueryResult &b) { - using ::std::swap; - swap(a.query_result_arrays, b.query_result_arrays); - swap(a.__isset, b.__isset); -} - -TopKQueryResult::TopKQueryResult(const TopKQueryResult& other17) { - query_result_arrays = other17.query_result_arrays; - __isset = other17.__isset; -} -TopKQueryResult& TopKQueryResult::operator=(const TopKQueryResult& other18) { - query_result_arrays = other18.query_result_arrays; - __isset = other18.__isset; - return *this; -} -void TopKQueryResult::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "TopKQueryResult("; - out << "query_result_arrays=" << to_string(query_result_arrays); - out << ")"; -} - - -TopKQueryBinResult::~TopKQueryBinResult() throw() { -} - - -void TopKQueryBinResult::__set_id_array(const std::string& val) { - this->id_array = val; -} - -void TopKQueryBinResult::__set_distance_array(const std::string& val) { - this->distance_array = val; -} -std::ostream& operator<<(std::ostream& out, const TopKQueryBinResult& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t TopKQueryBinResult::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_id_array = false; - bool isset_distance_array = false; - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readBinary(this->id_array); - isset_id_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readBinary(this->distance_array); - isset_distance_array = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - if (!isset_id_array) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_distance_array) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; -} - -uint32_t TopKQueryBinResult::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("TopKQueryBinResult"); - - xfer += oprot->writeFieldBegin("id_array", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeBinary(this->id_array); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("distance_array", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeBinary(this->distance_array); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(TopKQueryBinResult &a, TopKQueryBinResult &b) { - using ::std::swap; - swap(a.id_array, b.id_array); - swap(a.distance_array, b.distance_array); -} - -TopKQueryBinResult::TopKQueryBinResult(const TopKQueryBinResult& other19) { - id_array = other19.id_array; - distance_array = other19.distance_array; -} -TopKQueryBinResult& TopKQueryBinResult::operator=(const TopKQueryBinResult& other20) { - id_array = other20.id_array; - distance_array = other20.distance_array; - return *this; -} -void TopKQueryBinResult::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "TopKQueryBinResult("; - out << "id_array=" << to_string(id_array); - out << ", " << "distance_array=" << to_string(distance_array); - out << ")"; -} - -}} // namespace diff --git a/cpp/src/thrift/gen-cpp/milvus_types.h b/cpp/src/thrift/gen-cpp/milvus_types.h deleted file mode 100644 index a75d883074..0000000000 --- a/cpp/src/thrift/gen-cpp/milvus_types.h +++ /dev/null @@ -1,394 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef milvus_TYPES_H -#define milvus_TYPES_H - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace milvus { namespace thrift { - -struct ErrorCode { - enum type { - SUCCESS = 0, - UNEXPECTED_ERROR = 1, - CONNECT_FAILED = 2, - PERMISSION_DENIED = 3, - TABLE_NOT_EXISTS = 4, - ILLEGAL_ARGUMENT = 5, - ILLEGAL_RANGE = 6, - ILLEGAL_DIMENSION = 7, - ILLEGAL_INDEX_TYPE = 8, - ILLEGAL_TABLE_NAME = 9, - ILLEGAL_TOPK = 10, - ILLEGAL_ROWRECORD = 11, - ILLEGAL_VECTOR_ID = 12, - ILLEGAL_SEARCH_RESULT = 13, - FILE_NOT_FOUND = 14, - META_FAILED = 15, - CACHE_FAILED = 16, - CANNOT_CREATE_FOLDER = 17, - CANNOT_CREATE_FILE = 18, - CANNOT_DELETE_FOLDER = 19, - CANNOT_DELETE_FILE = 20, - BUILD_INDEX_ERROR = 21 - }; -}; - -extern const std::map _ErrorCode_VALUES_TO_NAMES; - -std::ostream& operator<<(std::ostream& out, const ErrorCode::type& val); - -class Exception; - -class TableSchema; - -class Range; - -class RowRecord; - -class QueryResult; - -class TopKQueryResult; - -class TopKQueryBinResult; - -typedef struct _Exception__isset { - _Exception__isset() : code(false), reason(false) {} - bool code :1; - bool reason :1; -} _Exception__isset; - -class Exception : public ::apache::thrift::TException { - public: - - Exception(const Exception&); - Exception& operator=(const Exception&); - Exception() : code((ErrorCode::type)0), reason() { - } - - virtual ~Exception() throw(); - ErrorCode::type code; - std::string reason; - - _Exception__isset __isset; - - void __set_code(const ErrorCode::type val); - - void __set_reason(const std::string& val); - - bool operator == (const Exception & rhs) const - { - if (!(code == rhs.code)) - return false; - if (!(reason == rhs.reason)) - return false; - return true; - } - bool operator != (const Exception &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Exception & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; - mutable std::string thriftTExceptionMessageHolder_; - const char* what() const throw(); -}; - -void swap(Exception &a, Exception &b); - -std::ostream& operator<<(std::ostream& out, const Exception& obj); - -typedef struct _TableSchema__isset { - _TableSchema__isset() : index_type(true), dimension(true), store_raw_vector(true) {} - bool index_type :1; - bool dimension :1; - bool store_raw_vector :1; -} _TableSchema__isset; - -class TableSchema : public virtual ::apache::thrift::TBase { - public: - - TableSchema(const TableSchema&); - TableSchema& operator=(const TableSchema&); - TableSchema() : table_name(), index_type(0), dimension(0LL), store_raw_vector(false) { - } - - virtual ~TableSchema() throw(); - std::string table_name; - int32_t index_type; - int64_t dimension; - bool store_raw_vector; - - _TableSchema__isset __isset; - - void __set_table_name(const std::string& val); - - void __set_index_type(const int32_t val); - - void __set_dimension(const int64_t val); - - void __set_store_raw_vector(const bool val); - - bool operator == (const TableSchema & rhs) const - { - if (!(table_name == rhs.table_name)) - return false; - if (!(index_type == rhs.index_type)) - return false; - if (!(dimension == rhs.dimension)) - return false; - if (!(store_raw_vector == rhs.store_raw_vector)) - return false; - return true; - } - bool operator != (const TableSchema &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TableSchema & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(TableSchema &a, TableSchema &b); - -std::ostream& operator<<(std::ostream& out, const TableSchema& obj); - -typedef struct _Range__isset { - _Range__isset() : start_value(false), end_value(false) {} - bool start_value :1; - bool end_value :1; -} _Range__isset; - -class Range : public virtual ::apache::thrift::TBase { - public: - - Range(const Range&); - Range& operator=(const Range&); - Range() : start_value(), end_value() { - } - - virtual ~Range() throw(); - std::string start_value; - std::string end_value; - - _Range__isset __isset; - - void __set_start_value(const std::string& val); - - void __set_end_value(const std::string& val); - - bool operator == (const Range & rhs) const - { - if (!(start_value == rhs.start_value)) - return false; - if (!(end_value == rhs.end_value)) - return false; - return true; - } - bool operator != (const Range &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Range & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(Range &a, Range &b); - -std::ostream& operator<<(std::ostream& out, const Range& obj); - - -class RowRecord : public virtual ::apache::thrift::TBase { - public: - - RowRecord(const RowRecord&); - RowRecord& operator=(const RowRecord&); - RowRecord() : vector_data() { - } - - virtual ~RowRecord() throw(); - std::string vector_data; - - void __set_vector_data(const std::string& val); - - bool operator == (const RowRecord & rhs) const - { - if (!(vector_data == rhs.vector_data)) - return false; - return true; - } - bool operator != (const RowRecord &rhs) const { - return !(*this == rhs); - } - - bool operator < (const RowRecord & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(RowRecord &a, RowRecord &b); - -std::ostream& operator<<(std::ostream& out, const RowRecord& obj); - -typedef struct _QueryResult__isset { - _QueryResult__isset() : id(false), distance(false) {} - bool id :1; - bool distance :1; -} _QueryResult__isset; - -class QueryResult : public virtual ::apache::thrift::TBase { - public: - - QueryResult(const QueryResult&); - QueryResult& operator=(const QueryResult&); - QueryResult() : id(0), distance(0) { - } - - virtual ~QueryResult() throw(); - int64_t id; - double distance; - - _QueryResult__isset __isset; - - void __set_id(const int64_t val); - - void __set_distance(const double val); - - bool operator == (const QueryResult & rhs) const - { - if (!(id == rhs.id)) - return false; - if (!(distance == rhs.distance)) - return false; - return true; - } - bool operator != (const QueryResult &rhs) const { - return !(*this == rhs); - } - - bool operator < (const QueryResult & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(QueryResult &a, QueryResult &b); - -std::ostream& operator<<(std::ostream& out, const QueryResult& obj); - -typedef struct _TopKQueryResult__isset { - _TopKQueryResult__isset() : query_result_arrays(false) {} - bool query_result_arrays :1; -} _TopKQueryResult__isset; - -class TopKQueryResult : public virtual ::apache::thrift::TBase { - public: - - TopKQueryResult(const TopKQueryResult&); - TopKQueryResult& operator=(const TopKQueryResult&); - TopKQueryResult() { - } - - virtual ~TopKQueryResult() throw(); - std::vector query_result_arrays; - - _TopKQueryResult__isset __isset; - - void __set_query_result_arrays(const std::vector & val); - - bool operator == (const TopKQueryResult & rhs) const - { - if (!(query_result_arrays == rhs.query_result_arrays)) - return false; - return true; - } - bool operator != (const TopKQueryResult &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TopKQueryResult & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(TopKQueryResult &a, TopKQueryResult &b); - -std::ostream& operator<<(std::ostream& out, const TopKQueryResult& obj); - - -class TopKQueryBinResult : public virtual ::apache::thrift::TBase { - public: - - TopKQueryBinResult(const TopKQueryBinResult&); - TopKQueryBinResult& operator=(const TopKQueryBinResult&); - TopKQueryBinResult() : id_array(), distance_array() { - } - - virtual ~TopKQueryBinResult() throw(); - std::string id_array; - std::string distance_array; - - void __set_id_array(const std::string& val); - - void __set_distance_array(const std::string& val); - - bool operator == (const TopKQueryBinResult & rhs) const - { - if (!(id_array == rhs.id_array)) - return false; - if (!(distance_array == rhs.distance_array)) - return false; - return true; - } - bool operator != (const TopKQueryBinResult &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TopKQueryBinResult & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(TopKQueryBinResult &a, TopKQueryBinResult &b); - -std::ostream& operator<<(std::ostream& out, const TopKQueryBinResult& obj); - -}} // namespace - -#endif diff --git a/cpp/src/thrift/milvus.thrift b/cpp/src/thrift/milvus.thrift deleted file mode 100644 index 64f25ae387..0000000000 --- a/cpp/src/thrift/milvus.thrift +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited. - * Proprietary and confidential. - ******************************************************************************/ -namespace cpp milvus.thrift -namespace py milvus.thrift -namespace d milvus.thrift -namespace dart milvus.thrift -namespace java milvus.thrift -namespace perl milvus.thrift -namespace php milvus.thrift -namespace haxe milvus.thrift -namespace netcore milvus.thrift - -enum ErrorCode { - SUCCESS = 0, - UNEXPECTED_ERROR, - CONNECT_FAILED, - PERMISSION_DENIED, - TABLE_NOT_EXISTS, - ILLEGAL_ARGUMENT, - ILLEGAL_RANGE, - ILLEGAL_DIMENSION, - ILLEGAL_INDEX_TYPE, - ILLEGAL_TABLE_NAME, - ILLEGAL_TOPK, - ILLEGAL_ROWRECORD, - ILLEGAL_VECTOR_ID, - ILLEGAL_SEARCH_RESULT, - FILE_NOT_FOUND, - META_FAILED, - CACHE_FAILED, - CANNOT_CREATE_FOLDER, - CANNOT_CREATE_FILE, - CANNOT_DELETE_FOLDER, - CANNOT_DELETE_FILE, - BUILD_INDEX_ERROR, -} - -exception Exception { - 1: ErrorCode code; - 2: string reason; -} - - -/** - * @brief Table Schema - */ -struct TableSchema { - 1: required string table_name; ///< Table name - 2: i32 index_type = 0; ///< Index type, optional: 0-invalid, 1-idmap, 2-ivflat - 3: i64 dimension = 0; ///< Vector dimension - 4: bool store_raw_vector = false; ///< Store raw data -} - -/** - * @brief Range Schema - */ -struct Range { - 1: string start_value; ///< Range start - 2: string end_value; ///< Range stop -} - -/** - * @brief Record inserted - */ -struct RowRecord { - 1: required binary vector_data; ///< Vector data, double array -} - -/** - * @brief Query result - */ -struct QueryResult { - 1: i64 id; ///< Output result - 2: double distance; ///< Vector similarity distance -} - -/** - * @brief TopK query result - */ -struct TopKQueryResult { - 1: list query_result_arrays; ///< TopK query result -} - -/** - * @brief TopK query binary result - */ -struct TopKQueryBinResult { - 1: required binary id_array; ///< id array, interger array - 2: required binary distance_array; ///< distance array, double array -} - -service MilvusService { - /** - * @brief Create table method - * - * This method is used to create table - * - * @param param, use to provide table information to be created. - * - */ - void CreateTable(2: TableSchema param) throws(1: Exception e); - - /** - * @brief Test table existence method - * - * This method is used to test table existence. - * - * @param table_name, table name is going to be tested. - * - */ - bool HasTable(2: string table_name) throws(1: Exception e); - - - /** - * @brief Delete table method - * - * This method is used to delete table. - * - * @param table_name, table name is going to be deleted. - * - */ - void DeleteTable(2: string table_name) throws(1: Exception e); - - /** - * @brief Build index by table method - * - * This method is used to build index by table in sync mode. - * - * @param table_name, table is going to be built index. - * - */ - void BuildIndex(2: string table_name) throws(1: Exception e); - - - /** - * @brief Add vector array to table - * - * This method is used to add vector array to table. - * - * @param table_name, table_name is inserted. - * @param record_array, vector array is inserted. - * - * @return vector id array - */ - list AddVector(2: string table_name, - 3: list record_array) throws(1: Exception e); - - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - */ - list SearchVector(2: string table_name, - 3: list query_record_array, - 4: list query_range_array, - 5: i64 topk) throws(1: Exception e); - - /** - * @brief Query vector - * - * This method is used to query vector in table. - * - * @param table_name, table_name is queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query binary result array. - */ - list SearchVector2(2: string table_name, - 3: list query_record_array, - 4: list query_range_array, - 5: i64 topk) throws(1: Exception e); - - /** - * @brief Internal use query interface - * - * This method is used to query vector in specified files. - * - * @param file_id_array, specified files id array, queried. - * @param query_record_array, all vector are going to be queried. - * @param query_range_array, optional ranges for conditional search. If not specified, search whole table - * @param topk, how many similarity vectors will be searched. - * - * @return query result array. - */ - list SearchVectorInFiles(2: string table_name, - 3: list file_id_array, - 4: list query_record_array, - 5: list query_range_array, - 6: i64 topk) throws(1: Exception e); - - /** - * @brief Get table schema - * - * This method is used to get table schema. - * - * @param table_name, target table name. - * - * @return table schema - */ - TableSchema DescribeTable(2: string table_name) throws(1: Exception e); - - - /** - * @brief Get table row count - * - * This method is used to get table row count. - * - * @param table_name, target table name. - * - * @return table row count - */ - i64 GetTableRowCount(2: string table_name) throws(1: Exception e); - - /** - * @brief List all tables in database - * - * This method is used to list all tables. - * - * - * @return table names. - */ - list ShowTables() throws(1: Exception e); - - - /** - * @brief Give the server status - * - * This method is used to give the server status. - * - * @return Server status. - */ - string Ping(2: string cmd) throws(1: Exception e); -} diff --git a/cpp/thirdparty/versions.txt b/cpp/thirdparty/versions.txt index e15f66c365..3b02016c55 100644 --- a/cpp/thirdparty/versions.txt +++ b/cpp/thirdparty/versions.txt @@ -15,7 +15,6 @@ ROCKSDB_VERSION=v6.0.2 SNAPPY_VERSION=1.1.7 SQLITE_VERSION=3280000 SQLITE_ORM_VERSION=master -THRIFT_VERSION=v0.12.0 YAMLCPP_VERSION=0.6.2 ZLIB_VERSION=v1.2.11 ZSTD_VERSION=v1.4.0