Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
86dd5e36
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
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,发现更多精彩内容 >>
未验证
提交
86dd5e36
编写于
7月 28, 2020
作者:
W
Wang XiangYu
提交者:
GitHub
7月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cmd case insensitive (#3042)
Signed-off-by:
N
wxyu
<
xy.wang@zilliz.com
>
上级
34309709
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
15 deletion
+33
-15
core/src/server/delivery/request/CmdReq.cpp
core/src/server/delivery/request/CmdReq.cpp
+24
-15
core/src/server/delivery/request/CmdReq.h
core/src/server/delivery/request/CmdReq.h
+9
-0
未找到文件。
core/src/server/delivery/request/CmdReq.cpp
浏览文件 @
86dd5e36
...
...
@@ -16,6 +16,8 @@
#include "utils/Log.h"
#include "utils/TimeRecorder.h"
#include <algorithm>
#include <cctype>
#include <memory>
#include <vector>
...
...
@@ -23,7 +25,7 @@ namespace milvus {
namespace
server
{
CmdReq
::
CmdReq
(
const
std
::
shared_ptr
<
milvus
::
server
::
Context
>&
context
,
const
std
::
string
&
cmd
,
std
::
string
&
result
)
:
BaseReq
(
context
,
BaseReq
::
kCmd
),
cmd_
(
cmd
),
result_
(
result
)
{
:
BaseReq
(
context
,
BaseReq
::
kCmd
),
origin_cmd_
(
cmd
),
cmd_
(
tolower
(
cmd
)
),
result_
(
result
)
{
}
BaseReqPtr
...
...
@@ -54,14 +56,9 @@ CmdReq::OnExecute() {
sys_info_inst
.
GetSysInfoJsonStr
(
result_
);
}
else
if
(
cmd_
==
"build_commit_id"
)
{
result_
=
LAST_COMMIT_ID
;
}
else
if
(
cmd_
.
substr
(
0
,
3
)
==
"
GET
"
)
{
}
else
if
(
cmd_
.
substr
(
0
,
3
)
==
"
get
"
)
{
try
{
std
::
stringstream
ss
(
cmd_
);
std
::
vector
<
std
::
string
>
words
;
std
::
string
word
;
while
(
std
::
getline
(
ss
,
word
,
' '
))
{
words
.
push_back
(
word
);
}
auto
words
=
split
(
cmd_
,
' '
);
if
(
words
.
size
()
==
2
)
{
result_
=
ConfigMgr
::
GetInstance
().
Get
(
words
[
1
]);
}
...
...
@@ -70,14 +67,9 @@ CmdReq::OnExecute() {
}
catch
(...)
{
stat
=
Status
(
SERVER_UNEXPECTED_ERROR
,
"Unknown exception happened on GET command."
);
}
}
else
if
(
cmd_
.
substr
(
0
,
3
)
==
"
SET
"
)
{
}
else
if
(
cmd_
.
substr
(
0
,
3
)
==
"
set
"
)
{
try
{
std
::
stringstream
ss
(
cmd_
);
std
::
vector
<
std
::
string
>
words
;
std
::
string
word
;
while
(
std
::
getline
(
ss
,
word
,
' '
))
{
words
.
push_back
(
word
);
}
auto
words
=
split
(
cmd_
,
' '
);
if
(
words
.
size
()
==
3
)
{
ConfigMgr
::
GetInstance
().
Set
(
words
[
1
],
words
[
2
]);
}
...
...
@@ -93,5 +85,22 @@ CmdReq::OnExecute() {
return
stat
;
}
std
::
vector
<
std
::
string
>
CmdReq
::
split
(
const
std
::
string
&
src
,
char
delimiter
)
{
std
::
stringstream
ss
(
src
);
std
::
vector
<
std
::
string
>
words
;
std
::
string
word
;
while
(
std
::
getline
(
ss
,
word
,
delimiter
))
{
words
.
push_back
(
word
);
}
return
words
;
}
std
::
string
CmdReq
::
tolower
(
std
::
string
s
)
{
std
::
transform
(
s
.
begin
(),
s
.
end
(),
s
.
begin
(),
[](
unsigned
char
c
)
{
return
std
::
tolower
(
c
);
});
return
s
;
}
}
// namespace server
}
// namespace milvus
core/src/server/delivery/request/CmdReq.h
浏览文件 @
86dd5e36
...
...
@@ -15,6 +15,7 @@
#include <memory>
#include <string>
#include <vector>
namespace
milvus
{
namespace
server
{
...
...
@@ -31,6 +32,14 @@ class CmdReq : public BaseReq {
OnExecute
()
override
;
private:
static
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
src
,
char
delimiter
);
static
std
::
string
tolower
(
std
::
string
s
);
private:
const
std
::
string
origin_cmd_
;
const
std
::
string
cmd_
;
std
::
string
&
result_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录