Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
b729d042
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b729d042
编写于
3月 07, 2020
作者:
G
groot
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'source/master'
上级
e0886f84
0fcdc31c
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
518 addition
and
480 deletion
+518
-480
CHANGELOG.md
CHANGELOG.md
+2
-0
core/src/config/handler/ConfigHandler.h
core/src/config/handler/ConfigHandler.h
+0
-1
core/src/db/engine/ExecutionEngineImpl.cpp
core/src/db/engine/ExecutionEngineImpl.cpp
+12
-0
core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp
...x/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp
+4
-1
core/src/server/Config.cpp
core/src/server/Config.cpp
+10
-5
core/src/server/web_impl/controller/WebController.hpp
core/src/server/web_impl/controller/WebController.hpp
+55
-60
core/src/server/web_impl/dto/TableDto.hpp
core/src/server/web_impl/dto/TableDto.hpp
+4
-4
core/src/server/web_impl/dto/VectorDto.hpp
core/src/server/web_impl/dto/VectorDto.hpp
+0
-20
core/src/server/web_impl/handler/WebRequestHandler.cpp
core/src/server/web_impl/handler/WebRequestHandler.cpp
+120
-102
core/src/server/web_impl/handler/WebRequestHandler.h
core/src/server/web_impl/handler/WebRequestHandler.h
+3
-0
core/src/utils/StringHelpFunctions.cpp
core/src/utils/StringHelpFunctions.cpp
+17
-4
core/src/utils/StringHelpFunctions.h
core/src/utils/StringHelpFunctions.h
+6
-0
core/unittest/server/test_web.cpp
core/unittest/server/test_web.cpp
+285
-283
未找到文件。
CHANGELOG.md
浏览文件 @
b729d042
...
@@ -39,6 +39,7 @@ Please mark all change in change log and use the issue from GitHub
...
@@ -39,6 +39,7 @@ Please mark all change in change log and use the issue from GitHub
-
\#
1518 Table count did not match after deleting vectors and compact
-
\#
1518 Table count did not match after deleting vectors and compact
-
\#
1521 Make cache_insert_data take effect in-service
-
\#
1521 Make cache_insert_data take effect in-service
-
\#
1525 Add setter API for config preload_table
-
\#
1525 Add setter API for config preload_table
-
\#
1529 Fix server crash when cache_insert_data enabled
-
\#
1530 Set table file with correct engine type in meta
-
\#
1530 Set table file with correct engine type in meta
-
\#
1532 Search with ivf_flat failed with open-dataset: sift-256-hamming
-
\#
1532 Search with ivf_flat failed with open-dataset: sift-256-hamming
-
\#
1535 Degradation searching performance with metric_type: binary_idmap
-
\#
1535 Degradation searching performance with metric_type: binary_idmap
...
@@ -90,6 +91,7 @@ Please mark all change in change log and use the issue from GitHub
...
@@ -90,6 +91,7 @@ Please mark all change in change log and use the issue from GitHub
-
\#
1448 General proto api for NNS libraries
-
\#
1448 General proto api for NNS libraries
-
\#
1480 Add return code for AVX512 selection
-
\#
1480 Add return code for AVX512 selection
-
\#
1524 Update config "preload_table" description
-
\#
1524 Update config "preload_table" description
-
\#
1544 Update resources name in HTTP module
## Task
## Task
-
\#
1327 Exclude third-party code from codebeat
-
\#
1327 Exclude third-party code from codebeat
...
...
core/src/config/handler/ConfigHandler.h
浏览文件 @
b729d042
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
#include <string>
#include <string>
#include "server/Config.h"
#include "server/Config.h"
#include "utils/Log.h"
namespace
milvus
{
namespace
milvus
{
namespace
server
{
namespace
server
{
...
...
core/src/db/engine/ExecutionEngineImpl.cpp
浏览文件 @
b729d042
...
@@ -431,6 +431,7 @@ ExecutionEngineImpl::Load(bool to_cache) {
...
@@ -431,6 +431,7 @@ ExecutionEngineImpl::Load(bool to_cache) {
auto
vectors_uids
=
vectors
->
GetUids
();
auto
vectors_uids
=
vectors
->
GetUids
();
index_
->
SetUids
(
vectors_uids
);
index_
->
SetUids
(
vectors_uids
);
ENGINE_LOG_DEBUG
<<
"set uids "
<<
index_
->
GetUids
().
size
()
<<
" for index "
<<
location_
;
auto
vectors_data
=
vectors
->
GetData
();
auto
vectors_data
=
vectors
->
GetData
();
...
@@ -510,6 +511,7 @@ ExecutionEngineImpl::Load(bool to_cache) {
...
@@ -510,6 +511,7 @@ ExecutionEngineImpl::Load(bool to_cache) {
std
::
vector
<
segment
::
doc_id_t
>
uids
;
std
::
vector
<
segment
::
doc_id_t
>
uids
;
segment_reader_ptr
->
LoadUids
(
uids
);
segment_reader_ptr
->
LoadUids
(
uids
);
index_
->
SetUids
(
uids
);
index_
->
SetUids
(
uids
);
ENGINE_LOG_DEBUG
<<
"set uids "
<<
index_
->
GetUids
().
size
()
<<
" for index "
<<
location_
;
ENGINE_LOG_DEBUG
<<
"Finished loading index file from segment "
<<
segment_dir
;
ENGINE_LOG_DEBUG
<<
"Finished loading index file from segment "
<<
segment_dir
;
}
}
...
@@ -734,12 +736,19 @@ ExecutionEngineImpl::BuildIndex(const std::string& location, EngineType engine_t
...
@@ -734,12 +736,19 @@ ExecutionEngineImpl::BuildIndex(const std::string& location, EngineType engine_t
throw
Exception
(
DB_ERROR
,
"Illegal index params"
);
throw
Exception
(
DB_ERROR
,
"Illegal index params"
);
}
}
ENGINE_LOG_DEBUG
<<
"Index config: "
<<
conf
.
dump
();
ENGINE_LOG_DEBUG
<<
"Index config: "
<<
conf
.
dump
();
auto
status
=
Status
::
OK
();
auto
status
=
Status
::
OK
();
std
::
vector
<
segment
::
doc_id_t
>
uids
;
if
(
from_index
)
{
if
(
from_index
)
{
status
=
to_index
->
BuildAll
(
Count
(),
from_index
->
GetRawVectors
(),
from_index
->
GetRawIds
(),
conf
);
status
=
to_index
->
BuildAll
(
Count
(),
from_index
->
GetRawVectors
(),
from_index
->
GetRawIds
(),
conf
);
uids
=
from_index
->
GetUids
();
}
else
if
(
bin_from_index
)
{
}
else
if
(
bin_from_index
)
{
status
=
to_index
->
BuildAll
(
Count
(),
bin_from_index
->
GetRawVectors
(),
bin_from_index
->
GetRawIds
(),
conf
);
status
=
to_index
->
BuildAll
(
Count
(),
bin_from_index
->
GetRawVectors
(),
bin_from_index
->
GetRawIds
(),
conf
);
uids
=
bin_from_index
->
GetUids
();
}
}
to_index
->
SetUids
(
uids
);
ENGINE_LOG_DEBUG
<<
"set uids "
<<
to_index
->
GetUids
().
size
()
<<
" for "
<<
location
;
if
(
!
status
.
ok
())
{
if
(
!
status
.
ok
())
{
throw
Exception
(
DB_ERROR
,
status
.
message
());
throw
Exception
(
DB_ERROR
,
status
.
message
());
}
}
...
@@ -838,6 +847,7 @@ ExecutionEngineImpl::Search(int64_t n, const float* data, int64_t k, const milvu
...
@@ -838,6 +847,7 @@ ExecutionEngineImpl::Search(int64_t n, const float* data, int64_t k, const milvu
rc
.
RecordSection
(
"search done"
);
rc
.
RecordSection
(
"search done"
);
// map offsets to ids
// map offsets to ids
ENGINE_LOG_DEBUG
<<
"get uids "
<<
index_
->
GetUids
().
size
()
<<
" from index "
<<
location_
;
MapUids
(
index_
->
GetUids
(),
labels
,
n
*
k
);
MapUids
(
index_
->
GetUids
(),
labels
,
n
*
k
);
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
n
*
k
));
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
n
*
k
));
...
@@ -879,6 +889,7 @@ ExecutionEngineImpl::Search(int64_t n, const uint8_t* data, int64_t k, const mil
...
@@ -879,6 +889,7 @@ ExecutionEngineImpl::Search(int64_t n, const uint8_t* data, int64_t k, const mil
rc
.
RecordSection
(
"search done"
);
rc
.
RecordSection
(
"search done"
);
// map offsets to ids
// map offsets to ids
ENGINE_LOG_DEBUG
<<
"get uids "
<<
index_
->
GetUids
().
size
()
<<
" from index "
<<
location_
;
MapUids
(
index_
->
GetUids
(),
labels
,
n
*
k
);
MapUids
(
index_
->
GetUids
(),
labels
,
n
*
k
);
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
n
*
k
));
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
n
*
k
));
...
@@ -962,6 +973,7 @@ ExecutionEngineImpl::Search(int64_t n, const std::vector<int64_t>& ids, int64_t
...
@@ -962,6 +973,7 @@ ExecutionEngineImpl::Search(int64_t n, const std::vector<int64_t>& ids, int64_t
rc
.
RecordSection
(
"search done"
);
rc
.
RecordSection
(
"search done"
);
// map offsets to ids
// map offsets to ids
ENGINE_LOG_DEBUG
<<
"get uids "
<<
index_
->
GetUids
().
size
()
<<
" from index "
<<
location_
;
MapUids
(
uids
,
labels
,
offsets
.
size
()
*
k
);
MapUids
(
uids
,
labels
,
offsets
.
size
()
*
k
);
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
offsets
.
size
()
*
k
));
rc
.
RecordSection
(
"map uids "
+
std
::
to_string
(
offsets
.
size
()
*
k
));
...
...
core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp
浏览文件 @
b729d042
...
@@ -24,7 +24,10 @@ namespace cloner {
...
@@ -24,7 +24,10 @@ namespace cloner {
VectorIndexPtr
VectorIndexPtr
CopyGpuToCpu
(
const
VectorIndexPtr
&
index
,
const
Config
&
config
)
{
CopyGpuToCpu
(
const
VectorIndexPtr
&
index
,
const
Config
&
config
)
{
if
(
auto
device_index
=
std
::
dynamic_pointer_cast
<
GPUIndex
>
(
index
))
{
if
(
auto
device_index
=
std
::
dynamic_pointer_cast
<
GPUIndex
>
(
index
))
{
return
device_index
->
CopyGpuToCpu
(
config
);
VectorIndexPtr
result
=
device_index
->
CopyGpuToCpu
(
config
);
auto
uids
=
index
->
GetUids
();
result
->
SetUids
(
uids
);
return
result
;
}
else
{
}
else
{
KNOWHERE_THROW_MSG
(
"index type is not gpuindex"
);
KNOWHERE_THROW_MSG
(
"index type is not gpuindex"
);
}
}
...
...
core/src/server/Config.cpp
浏览文件 @
b729d042
...
@@ -549,9 +549,14 @@ Config::UpdateFileConfigFromMem(const std::string& parent_key, const std::string
...
@@ -549,9 +549,14 @@ Config::UpdateFileConfigFromMem(const std::string& parent_key, const std::string
// convert value string to standard string stored in yaml file
// convert value string to standard string stored in yaml file
std
::
string
value_str
;
std
::
string
value_str
;
if
(
child_key
==
CONFIG_CACHE_CACHE_INSERT_DATA
||
child_key
==
CONFIG_STORAGE_S3_ENABLE
||
if
(
child_key
==
CONFIG_CACHE_CACHE_INSERT_DATA
||
child_key
==
CONFIG_STORAGE_S3_ENABLE
||
child_key
==
CONFIG_METRIC_ENABLE_MONITOR
||
child_key
==
CONFIG_GPU_RESOURCE_ENABLE
)
{
child_key
==
CONFIG_METRIC_ENABLE_MONITOR
||
child_key
==
CONFIG_GPU_RESOURCE_ENABLE
||
value_str
=
child_key
==
CONFIG_WAL_ENABLE
||
child_key
==
CONFIG_WAL_RECOVERY_ERROR_IGNORE
)
{
(
value
==
"True"
||
value
==
"true"
||
value
==
"On"
||
value
==
"on"
||
value
==
"1"
)
?
"true"
:
"false"
;
bool
ok
=
false
;
status
=
StringHelpFunctions
::
ConvertToBoolean
(
value
,
ok
);
if
(
!
status
.
ok
())
{
return
status
;
}
value_str
=
ok
?
"true"
:
"false"
;
}
else
if
(
child_key
==
CONFIG_GPU_RESOURCE_SEARCH_RESOURCES
||
}
else
if
(
child_key
==
CONFIG_GPU_RESOURCE_SEARCH_RESOURCES
||
child_key
==
CONFIG_GPU_RESOURCE_BUILD_INDEX_RESOURCES
)
{
child_key
==
CONFIG_GPU_RESOURCE_BUILD_INDEX_RESOURCES
)
{
std
::
vector
<
std
::
string
>
vec
;
std
::
vector
<
std
::
string
>
vec
;
...
@@ -593,7 +598,6 @@ Config::UpdateFileConfigFromMem(const std::string& parent_key, const std::string
...
@@ -593,7 +598,6 @@ Config::UpdateFileConfigFromMem(const std::string& parent_key, const std::string
}
}
// values of gpu resources are sequences, need to remove old here
// values of gpu resources are sequences, need to remove old here
std
::
regex
reg
(
"
\\
S*"
);
if
(
child_key
==
CONFIG_GPU_RESOURCE_SEARCH_RESOURCES
||
child_key
==
CONFIG_GPU_RESOURCE_BUILD_INDEX_RESOURCES
)
{
if
(
child_key
==
CONFIG_GPU_RESOURCE_SEARCH_RESOURCES
||
child_key
==
CONFIG_GPU_RESOURCE_BUILD_INDEX_RESOURCES
)
{
while
(
getline
(
conf_fin
,
line
))
{
while
(
getline
(
conf_fin
,
line
))
{
if
(
line
.
find
(
"- gpu"
)
!=
std
::
string
::
npos
)
if
(
line
.
find
(
"- gpu"
)
!=
std
::
string
::
npos
)
...
@@ -1853,7 +1857,8 @@ Config::SetDBConfigBackendUrl(const std::string& value) {
...
@@ -1853,7 +1857,8 @@ Config::SetDBConfigBackendUrl(const std::string& value) {
Status
Status
Config
::
SetDBConfigPreloadTable
(
const
std
::
string
&
value
)
{
Config
::
SetDBConfigPreloadTable
(
const
std
::
string
&
value
)
{
CONFIG_CHECK
(
CheckDBConfigPreloadTable
(
value
));
CONFIG_CHECK
(
CheckDBConfigPreloadTable
(
value
));
return
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRELOAD_TABLE
,
value
);
std
::
string
cor_value
=
value
==
"*"
?
"
\'
*
\'
"
:
value
;
return
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRELOAD_TABLE
,
cor_value
);
}
}
Status
Status
...
...
core/src/server/web_impl/controller/WebController.hpp
浏览文件 @
b729d042
...
@@ -208,14 +208,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -208,14 +208,14 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
TablesOptions
)
ADD_CORS
(
TablesOptions
)
ENDPOINT
(
"OPTIONS"
,
"/
table
s"
,
TablesOptions
)
{
ENDPOINT
(
"OPTIONS"
,
"/
collection
s"
,
TablesOptions
)
{
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
}
}
ADD_CORS
(
CreateTable
)
ADD_CORS
(
CreateTable
)
ENDPOINT
(
"POST"
,
"/
table
s"
,
CreateTable
,
BODY_DTO
(
TableRequestDto
::
ObjectWrapper
,
body
))
{
ENDPOINT
(
"POST"
,
"/
collection
s"
,
CreateTable
,
BODY_DTO
(
TableRequestDto
::
ObjectWrapper
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
table
s
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
collection
s
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
...
@@ -238,8 +238,8 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -238,8 +238,8 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
ShowTables
)
ADD_CORS
(
ShowTables
)
ENDPOINT
(
"GET"
,
"/
table
s"
,
ShowTables
,
QUERIES
(
const
QueryParams
&
,
query_params
))
{
ENDPOINT
(
"GET"
,
"/
collection
s"
,
ShowTables
,
QUERIES
(
const
QueryParams
&
,
query_params
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
table
s
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
collection
s
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
...
@@ -265,21 +265,21 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -265,21 +265,21 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
TableOptions
)
ADD_CORS
(
TableOptions
)
ENDPOINT
(
"OPTIONS"
,
"/
tables/{table
_name}"
,
TableOptions
)
{
ENDPOINT
(
"OPTIONS"
,
"/
collections/{collection
_name}"
,
TableOptions
)
{
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
}
}
ADD_CORS
(
GetTable
)
ADD_CORS
(
GetTable
)
ENDPOINT
(
"GET"
,
"/
tables/{table
_name}"
,
GetTable
,
ENDPOINT
(
"GET"
,
"/
collections/{collection
_name}"
,
GetTable
,
PATH
(
String
,
table
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
PATH
(
String
,
collection
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
tables/"
+
table
_name
->
std_str
()
+
"
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
String
response_str
;
String
response_str
;
auto
status_dto
=
handler
.
GetTable
(
table
_name
,
query_params
,
response_str
);
auto
status_dto
=
handler
.
GetTable
(
collection
_name
,
query_params
,
response_str
);
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
...
@@ -302,14 +302,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -302,14 +302,14 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
DropTable
)
ADD_CORS
(
DropTable
)
ENDPOINT
(
"DELETE"
,
"/
tables/{table_name}"
,
DropTable
,
PATH
(
String
,
table
_name
))
{
ENDPOINT
(
"DELETE"
,
"/
collections/{collection_name}"
,
DropTable
,
PATH
(
String
,
collection
_name
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"DELETE
\'
/
tables/"
+
table
_name
->
std_str
()
+
"
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"DELETE
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
DropTable
(
table
_name
);
auto
status_dto
=
handler
.
DropTable
(
collection
_name
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
...
@@ -330,21 +330,21 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -330,21 +330,21 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
IndexOptions
)
ADD_CORS
(
IndexOptions
)
ENDPOINT
(
"OPTIONS"
,
"/
tables/{table
_name}/indexes"
,
IndexOptions
)
{
ENDPOINT
(
"OPTIONS"
,
"/
collections/{collection
_name}/indexes"
,
IndexOptions
)
{
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
}
}
ADD_CORS
(
CreateIndex
)
ADD_CORS
(
CreateIndex
)
ENDPOINT
(
"POST"
,
"/tables/{
table
_name}/indexes"
,
CreateIndex
,
ENDPOINT
(
"POST"
,
"/tables/{
collection
_name}/indexes"
,
CreateIndex
,
PATH
(
String
,
table
_name
),
BODY_STRING
(
String
,
body
))
{
PATH
(
String
,
collection
_name
),
BODY_STRING
(
String
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/tables/"
+
table
_name
->
std_str
()
+
"/indexes
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/tables/"
+
collection
_name
->
std_str
()
+
"/indexes
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
CreateIndex
(
table
_name
,
body
);
auto
status_dto
=
handler
.
CreateIndex
(
collection
_name
,
body
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_201
,
status_dto
);
response
=
createDtoResponse
(
Status
::
CODE_201
,
status_dto
);
...
@@ -365,14 +365,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -365,14 +365,14 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
GetIndex
)
ADD_CORS
(
GetIndex
)
ENDPOINT
(
"GET"
,
"/
tables/{table_name}/indexes"
,
GetIndex
,
PATH
(
String
,
table
_name
))
{
ENDPOINT
(
"GET"
,
"/
collections/{collection_name}/indexes"
,
GetIndex
,
PATH
(
String
,
collection
_name
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/indexes
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/indexes
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
OString
result
;
OString
result
;
auto
status_dto
=
handler
.
GetIndex
(
table
_name
,
result
);
auto
status_dto
=
handler
.
GetIndex
(
collection
_name
,
result
);
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
...
@@ -395,14 +395,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -395,14 +395,14 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
DropIndex
)
ADD_CORS
(
DropIndex
)
ENDPOINT
(
"DELETE"
,
"/
tables/{table_name}/indexes"
,
DropIndex
,
PATH
(
String
,
table
_name
))
{
ENDPOINT
(
"DELETE"
,
"/
collections/{collection_name}/indexes"
,
DropIndex
,
PATH
(
String
,
collection
_name
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"DELETE
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/indexes
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"DELETE
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/indexes
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
DropIndex
(
table
_name
);
auto
status_dto
=
handler
.
DropIndex
(
collection
_name
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
...
@@ -423,21 +423,21 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -423,21 +423,21 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
PartitionsOptions
)
ADD_CORS
(
PartitionsOptions
)
ENDPOINT
(
"OPTIONS"
,
"/
tables/{table
_name}/partitions"
,
PartitionsOptions
)
{
ENDPOINT
(
"OPTIONS"
,
"/
collections/{collection
_name}/partitions"
,
PartitionsOptions
)
{
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
}
}
ADD_CORS
(
CreatePartition
)
ADD_CORS
(
CreatePartition
)
ENDPOINT
(
"POST"
,
"/
tables/{table
_name}/partitions"
,
ENDPOINT
(
"POST"
,
"/
collections/{collection
_name}/partitions"
,
CreatePartition
,
PATH
(
String
,
table
_name
),
BODY_DTO
(
PartitionRequestDto
::
ObjectWrapper
,
body
))
{
CreatePartition
,
PATH
(
String
,
collection
_name
),
BODY_DTO
(
PartitionRequestDto
::
ObjectWrapper
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/partitions
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/partitions
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
CreatePartition
(
table
_name
,
body
);
auto
status_dto
=
handler
.
CreatePartition
(
collection
_name
,
body
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_201
,
status_dto
);
response
=
createDtoResponse
(
Status
::
CODE_201
,
status_dto
);
...
@@ -457,9 +457,9 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -457,9 +457,9 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
ShowPartitions
)
ADD_CORS
(
ShowPartitions
)
ENDPOINT
(
"GET"
,
"/
tables/{table
_name}/partitions"
,
ShowPartitions
,
ENDPOINT
(
"GET"
,
"/
collections/{collection
_name}/partitions"
,
ShowPartitions
,
PATH
(
String
,
table
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
PATH
(
String
,
collection
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/partitions
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"GET
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/partitions
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
offset
=
query_params
.
get
(
"offset"
);
auto
offset
=
query_params
.
get
(
"offset"
);
...
@@ -469,7 +469,7 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -469,7 +469,7 @@ class WebController : public oatpp::web::server::api::ApiController {
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
ShowPartitions
(
table
_name
,
query_params
,
partition_list_dto
);
auto
status_dto
=
handler
.
ShowPartitions
(
collection
_name
,
query_params
,
partition_list_dto
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_200
,
partition_list_dto
);
response
=
createDtoResponse
(
Status
::
CODE_200
,
partition_list_dto
);
...
@@ -488,16 +488,16 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -488,16 +488,16 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
DropPartition
)
ADD_CORS
(
DropPartition
)
ENDPOINT
(
"DELETE"
,
"/
tables/{table
_name}/partitions"
,
DropPartition
,
ENDPOINT
(
"DELETE"
,
"/
collections/{collection
_name}/partitions"
,
DropPartition
,
PATH
(
String
,
table
_name
),
BODY_STRING
(
String
,
body
))
{
PATH
(
String
,
collection
_name
),
BODY_STRING
(
String
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"DELETE
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/partitions
\'
"
);
"DELETE
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/partitions
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
DropPartition
(
table
_name
,
body
);
auto
status_dto
=
handler
.
DropPartition
(
collection
_name
,
body
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
response
=
createDtoResponse
(
Status
::
CODE_204
,
status_dto
);
...
@@ -517,14 +517,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -517,14 +517,14 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
ShowSegments
)
ADD_CORS
(
ShowSegments
)
ENDPOINT
(
"GET"
,
"/
tables/{table
_name}/segments"
,
ShowSegments
,
ENDPOINT
(
"GET"
,
"/
collections/{collection
_name}/segments"
,
ShowSegments
,
PATH
(
String
,
table
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
PATH
(
String
,
collection
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
auto
offset
=
query_params
.
get
(
"offset"
);
auto
offset
=
query_params
.
get
(
"offset"
);
auto
page_size
=
query_params
.
get
(
"page_size"
);
auto
page_size
=
query_params
.
get
(
"page_size"
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
String
response
;
String
response
;
auto
status_dto
=
handler
.
ShowSegments
(
table
_name
,
query_params
,
response
);
auto
status_dto
=
handler
.
ShowSegments
(
collection
_name
,
query_params
,
response
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
...
@@ -541,14 +541,14 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -541,14 +541,14 @@ class WebController : public oatpp::web::server::api::ApiController {
*
*
* GetSegmentVector
* GetSegmentVector
*/
*/
ENDPOINT
(
"GET"
,
"/
tables/{table
_name}/segments/{segment_name}/{info}"
,
GetSegmentInfo
,
ENDPOINT
(
"GET"
,
"/
collections/{collection
_name}/segments/{segment_name}/{info}"
,
GetSegmentInfo
,
PATH
(
String
,
table
_name
),
PATH
(
String
,
segment_name
),
PATH
(
String
,
info
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
PATH
(
String
,
collection
_name
),
PATH
(
String
,
segment_name
),
PATH
(
String
,
info
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
auto
offset
=
query_params
.
get
(
"offset"
);
auto
offset
=
query_params
.
get
(
"offset"
);
auto
page_size
=
query_params
.
get
(
"page_size"
);
auto
page_size
=
query_params
.
get
(
"page_size"
);
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
String
response
;
String
response
;
auto
status_dto
=
handler
.
GetSegmentInfo
(
table
_name
,
segment_name
,
info
,
query_params
,
response
);
auto
status_dto
=
handler
.
GetSegmentInfo
(
collection
_name
,
segment_name
,
info
,
query_params
,
response
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
...
@@ -562,7 +562,7 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -562,7 +562,7 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
VectorsOptions
)
ADD_CORS
(
VectorsOptions
)
ENDPOINT
(
"OPTIONS"
,
"/
tables/{table
_name}/vectors"
,
VectorsOptions
)
{
ENDPOINT
(
"OPTIONS"
,
"/
collections/{collection
_name}/vectors"
,
VectorsOptions
)
{
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
return
createResponse
(
Status
::
CODE_204
,
"No Content"
);
}
}
...
@@ -571,11 +571,11 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -571,11 +571,11 @@ class WebController : public oatpp::web::server::api::ApiController {
*
*
* GetVectorByID ?id=
* GetVectorByID ?id=
*/
*/
ENDPOINT
(
"GET"
,
"/
tables/{table
_name}/vectors"
,
GetVectors
,
ENDPOINT
(
"GET"
,
"/
collections/{collection
_name}/vectors"
,
GetVectors
,
PATH
(
String
,
table
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
PATH
(
String
,
collection
_name
),
QUERIES
(
const
QueryParams
&
,
query_params
))
{
auto
handler
=
WebRequestHandler
();
auto
handler
=
WebRequestHandler
();
String
response
;
String
response
;
auto
status_dto
=
handler
.
GetVector
(
table
_name
,
query_params
,
response
);
auto
status_dto
=
handler
.
GetVector
(
collection
_name
,
query_params
,
response
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
...
@@ -589,16 +589,16 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -589,16 +589,16 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
Insert
)
ADD_CORS
(
Insert
)
ENDPOINT
(
"POST"
,
"/
tables/{table
_name}/vectors"
,
Insert
,
ENDPOINT
(
"POST"
,
"/
collections/{collection
_name}/vectors"
,
Insert
,
PATH
(
String
,
table
_name
),
BODY_STRING
(
String
,
body
))
{
PATH
(
String
,
collection
_name
),
BODY_STRING
(
String
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/vectors
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"POST
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/vectors
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
auto
ids_dto
=
VectorIdsDto
::
createShared
();
auto
ids_dto
=
VectorIdsDto
::
createShared
();
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
Insert
(
table
_name
,
body
,
ids_dto
);
auto
status_dto
=
handler
.
Insert
(
collection
_name
,
body
,
ids_dto
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createDtoResponse
(
Status
::
CODE_201
,
ids_dto
);
response
=
createDtoResponse
(
Status
::
CODE_201
,
ids_dto
);
...
@@ -621,16 +621,16 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -621,16 +621,16 @@ class WebController : public oatpp::web::server::api::ApiController {
* Search
* Search
* Delete by ID
* Delete by ID
* */
* */
ENDPOINT
(
"PUT"
,
"/
tables/{table
_name}/vectors"
,
VectorsOp
,
ENDPOINT
(
"PUT"
,
"/
collections/{collection
_name}/vectors"
,
VectorsOp
,
PATH
(
String
,
table
_name
),
BODY_STRING
(
String
,
body
))
{
PATH
(
String
,
collection
_name
),
BODY_STRING
(
String
,
body
))
{
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"PUT
\'
/
tables/"
+
table
_name
->
std_str
()
+
"/vectors
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"PUT
\'
/
collections/"
+
collection
_name
->
std_str
()
+
"/vectors
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
WebRequestHandler
handler
=
WebRequestHandler
();
WebRequestHandler
handler
=
WebRequestHandler
();
OString
result
;
OString
result
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
std
::
shared_ptr
<
OutgoingResponse
>
response
;
auto
status_dto
=
handler
.
VectorsOp
(
table
_name
,
body
,
result
);
auto
status_dto
=
handler
.
VectorsOp
(
collection
_name
,
body
,
result
);
switch
(
status_dto
->
code
->
getValue
())
{
switch
(
status_dto
->
code
->
getValue
())
{
case
StatusCode
::
SUCCESS
:
case
StatusCode
::
SUCCESS
:
response
=
createResponse
(
Status
::
CODE_200
,
result
);
response
=
createResponse
(
Status
::
CODE_200
,
result
);
...
@@ -674,11 +674,6 @@ class WebController : public oatpp::web::server::api::ApiController {
...
@@ -674,11 +674,6 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS
(
SystemOp
)
ADD_CORS
(
SystemOp
)
/**
* Load
* Compact
* Flush
*/
ENDPOINT
(
"PUT"
,
"/system/{Op}"
,
SystemOp
,
PATH
(
String
,
Op
),
BODY_STRING
(
String
,
body_str
))
{
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
()
+
"
\'
"
);
TimeRecorder
tr
(
std
::
string
(
WEB_LOG_PREFIX
)
+
"PUT
\'
/system/"
+
Op
->
std_str
()
+
"
\'
"
);
tr
.
RecordSection
(
"Received request."
);
tr
.
RecordSection
(
"Received request."
);
...
...
core/src/server/web_impl/dto/TableDto.hpp
浏览文件 @
b729d042
...
@@ -25,7 +25,7 @@ namespace web {
...
@@ -25,7 +25,7 @@ namespace web {
class
TableRequestDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
class
TableRequestDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
DTO_INIT
(
TableRequestDto
,
Object
)
DTO_INIT
(
TableRequestDto
,
Object
)
DTO_FIELD
(
String
,
table_name
,
"table
_name"
);
DTO_FIELD
(
String
,
collection_name
,
"collection
_name"
);
DTO_FIELD
(
Int64
,
dimension
,
"dimension"
);
DTO_FIELD
(
Int64
,
dimension
,
"dimension"
);
DTO_FIELD
(
Int64
,
index_file_size
,
"index_file_size"
)
=
VALUE_TABLE_INDEX_FILE_SIZE_DEFAULT
;
DTO_FIELD
(
Int64
,
index_file_size
,
"index_file_size"
)
=
VALUE_TABLE_INDEX_FILE_SIZE_DEFAULT
;
DTO_FIELD
(
String
,
metric_type
,
"metric_type"
)
=
VALUE_TABLE_METRIC_TYPE_DEFAULT
;
DTO_FIELD
(
String
,
metric_type
,
"metric_type"
)
=
VALUE_TABLE_METRIC_TYPE_DEFAULT
;
...
@@ -34,7 +34,7 @@ class TableRequestDto : public oatpp::data::mapping::type::Object {
...
@@ -34,7 +34,7 @@ class TableRequestDto : public oatpp::data::mapping::type::Object {
class
TableFieldsDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
class
TableFieldsDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
DTO_INIT
(
TableFieldsDto
,
Object
)
DTO_INIT
(
TableFieldsDto
,
Object
)
DTO_FIELD
(
String
,
table
_name
);
DTO_FIELD
(
String
,
collection
_name
);
DTO_FIELD
(
Int64
,
dimension
);
DTO_FIELD
(
Int64
,
dimension
);
DTO_FIELD
(
Int64
,
index_file_size
);
DTO_FIELD
(
Int64
,
index_file_size
);
DTO_FIELD
(
String
,
metric_type
);
DTO_FIELD
(
String
,
metric_type
);
...
@@ -46,13 +46,13 @@ class TableFieldsDto : public oatpp::data::mapping::type::Object {
...
@@ -46,13 +46,13 @@ class TableFieldsDto : public oatpp::data::mapping::type::Object {
class
TableListDto
:
public
OObject
{
class
TableListDto
:
public
OObject
{
DTO_INIT
(
TableListDto
,
Object
)
DTO_INIT
(
TableListDto
,
Object
)
DTO_FIELD
(
List
<
String
>::
ObjectWrapper
,
table
_names
);
DTO_FIELD
(
List
<
String
>::
ObjectWrapper
,
collection
_names
);
};
};
class
TableListFieldsDto
:
public
OObject
{
class
TableListFieldsDto
:
public
OObject
{
DTO_INIT
(
TableListFieldsDto
,
Object
)
DTO_INIT
(
TableListFieldsDto
,
Object
)
DTO_FIELD
(
List
<
TableFieldsDto
::
ObjectWrapper
>::
ObjectWrapper
,
table
s
);
DTO_FIELD
(
List
<
TableFieldsDto
::
ObjectWrapper
>::
ObjectWrapper
,
collection
s
);
DTO_FIELD
(
Int64
,
count
)
=
0
;
DTO_FIELD
(
Int64
,
count
)
=
0
;
};
};
...
...
core/src/server/web_impl/dto/VectorDto.hpp
浏览文件 @
b729d042
...
@@ -20,26 +20,6 @@ namespace web {
...
@@ -20,26 +20,6 @@ namespace web {
#include OATPP_CODEGEN_BEGIN(DTO)
#include OATPP_CODEGEN_BEGIN(DTO)
class
SearchRequestDto
:
public
OObject
{
DTO_INIT
(
SearchRequestDto
,
Object
)
DTO_FIELD
(
Int64
,
topk
);
DTO_FIELD
(
Int64
,
nprobe
);
DTO_FIELD
(
List
<
String
>::
ObjectWrapper
,
tags
);
DTO_FIELD
(
List
<
String
>::
ObjectWrapper
,
file_ids
);
DTO_FIELD
(
List
<
List
<
Float32
>::
ObjectWrapper
>::
ObjectWrapper
,
records
);
DTO_FIELD
(
List
<
List
<
Int64
>::
ObjectWrapper
>::
ObjectWrapper
,
records_bin
);
};
class
InsertRequestDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
DTO_INIT
(
InsertRequestDto
,
Object
)
DTO_FIELD
(
String
,
tag
)
=
VALUE_PARTITION_TAG_DEFAULT
;
DTO_FIELD
(
List
<
List
<
Float32
>::
ObjectWrapper
>::
ObjectWrapper
,
records
);
DTO_FIELD
(
List
<
List
<
Int64
>::
ObjectWrapper
>::
ObjectWrapper
,
records_bin
);
DTO_FIELD
(
List
<
Int64
>::
ObjectWrapper
,
ids
);
};
class
VectorIdsDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
class
VectorIdsDto
:
public
oatpp
::
data
::
mapping
::
type
::
Object
{
DTO_INIT
(
VectorIdsDto
,
Object
)
DTO_INIT
(
VectorIdsDto
,
Object
)
...
...
core/src/server/web_impl/handler/WebRequestHandler.cpp
浏览文件 @
b729d042
此差异已折叠。
点击以展开。
core/src/server/web_impl/handler/WebRequestHandler.h
浏览文件 @
b729d042
...
@@ -84,6 +84,9 @@ class WebRequestHandler {
...
@@ -84,6 +84,9 @@ class WebRequestHandler {
Status
Status
ParseQueryStr
(
const
OQueryParams
&
query_params
,
const
std
::
string
&
key
,
std
::
string
&
value
,
bool
nullable
=
true
);
ParseQueryStr
(
const
OQueryParams
&
query_params
,
const
std
::
string
&
key
,
std
::
string
&
value
,
bool
nullable
=
true
);
Status
ParseQueryBool
(
const
OQueryParams
&
query_params
,
const
std
::
string
&
key
,
bool
&
value
,
bool
nullable
=
true
);
private:
private:
void
void
AddStatusToJson
(
nlohmann
::
json
&
json
,
int64_t
code
,
const
std
::
string
&
msg
);
AddStatusToJson
(
nlohmann
::
json
&
json
,
int64_t
code
,
const
std
::
string
&
msg
);
...
...
core/src/utils/StringHelpFunctions.cpp
浏览文件 @
b729d042
...
@@ -12,9 +12,12 @@
...
@@ -12,9 +12,12 @@
#include "utils/StringHelpFunctions.h"
#include "utils/StringHelpFunctions.h"
#include <fiu-local.h>
#include <fiu-local.h>
#include <algorithm>
#include <regex>
#include <regex>
#include <string>
#include <string>
#include "utils/ValidationUtil.h"
namespace
milvus
{
namespace
milvus
{
namespace
server
{
namespace
server
{
...
@@ -148,11 +151,21 @@ StringHelpFunctions::IsRegexMatch(const std::string& target_str, const std::stri
...
@@ -148,11 +151,21 @@ StringHelpFunctions::IsRegexMatch(const std::string& target_str, const std::stri
// regex match
// regex match
std
::
regex
pattern
(
pattern_str
);
std
::
regex
pattern
(
pattern_str
);
std
::
smatch
results
;
std
::
smatch
results
;
if
(
std
::
regex_match
(
target_str
,
results
,
pattern
))
{
return
std
::
regex_match
(
target_str
,
results
,
pattern
);
return
true
;
}
}
else
{
return
false
;
Status
StringHelpFunctions
::
ConvertToBoolean
(
const
std
::
string
&
str
,
bool
&
value
)
{
auto
status
=
ValidationUtil
::
ValidateStringIsBool
(
str
);
if
(
!
status
.
ok
())
{
return
status
;
}
}
std
::
string
s
=
str
;
std
::
transform
(
s
.
begin
(),
s
.
end
(),
s
.
begin
(),
::
tolower
);
value
=
s
==
"true"
||
s
==
"on"
||
s
==
"yes"
||
s
==
"1"
;
return
Status
::
OK
();
}
}
}
// namespace server
}
// namespace server
...
...
core/src/utils/StringHelpFunctions.h
浏览文件 @
b729d042
...
@@ -64,6 +64,12 @@ class StringHelpFunctions {
...
@@ -64,6 +64,12 @@ class StringHelpFunctions {
// regex grammar reference: http://www.cplusplus.com/reference/regex/ECMAScript/
// regex grammar reference: http://www.cplusplus.com/reference/regex/ECMAScript/
static
bool
static
bool
IsRegexMatch
(
const
std
::
string
&
target_str
,
const
std
::
string
&
pattern
);
IsRegexMatch
(
const
std
::
string
&
target_str
,
const
std
::
string
&
pattern
);
// conversion rules refer to ValidationUtil::ValidateStringIsBool()
// "true", "on", "yes", "1" ==> true
// "false", "off", "no", "0", "" ==> false
static
Status
ConvertToBoolean
(
const
std
::
string
&
str
,
bool
&
value
);
};
};
}
// namespace server
}
// namespace server
...
...
core/unittest/server/test_web.cpp
浏览文件 @
b729d042
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录