未验证 提交 e3f4ab92 编写于 作者: B BossZou 提交者: GitHub

Upgrade third-party oatpp up to v1.1.0 (#3272)

* Update oatpp link
Signed-off-by: Nyinghao.zou <yinghao.zou@zilliz.com>

* Update DATo
Signed-off-by: Nyinghao.zou <yinghao.zou@zilliz.com>

* Upgrade oatpp to v1.1.0 (fix #2568)
Signed-off-by: Nyinghao.zou <yinghao.zou@zilliz.com>

* Fix complie error in GPU version
Signed-off-by: Nyinghao.zou <yinghao.zou@zilliz.com>
上级 9554a386
......@@ -43,6 +43,7 @@ Please mark all changes in change log and use the issue from GitHub
- \#2543 Remove secondary_path related code
- \#2544 Optimize unittest build
- \#2561 Clean util dependencies with other modules
- \#2568 Upgrade thirdparty oatpp to v1.1.0
- \#2612 Move all APIs in utils into namespace milvus
- \#2675 Print out system memory size when report invalid cpu cache size
- \#2686 Remove dependency on sqlite_orm
......
......@@ -270,8 +270,8 @@ endif ()
if (DEFINED ENV{MILVUS_OATPP_URL})
set(OATPP_SOURCE_URL "$ENV{MILVUS_OATPP_URL}")
else ()
# set(OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz")
set(OATPP_SOURCE_URL "https://github.com/BossZou/oatpp/archive/${OATPP_VERSION}.zip")
set(OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz")
# set(OATPP_SOURCE_URL "https://github.com/BossZou/oatpp/archive/${OATPP_VERSION}.zip")
endif ()
if (DEFINED ENV{MILVUS_AWS_URL})
......@@ -686,7 +686,7 @@ macro(build_oatpp)
${OATPP_SOURCE_URL}
${EP_LOG_OPTIONS}
URL_MD5
"ae7143a8014ffed77c5340ac29af29f4"
"396350ca4fe5bedab3769e09eee2cc9f"
CMAKE_ARGS
${OATPP_CMAKE_ARGS}
BUILD_COMMAND
......
......@@ -29,11 +29,12 @@
#include "utils/Log.h"
#include "utils/TimeRecorder.h"
namespace milvus::server::web {
#define WEB_LOG_PREFIX "[Web] "
namespace milvus {
namespace server {
namespace web {
#define ADD_DEFAULT_CORS(endpoint) \
ADD_CORS(endpoint, "*", "OPTIONS, GET, POST, PUT, DELETE")
class WebController : public oatpp::web::server::api::ApiController {
public:
......@@ -52,7 +53,7 @@ class WebController : public oatpp::web::server::api::ApiController {
*/
#include OATPP_CODEGEN_BEGIN(ApiController)
ADD_CORS(root)
ADD_DEFAULT_CORS(root)
ENDPOINT("GET", "/", root) {
auto response = createResponse(Status::CODE_200, "Welcome to milvus");
......@@ -60,7 +61,7 @@ class WebController : public oatpp::web::server::api::ApiController {
return response;
}
ADD_CORS(State)
ADD_DEFAULT_CORS(State)
ENDPOINT("GET", "/state", State) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/state\'");
......@@ -68,7 +69,7 @@ class WebController : public oatpp::web::server::api::ApiController {
return createDtoResponse(Status::CODE_200, StatusDto::createShared());
}
ADD_CORS(GetDevices)
ADD_DEFAULT_CORS(GetDevices)
ENDPOINT("GET", "/devices", GetDevices) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/devices\'");
......@@ -78,7 +79,7 @@ class WebController : public oatpp::web::server::api::ApiController {
WebRequestHandler handler = WebRequestHandler();
auto status_dto = handler.GetDevices(devices_dto);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, devices_dto);
break;
......@@ -86,19 +87,19 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(AdvancedConfigOptions)
ADD_DEFAULT_CORS(AdvancedConfigOptions)
ENDPOINT("OPTIONS", "/config/advanced", AdvancedConfigOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(GetAdvancedConfig)
ADD_DEFAULT_CORS(GetAdvancedConfig)
ENDPOINT("GET", "/config/advanced", GetAdvancedConfig) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/config/advanced\'");
......@@ -109,7 +110,7 @@ class WebController : public oatpp::web::server::api::ApiController {
auto status_dto = handler.GetAdvancedConfig(config_dto);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, config_dto);
break;
......@@ -117,15 +118,15 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(SetAdvancedConfig)
ADD_DEFAULT_CORS(SetAdvancedConfig)
ENDPOINT("PUT", "/config/advanced", SetAdvancedConfig, BODY_DTO(AdvancedConfigDto::ObjectWrapper, body)) {
ENDPOINT("PUT", "/config/advanced", SetAdvancedConfig, BODY_DTO(AdvancedConfigDtoT, body)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/config/advanced\'");
tr.RecordSection("Received request.");
......@@ -133,7 +134,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.SetAdvancedConfig(body);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, status_dto);
break;
......@@ -141,7 +142,7 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
......@@ -149,13 +150,13 @@ class WebController : public oatpp::web::server::api::ApiController {
#ifdef MILVUS_GPU_VERSION
ADD_CORS(GPUConfigOptions)
ADD_DEFAULT_CORS(GPUConfigOptions)
ENDPOINT("OPTIONS", "/config/gpu_resources", GPUConfigOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(GetGPUConfig)
ADD_DEFAULT_CORS(GetGPUConfig)
ENDPOINT("GET", "/config/gpu_resources", GetGPUConfig) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/config/gpu_resources\'");
......@@ -166,7 +167,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.GetGpuConfig(gpu_config_dto);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, gpu_config_dto);
break;
......@@ -174,16 +175,16 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
}
ADD_CORS(SetGPUConfig)
ADD_DEFAULT_CORS(SetGPUConfig)
ENDPOINT("PUT", "/config/gpu_resources", SetGPUConfig, BODY_DTO(GPUConfigDto::ObjectWrapper, body)) {
ENDPOINT("PUT", "/config/gpu_resources", SetGPUConfig, BODY_DTO(Object<GPUConfigDto>, body)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/config/gpu_resources\'");
tr.RecordSection("Received request.");
......@@ -191,7 +192,7 @@ class WebController : public oatpp::web::server::api::ApiController {
auto status_dto = handler.SetGpuConfig(body);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, status_dto);
break;
......@@ -199,7 +200,7 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
......@@ -207,13 +208,13 @@ class WebController : public oatpp::web::server::api::ApiController {
#endif
ADD_CORS(CollectionsOptions)
ADD_DEFAULT_CORS(CollectionsOptions)
ENDPOINT("OPTIONS", "/collections", CollectionsOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(CreateCollection)
ADD_DEFAULT_CORS(CreateCollection)
ENDPOINT("POST", "/collections", CreateCollection, BODY_STRING(String, body_str)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "POST \'/collections\'");
......@@ -223,7 +224,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.CreateCollection(body_str);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_201, status_dto);
break;
......@@ -231,16 +232,16 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
}
ADD_CORS(ShowCollections)
ADD_DEFAULT_CORS(ShowCollections)
ENDPOINT("GET", "/collections", ShowCollections, QUERIES(const QueryParams&, query_params)) {
ENDPOINT("GET", "/collections", ShowCollections, QUERIES(QueryParams, query_params)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/collections\'");
tr.RecordSection("Received request.");
......@@ -249,7 +250,7 @@ class WebController : public oatpp::web::server::api::ApiController {
String result;
auto status_dto = handler.ShowCollections(query_params, result);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createResponse(Status::CODE_200, result);
break;
......@@ -257,7 +258,7 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
......@@ -283,16 +284,16 @@ class WebController : public oatpp::web::server::api::ApiController {
return response;
}
ADD_CORS(CollectionOptions)
ADD_DEFAULT_CORS(CollectionOptions)
ENDPOINT("OPTIONS", "/collections/{collection_name}", CollectionOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(GetCollection)
ADD_DEFAULT_CORS(GetCollection)
ENDPOINT("GET", "/collections/{collection_name}", GetCollection, PATH(String, collection_name),
QUERIES(const QueryParams&, query_params)) {
QUERIES(QueryParams, query_params)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/collections/" + collection_name->std_str() + "\'");
tr.RecordSection("Received request.");
......@@ -302,7 +303,7 @@ class WebController : public oatpp::web::server::api::ApiController {
auto status_dto = handler.GetCollection(collection_name, query_params, response_str);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createResponse(Status::CODE_200, response_str);
break;
......@@ -313,7 +314,7 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
......@@ -333,7 +334,7 @@ class WebController : public oatpp::web::server::api::ApiController {
return response;
}
ADD_CORS(DropCollection)
ADD_DEFAULT_CORS(DropCollection)
ENDPOINT("DELETE", "/collections/{collection_name}", DropCollection, PATH(String, collection_name)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "DELETE \'/collections/" + collection_name->std_str() + "\'");
......@@ -343,7 +344,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.DropCollection(collection_name);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_204, status_dto);
break;
......@@ -354,20 +355,20 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
}
ADD_CORS(IndexOptions)
ADD_DEFAULT_CORS(IndexOptions)
ENDPOINT("OPTIONS", "/collections/{collection_name}/indexes", IndexOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(CreateIndex)
ADD_DEFAULT_CORS(CreateIndex)
ENDPOINT("POST", "/collections/{collection_name}/fields/{field_name}/indexes/{index_name}", CreateIndex,
PATH(String, collection_name), PATH(String, field_name), PATH(String, index_name),
......@@ -379,7 +380,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.CreateIndex(collection_name, field_name, body);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_201, status_dto);
break;
......@@ -390,14 +391,14 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
}
// ADD_CORS(GetIndex)
// ADD_DEFAULT_CORS(GetIndex)
//
// ENDPOINT("GET", "/collections/{collection_name}/fields/{field_name}/indexes", GetIndex,
// PATH(String, collection_name), PATH(String, field_name)) {
......@@ -429,7 +430,7 @@ class WebController : public oatpp::web::server::api::ApiController {
// return response;
// }
ADD_CORS(DropIndex)
ADD_DEFAULT_CORS(DropIndex)
ENDPOINT("DELETE", "/collections/{collection_name}/fields/{field_name}/indexes/{index_name}", DropIndex,
PATH(String, collection_name), PATH(String, field_name), PATH(String, index_name)) {
......@@ -441,7 +442,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.DropIndex(collection_name, field_name);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_204, status_dto);
break;
......@@ -452,23 +453,23 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
std::string ttr = "Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
std::string ttr = "Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost";
tr.ElapseFromBegin(ttr);
return response;
}
ADD_CORS(PartitionsOptions)
ADD_DEFAULT_CORS(PartitionsOptions)
ENDPOINT("OPTIONS", "/collections/{collection_name}/partitions", PartitionsOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(CreatePartition)
ADD_DEFAULT_CORS(CreatePartition)
ENDPOINT("POST", "/collections/{collection_name}/partitions", CreatePartition, PATH(String, collection_name),
BODY_DTO(PartitionRequestDto::ObjectWrapper, body)) {
BODY_DTO(PartitionRequestDtoT, body)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "POST \'/collections/" + collection_name->std_str() +
"/partitions\'");
tr.RecordSection("Received request.");
......@@ -477,7 +478,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.CreatePartition(collection_name, body);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_201, status_dto);
break;
......@@ -488,16 +489,16 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(ShowPartitions)
ADD_DEFAULT_CORS(ShowPartitions)
ENDPOINT("GET", "/collections/{collection_name}/partitions", ShowPartitions, PATH(String, collection_name),
QUERIES(const QueryParams&, query_params)) {
QUERIES(QueryParams, query_params)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/collections/" + collection_name->std_str() +
"/partitions\'");
tr.RecordSection("Received request.");
......@@ -510,7 +511,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.ShowPartitions(collection_name, query_params, partition_list_dto);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_200, partition_list_dto);
break;
......@@ -521,13 +522,13 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(DropPartition)
ADD_DEFAULT_CORS(DropPartition)
ENDPOINT("DELETE", "/collections/{collection_name}/partitions", DropPartition, PATH(String, collection_name),
BODY_STRING(String, body)) {
......@@ -539,7 +540,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.DropPartition(collection_name, body);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_204, status_dto);
break;
......@@ -550,22 +551,22 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(GetEntities)
ADD_DEFAULT_CORS(GetEntities)
ENDPOINT("GET", "/collections/{collection_name}/partitions/{partition_tag}/entities", GetEntities,
PATH(String, collection_name), PATH(String, partition_tag), QUERIES(const QueryParams&, query_params),
PATH(String, collection_name), PATH(String, partition_tag), QUERIES(QueryParams, query_params),
BODY_STRING(String, body)) {
auto handler = WebRequestHandler();
String response;
auto status_dto = handler.GetEntity(collection_name, query_params, response);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
return createResponse(Status::CODE_200, response);
case StatusCode::COLLECTION_NOT_EXISTS:
......@@ -575,10 +576,10 @@ class WebController : public oatpp::web::server::api::ApiController {
}
}
ADD_CORS(ShowSegments)
ADD_DEFAULT_CORS(ShowSegments)
ENDPOINT("GET", "/collections/{collection_name}/segments", ShowSegments, PATH(String, collection_name),
QUERIES(const QueryParams&, query_params)) {
QUERIES(QueryParams, query_params)) {
auto offset = query_params.get("offset");
auto page_size = query_params.get("page_size");
......@@ -586,7 +587,7 @@ class WebController : public oatpp::web::server::api::ApiController {
String response;
auto status_dto = handler.ShowSegments(collection_name, query_params, response);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
return createResponse(Status::CODE_200, response);
case StatusCode::COLLECTION_NOT_EXISTS:
......@@ -596,14 +597,14 @@ class WebController : public oatpp::web::server::api::ApiController {
}
}
ADD_CORS(GetSegmentInfo)
ADD_DEFAULT_CORS(GetSegmentInfo)
/**
*
* GetSegmentVector
*/
ENDPOINT("GET", "/collections/{collection_name}/segments/{segment_name}/{info}", GetSegmentInfo,
PATH(String, collection_name), PATH(String, segment_name), PATH(String, info),
QUERIES(const QueryParams&, query_params)) {
QUERIES(QueryParams, query_params)) {
auto offset = query_params.get("offset");
auto page_size = query_params.get("page_size");
......@@ -611,7 +612,7 @@ class WebController : public oatpp::web::server::api::ApiController {
String response;
auto status_dto = handler.GetSegmentInfo(collection_name, segment_name, info, query_params, response);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
return createResponse(Status::CODE_200, response);
case StatusCode::COLLECTION_NOT_EXISTS:
......@@ -621,13 +622,13 @@ class WebController : public oatpp::web::server::api::ApiController {
}
}
ADD_CORS(VectorsOptions)
ADD_DEFAULT_CORS(VectorsOptions)
ENDPOINT("OPTIONS", "/collections/{collection_name}/entities", VectorsOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(InsertEntity)
ADD_DEFAULT_CORS(InsertEntity)
ENDPOINT("POST", "/hybrid_collections/{collection_name}/entities", InsertEntity, PATH(String, collection_name),
BODY_STRING(String, body)) {
......@@ -640,7 +641,7 @@ class WebController : public oatpp::web::server::api::ApiController {
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.InsertEntity(collection_name, body, ids_dto);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createDtoResponse(Status::CODE_201, ids_dto);
break;
......@@ -651,13 +652,13 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(EntityOp)
ADD_DEFAULT_CORS(EntityOp)
ENDPOINT("PUT", "/hybrid_collections/{collection_name}/entities", EntityOp, PATH(String, collection_name),
BODY_STRING(String, body)) {
......@@ -670,7 +671,7 @@ class WebController : public oatpp::web::server::api::ApiController {
OString result;
std::shared_ptr<OutgoingResponse> response;
auto status_dto = handler.EntityOp(collection_name, body, result);
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createResponse(Status::CODE_200, result);
break;
......@@ -681,21 +682,21 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(SystemOptions)
ADD_DEFAULT_CORS(SystemOptions)
ENDPOINT("OPTIONS", "/system/{info}", SystemOptions) {
return createResponse(Status::CODE_204, "No Content");
}
ADD_CORS(SystemInfo)
ADD_DEFAULT_CORS(SystemInfo)
ENDPOINT("GET", "/system/{info}", SystemInfo, PATH(String, info), QUERIES(const QueryParams&, query_params)) {
ENDPOINT("GET", "/system/{info}", SystemInfo, PATH(String, info), QUERIES(QueryParams, query_params)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "GET \'/system/" + info->std_str() + "\'");
tr.RecordSection("Received request.");
......@@ -703,7 +704,7 @@ class WebController : public oatpp::web::server::api::ApiController {
OString result = "";
auto status_dto = handler.SystemInfo(info, query_params, result);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createResponse(Status::CODE_200, result);
break;
......@@ -711,13 +712,13 @@ class WebController : public oatpp::web::server::api::ApiController {
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
}
ADD_CORS(SystemOp)
ADD_DEFAULT_CORS(SystemOp)
ENDPOINT("PUT", "/system/{op}", SystemOp, PATH(String, op), BODY_STRING(String, body_str)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/system/" + op->std_str() + "\'");
......@@ -730,14 +731,14 @@ class WebController : public oatpp::web::server::api::ApiController {
auto status_dto = handler.SystemOp(op, body_str, response_str);
std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) {
switch (*(status_dto->code)) {
case StatusCode::SUCCESS:
response = createResponse(Status::CODE_200, response_str);
break;
default:
response = createDtoResponse(Status::CODE_400, status_dto);
}
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(status_dto->code->getValue()) +
tr.ElapseFromBegin("Done. Status: code = " + std::to_string(*(status_dto->code)) +
", reason = " + status_dto->message->std_str() + ". Total cost");
return response;
......@@ -749,6 +750,5 @@ class WebController : public oatpp::web::server::api::ApiController {
#include OATPP_CODEGEN_END(ApiController)
};
} // namespace web
} // namespace server
} // namespace milvus
} // namespace milvus::server::web
......@@ -15,14 +15,12 @@
#include "server/web_impl/dto/StatusDto.hpp"
#include "server/web_impl/Constants.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class CollectionRequestDto : public oatpp::data::mapping::type::Object {
DTO_INIT(CollectionRequestDto, Object)
class CollectionRequestDto : public ODTO {
DTO_INIT(CollectionRequestDto, DTO)
DTO_FIELD(String, collection_name, "collection_name");
DTO_FIELD(Int64, dimension, "dimension");
......@@ -30,8 +28,8 @@ class CollectionRequestDto : public oatpp::data::mapping::type::Object {
DTO_FIELD(String, metric_type, "metric_type") = VALUE_COLLECTION_METRIC_TYPE_DEFAULT;
};
class CollectionFieldsDto : public oatpp::data::mapping::type::Object {
DTO_INIT(CollectionFieldsDto, Object)
class CollectionFieldsDto : public ODTO {
DTO_INIT(CollectionFieldsDto, DTO)
DTO_FIELD(String, collection_name);
DTO_FIELD(Int64, dimension);
......@@ -42,21 +40,19 @@ class CollectionFieldsDto : public oatpp::data::mapping::type::Object {
DTO_FIELD(String, index_params);
};
class CollectionListDto : public OObject {
DTO_INIT(CollectionListDto, Object)
class CollectionListDto : public ODTO {
DTO_INIT(CollectionListDto, DTO)
DTO_FIELD(List<String>::ObjectWrapper, collection_names);
};
class CollectionListFieldsDto : public OObject {
DTO_INIT(CollectionListFieldsDto, Object)
class CollectionListFieldsDto : public ODTO {
DTO_INIT(CollectionListFieldsDto, DTO)
DTO_FIELD(List<CollectionFieldsDto::ObjectWrapper>::ObjectWrapper, collections);
DTO_FIELD(List<Object<CollectionFieldsDto>>, collections);
DTO_FIELD(Int64, count) = 0L;
};
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
\ No newline at end of file
} // namespace milvus::server::web
......@@ -14,14 +14,12 @@
#include "server/web_impl/Constants.h"
#include "server/web_impl/dto/Dto.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class AdvancedConfigDto : public OObject {
DTO_INIT(AdvancedConfigDto, Object);
class AdvancedConfigDto : public ODTO {
DTO_INIT(AdvancedConfigDto, DTO);
DTO_FIELD(Int64, cpu_cache_capacity) = VALUE_CONFIG_CPU_CACHE_CAPACITY_DEFAULT;
DTO_FIELD(Boolean, cache_insert_data) = VALUE_CONFIG_CACHE_INSERT_DATA_DEFAULT;
......@@ -33,8 +31,10 @@ class AdvancedConfigDto : public OObject {
#endif
};
class GPUConfigDto : public OObject {
DTO_INIT(GPUConfigDto, Object);
using AdvancedConfigDtoT = oatpp::Object<AdvancedConfigDto>;
class GPUConfigDto : public ODTO {
DTO_INIT(GPUConfigDto, DTO);
DTO_FIELD(Boolean, enable) = true;
DTO_FIELD(Int64, cache_capacity) = 1;
......@@ -44,6 +44,6 @@ class GPUConfigDto : public OObject {
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
using GPUConfigDtoT = oatpp::Object<GPUConfigDto>;
} // namespace milvus::server::web
......@@ -13,27 +13,25 @@
#include "server/web_impl/dto/Dto.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class DeviceInfoDto : public OObject {
DTO_INIT(DeviceInfoDto, Object);
class DeviceInfoDto : public ODTO {
DTO_INIT(DeviceInfoDto, DTO);
DTO_FIELD(Int64, memory);
};
class DevicesDto : public OObject {
DTO_INIT(DevicesDto, Object);
class DevicesDto : public ODTO {
DTO_INIT(DevicesDto, DTO);
DTO_FIELD(DeviceInfoDto::ObjectWrapper, cpu);
DTO_FIELD(Fields<DeviceInfoDto::ObjectWrapper>::ObjectWrapper, gpus);
DTO_FIELD(Object<DeviceInfoDto>, cpu);
DTO_FIELD(Fields<Object<DeviceInfoDto>>, gpus);
};
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
using DevicesDtoT = oatpp::Object<DevicesDto>;
} // namespace milvus::server::web
......@@ -18,7 +18,7 @@ namespace milvus {
namespace server {
namespace web {
using OObject = oatpp::data::mapping::type::Object;
using ODTO = oatpp::DTO;
}
} // namespace server
} // namespace milvus
......@@ -15,24 +15,20 @@
#include "server/web_impl/dto/StatusDto.hpp"
#include "server/web_impl/Constants.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class IndexRequestDto : public oatpp::data::mapping::type::Object {
DTO_INIT(IndexRequestDto, Object)
class IndexRequestDto : public ODTO {
DTO_INIT(IndexRequestDto, DTO)
DTO_FIELD(String, index_type) = VALUE_INDEX_INDEX_TYPE_DEFAULT;
DTO_FIELD(String, params) = VALUE_INDEX_NLIST_DEFAULT;
DTO_FIELD(String, params);
};
using IndexDto = IndexRequestDto;
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
} // namespace milvus::server::web
......@@ -14,29 +14,28 @@
#include "server/web_impl/dto/Dto.h"
#include "server/web_impl/dto/StatusDto.hpp"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class PartitionRequestDto : public oatpp::data::mapping::type::Object {
DTO_INIT(PartitionRequestDto, Object)
class PartitionRequestDto : public ODTO {
DTO_INIT(PartitionRequestDto, DTO)
DTO_FIELD(String, partition_tag);
};
using PartitionFieldsDto = PartitionRequestDto;
class PartitionListDto : public oatpp::data::mapping::type::Object {
DTO_INIT(PartitionListDto, Object)
class PartitionListDto : public ODTO {
DTO_INIT(PartitionListDto, DTO)
DTO_FIELD(List<PartitionFieldsDto::ObjectWrapper>::ObjectWrapper, partitions);
DTO_FIELD(List<Object<PartitionFieldsDto>>, partitions);
DTO_FIELD(Int64, count) = 0L;
};
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
using PartitionRequestDtoT = oatpp::Object<PartitionRequestDto>;
using PartitionListDtoT = oatpp::Object<PartitionListDto>;
} // namespace milvus::server::web
......@@ -13,15 +13,13 @@
#include "server/web_impl/dto/Dto.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class StatusDto: public oatpp::data::mapping::type::Object {
class StatusDto: public ODTO {
DTO_INIT(StatusDto, Object)
DTO_INIT(StatusDto, DTO)
DTO_FIELD(String, message) = "Success";
DTO_FIELD(Int64, code) = 0L;
......@@ -29,6 +27,7 @@ class StatusDto: public oatpp::data::mapping::type::Object {
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
using StatusDtoT = oatpp::Object<StatusDto>;
} // namespace milvus::server::web
......@@ -14,20 +14,18 @@
#include "server/web_impl/dto/Dto.h"
#include "server/web_impl/Constants.h"
namespace milvus {
namespace server {
namespace web {
namespace milvus::server::web {
#include OATPP_CODEGEN_BEGIN(DTO)
class VectorIdsDto : public oatpp::data::mapping::type::Object {
DTO_INIT(VectorIdsDto, Object)
class VectorIdsDto : public ODTO {
DTO_INIT(VectorIdsDto, DTO)
DTO_FIELD(List<String>::ObjectWrapper, ids);
DTO_FIELD(List<String>, ids);
};
#include OATPP_CODEGEN_END(DTO)
} // namespace web
} // namespace server
} // namespace milvus
using VectorIdsDtoT = oatpp::Object<VectorIdsDto>;
} // namespace milvus::server::web
......@@ -835,14 +835,14 @@ WebRequestHandler::GetEntityByIDs(const std::string& collection_name, const std:
}
////////////////////////////////// Router methods ////////////////////////////////////////////
StatusDto::ObjectWrapper
WebRequestHandler::GetDevices(DevicesDto::ObjectWrapper& devices_dto) {
auto system_info = SystemInfo::GetInstance();
StatusDtoT
WebRequestHandler::GetDevices(DevicesDtoT& devices_dto) {
auto& system_info = SystemInfo::GetInstance();
devices_dto->cpu = devices_dto->cpu->createShared();
devices_dto->cpu->memory = system_info.GetPhysicalMemory() >> 30;
devices_dto->gpus = devices_dto->gpus->createShared();
devices_dto->gpus = devices_dto->gpus.createShared();
#ifdef MILVUS_GPU_VERSION
size_t count = system_info.num_device();
......@@ -855,15 +855,15 @@ WebRequestHandler::GetDevices(DevicesDto::ObjectWrapper& devices_dto) {
for (size_t i = 0; i < count; i++) {
auto device_dto = DeviceInfoDto::createShared();
device_dto->memory = device_mems.at(i) >> 30;
devices_dto->gpus->put("GPU" + OString(std::to_string(i).c_str()), device_dto);
devices_dto->gpus->emplace_back("GPU" + OString(std::to_string(i).c_str()), device_dto);
}
#endif
ASSIGN_RETURN_STATUS_DTO(Status::OK());
}
StatusDto::ObjectWrapper
WebRequestHandler::GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& advanced_config) {
StatusDtoT
WebRequestHandler::GetAdvancedConfig(AdvancedConfigDtoT& advanced_config) {
// std::string reply;
// std::string cache_cmd_prefix = "get_config " + std::string(CONFIG_CACHE) + ".";
//
......@@ -902,8 +902,8 @@ WebRequestHandler::GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& advanced_
ASSIGN_RETURN_STATUS_DTO(Status::OK());
}
StatusDto::ObjectWrapper
WebRequestHandler::SetAdvancedConfig(const AdvancedConfigDto::ObjectWrapper& advanced_config) {
StatusDtoT
WebRequestHandler::SetAdvancedConfig(const AdvancedConfigDtoT& advanced_config) {
// if (nullptr == advanced_config->cpu_cache_capacity.get()) {
// RETURN_STATUS_DTO(BODY_FIELD_LOSS, "Field \'cpu_cache_capacity\' miss.");
// }
......@@ -964,8 +964,8 @@ WebRequestHandler::SetAdvancedConfig(const AdvancedConfigDto::ObjectWrapper& adv
#ifdef MILVUS_GPU_VERSION
StatusDto::ObjectWrapper
WebRequestHandler::GetGpuConfig(GPUConfigDto::ObjectWrapper& gpu_config_dto) {
StatusDtoT
WebRequestHandler::GetGpuConfig(GPUConfigDtoT& gpu_config_dto) {
// std::string reply;
// std::string gpu_cmd_prefix = "get_config " + std::string(CONFIG_GPU_RESOURCE) + ".";
//
......@@ -1018,8 +1018,8 @@ WebRequestHandler::GetGpuConfig(GPUConfigDto::ObjectWrapper& gpu_config_dto) {
ASSIGN_RETURN_STATUS_DTO(Status::OK());
}
StatusDto::ObjectWrapper
WebRequestHandler::SetGpuConfig(const GPUConfigDto::ObjectWrapper& gpu_config_dto) {
StatusDtoT
WebRequestHandler::SetGpuConfig(const GPUConfigDtoT& gpu_config_dto) {
// // Step 1: Check config param
// if (nullptr == gpu_config_dto->enable.get()) {
// RETURN_STATUS_DTO(BODY_FIELD_LOSS, "Field \'enable\' miss")
......@@ -1109,7 +1109,7 @@ WebRequestHandler::SetGpuConfig(const GPUConfigDto::ObjectWrapper& gpu_config_dt
*
* Collection {
*/
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::CreateCollection(const milvus::server::web::OString& body) {
auto json_str = nlohmann::json::parse(body->c_str());
std::string collection_name = json_str["collection_name"];
......@@ -1141,7 +1141,7 @@ WebRequestHandler::CreateCollection(const milvus::server::web::OString& body) {
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::ShowCollections(const OQueryParams& query_params, OString& result) {
int64_t offset = 0;
auto status = ParseQueryInteger(query_params, "offset", offset);
......@@ -1202,7 +1202,7 @@ WebRequestHandler::ShowCollections(const OQueryParams& query_params, OString& re
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::GetCollection(const OString& collection_name, const OQueryParams& query_params, OString& result) {
if (nullptr == collection_name.get()) {
RETURN_STATUS_DTO(PATH_PARAM_LOSS, "Path param \'collection_name\' is required!");
......@@ -1227,7 +1227,7 @@ WebRequestHandler::GetCollection(const OString& collection_name, const OQueryPar
ASSIGN_RETURN_STATUS_DTO(status);
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::DropCollection(const OString& collection_name) {
auto status = req_handler_.DropCollection(context_ptr_, collection_name->std_str());
......@@ -1239,7 +1239,7 @@ WebRequestHandler::DropCollection(const OString& collection_name) {
* Index {
*/
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::CreateIndex(const OString& collection_name, const OString& field_name, const OString& body) {
try {
auto request_json = nlohmann::json::parse(body->std_str());
......@@ -1259,14 +1259,14 @@ WebRequestHandler::CreateIndex(const OString& collection_name, const OString& fi
ASSIGN_RETURN_STATUS_DTO(Status::OK())
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::DropIndex(const OString& collection_name, const OString& field_name) {
auto status = req_handler_.DropIndex(context_ptr_, collection_name->std_str(), field_name->std_str(), "");
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
WebRequestHandler::CreatePartition(const OString& collection_name, const PartitionRequestDto::ObjectWrapper& param) {
StatusDtoT
WebRequestHandler::CreatePartition(const OString& collection_name, const PartitionRequestDtoT& param) {
if (nullptr == param->partition_tag.get()) {
RETURN_STATUS_DTO(BODY_FIELD_LOSS, "Field \'partition_tag\' is required")
}
......@@ -1277,9 +1277,9 @@ WebRequestHandler::CreatePartition(const OString& collection_name, const Partiti
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryParams& query_params,
PartitionListDto::ObjectWrapper& partition_list_dto) {
PartitionListDtoT& partition_list_dto) {
int64_t offset = 0;
auto status = ParseQueryInteger(query_params, "offset", offset);
if (!status.ok()) {
......@@ -1322,20 +1322,20 @@ WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryPa
}
partition_list_dto->count = partition_names.size();
partition_list_dto->partitions = partition_list_dto->partitions->createShared();
partition_list_dto->partitions = partition_list_dto->partitions.createShared();
if (offset < (int64_t)(partition_names.size())) {
for (int64_t i = offset; i < page_size + offset; i++) {
auto partition_dto = PartitionFieldsDto::createShared();
partition_dto->partition_tag = partition_names.at(i).c_str();
partition_list_dto->partitions->pushBack(partition_dto);
partition_list_dto->partitions->push_back(partition_dto);
}
}
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::DropPartition(const OString& collection_name, const OString& body) {
std::string tag;
try {
......@@ -1355,7 +1355,7 @@ WebRequestHandler::DropPartition(const OString& collection_name, const OString&
*
* Segment {
*/
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::ShowSegments(const OString& collection_name, const OQueryParams& query_params, OString& response) {
int64_t offset = 0;
auto status = ParseQueryInteger(query_params, "offset", offset);
......@@ -1429,7 +1429,7 @@ WebRequestHandler::ShowSegments(const OString& collection_name, const OQueryPara
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::GetSegmentInfo(const OString& collection_name, const OString& segment_name, const OString& info,
const OQueryParams& query_params, OString& result) {
int64_t offset = 0;
......@@ -1471,9 +1471,9 @@ WebRequestHandler::GetSegmentInfo(const OString& collection_name, const OString&
*
* Vector
*/
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::InsertEntity(const OString& collection_name, const milvus::server::web::OString& body,
VectorIdsDto::ObjectWrapper& ids_dto) {
VectorIdsDtoT& ids_dto) {
if (nullptr == body.get() || body->getSize() == 0) {
RETURN_STATUS_DTO(BODY_FIELD_LOSS, "Request payload is required.")
}
......@@ -1547,14 +1547,14 @@ WebRequestHandler::InsertEntity(const OString& collection_name, const milvus::se
int64_t count = pair->second.size() / 8;
int64_t* pdata = reinterpret_cast<int64_t*>(pair->second.data());
for (int64_t i = 0; i < count; ++i) {
ids_dto->ids->pushBack(std::to_string(pdata[i]).c_str());
ids_dto->ids->push_back(std::to_string(pdata[i]).c_str());
}
}
ASSIGN_RETURN_STATUS_DTO(status)
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::GetEntity(const milvus::server::web::OString& collection_name,
const milvus::server::web::OQueryParams& query_params,
milvus::server::web::OString& response) {
......@@ -1600,7 +1600,7 @@ WebRequestHandler::GetEntity(const milvus::server::web::OString& collection_name
ASSIGN_RETURN_STATUS_DTO(status);
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::EntityOp(const OString& collection_name, const OString& payload, OString& response) {
auto status = Status::OK();
std::string result_str;
......@@ -1634,7 +1634,7 @@ WebRequestHandler::EntityOp(const OString& collection_name, const OString& paylo
*
* System {
*/
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::SystemInfo(const OString& cmd, const OQueryParams& query_params, OString& response_str) {
std::string info = cmd->std_str();
......@@ -1663,7 +1663,7 @@ WebRequestHandler::SystemInfo(const OString& cmd, const OQueryParams& query_para
ASSIGN_RETURN_STATUS_DTO(status);
}
StatusDto::ObjectWrapper
StatusDtoT
WebRequestHandler::SystemOp(const OString& op, const OString& body_str, OString& response_str) {
if (nullptr == body_str.get() || body_str->getSize() == 0) {
RETURN_STATUS_DTO(BODY_FIELD_LOSS, "Payload is empty.");
......
......@@ -152,59 +152,59 @@ class WebRequestHandler {
}
public:
StatusDto::ObjectWrapper
GetDevices(DevicesDto::ObjectWrapper& devices);
StatusDtoT
GetDevices(DevicesDtoT& devices);
StatusDto::ObjectWrapper
GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& config);
StatusDtoT
GetAdvancedConfig(AdvancedConfigDtoT& config);
StatusDto::ObjectWrapper
SetAdvancedConfig(const AdvancedConfigDto::ObjectWrapper& config);
StatusDtoT
SetAdvancedConfig(const AdvancedConfigDtoT& config);
#ifdef MILVUS_GPU_VERSION
StatusDto::ObjectWrapper
GetGpuConfig(GPUConfigDto::ObjectWrapper& gpu_config_dto);
StatusDtoT
GetGpuConfig(GPUConfigDtoT& gpu_config_dto);
StatusDto::ObjectWrapper
SetGpuConfig(const GPUConfigDto::ObjectWrapper& gpu_config_dto);
StatusDtoT
SetGpuConfig(const GPUConfigDtoT& gpu_config_dto);
#endif
StatusDto::ObjectWrapper
StatusDtoT
CreateCollection(const milvus::server::web::OString& body);
StatusDto::ObjectWrapper
StatusDtoT
ShowCollections(const OQueryParams& query_params, OString& result);
StatusDto::ObjectWrapper
StatusDtoT
GetCollection(const OString& collection_name, const OQueryParams& query_params, OString& result);
StatusDto::ObjectWrapper
StatusDtoT
DropCollection(const OString& collection_name);
StatusDto::ObjectWrapper
StatusDtoT
CreateIndex(const OString& collection_name, const OString& field_name, const OString& body);
StatusDto::ObjectWrapper
StatusDtoT
DropIndex(const OString& collection_name, const OString& field_name);
StatusDto::ObjectWrapper
CreatePartition(const OString& collection_name, const PartitionRequestDto::ObjectWrapper& param);
StatusDtoT
CreatePartition(const OString& collection_name, const PartitionRequestDtoT& param);
StatusDto::ObjectWrapper
StatusDtoT
ShowPartitions(const OString& collection_name, const OQueryParams& query_params,
PartitionListDto::ObjectWrapper& partition_list_dto);
PartitionListDtoT& partition_list_dto);
StatusDto::ObjectWrapper
StatusDtoT
DropPartition(const OString& collection_name, const OString& body);
/***********
*
* Segment
*/
StatusDto::ObjectWrapper
StatusDtoT
ShowSegments(const OString& collection_name, const OQueryParams& query_params, OString& response);
StatusDto::ObjectWrapper
StatusDtoT
GetSegmentInfo(const OString& collection_name, const OString& segment_name, const OString& info,
const OQueryParams& query_params, OString& result);
......@@ -212,26 +212,26 @@ class WebRequestHandler {
*
* Vector
*/
StatusDto::ObjectWrapper
InsertEntity(const OString& collection_name, const OString& body, VectorIdsDto::ObjectWrapper& ids_dto);
StatusDtoT
InsertEntity(const OString& collection_name, const OString& body, VectorIdsDtoT& ids_dto);
StatusDto::ObjectWrapper
StatusDtoT
GetEntity(const OString& collection_name, const OQueryParams& query_params, OString& response);
StatusDto::ObjectWrapper
StatusDtoT
GetVector(const OString& collection_name, const OQueryParams& query_params, OString& response);
StatusDto::ObjectWrapper
StatusDtoT
EntityOp(const OString& collection_name, const OString& payload, OString& response);
/**
*
* System
*/
StatusDto::ObjectWrapper
StatusDtoT
SystemInfo(const OString& cmd, const OQueryParams& query_params, OString& response_str);
StatusDto::ObjectWrapper
StatusDtoT
SystemOp(const OString& op, const OString& body_str, OString& response_str);
public:
......
......@@ -10,7 +10,7 @@ GRPC_VERSION=4b1c02a7edd03a2fec7dec48f37186306c456378
ZLIB_VERSION=v1.2.11
OPENTRACING_VERSION=v1.5.1
FIU_VERSION=1.00
OATPP_VERSION=1.0.1
OATPP_VERSION=1.1.0
AWS_VERSION=1.7.250
# vim: set filetype=sh:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册