// 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 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; }