Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
1d4b2173
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,发现更多精彩内容 >>
提交
1d4b2173
编写于
8月 26, 2019
作者:
G
groot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
Former-commit-id: ace10b37f519bc9b5639030581d813e81d0d4637
上级
a1621905
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
152 addition
and
127 deletion
+152
-127
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
+13
-9
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
+109
-88
cpp/src/server/grpc_impl/GrpcRequestTask.h
cpp/src/server/grpc_impl/GrpcRequestTask.h
+30
-30
未找到文件。
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
浏览文件 @
1d4b2173
...
...
@@ -18,7 +18,7 @@ GrpcRequestHandler::CreateTable(::grpc::ServerContext *context,
const
::
milvus
::
grpc
::
TableSchema
*
request
,
::
milvus
::
grpc
::
Status
*
response
)
{
BaseTaskPtr
task_ptr
=
CreateTableTask
::
Create
(
*
request
);
BaseTaskPtr
task_ptr
=
CreateTableTask
::
Create
(
request
);
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
response
);
return
::
grpc
::
Status
::
OK
;
}
...
...
@@ -52,7 +52,7 @@ GrpcRequestHandler::CreateIndex(::grpc::ServerContext *context,
const
::
milvus
::
grpc
::
IndexParam
*
request
,
::
milvus
::
grpc
::
Status
*
response
)
{
BaseTaskPtr
task_ptr
=
CreateIndexTask
::
Create
(
*
request
);
BaseTaskPtr
task_ptr
=
CreateIndexTask
::
Create
(
request
);
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
response
);
return
::
grpc
::
Status
::
OK
;
}
...
...
@@ -62,7 +62,7 @@ GrpcRequestHandler::Insert(::grpc::ServerContext *context,
const
::
milvus
::
grpc
::
InsertParam
*
request
,
::
milvus
::
grpc
::
VectorIds
*
response
)
{
BaseTaskPtr
task_ptr
=
InsertTask
::
Create
(
*
request
,
*
response
);
BaseTaskPtr
task_ptr
=
InsertTask
::
Create
(
request
,
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
mutable_status
()
->
set_reason
(
grpc_status
.
reason
());
...
...
@@ -76,7 +76,7 @@ GrpcRequestHandler::Search(::grpc::ServerContext *context,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
*
writer
)
{
std
::
vector
<
std
::
string
>
file_id_array
;
BaseTaskPtr
task_ptr
=
SearchTask
::
Create
(
*
request
,
file_id_array
,
*
writer
);
BaseTaskPtr
task_ptr
=
SearchTask
::
Create
(
request
,
file_id_array
,
writer
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
if
(
grpc_status
.
error_code
()
!=
SERVER_SUCCESS
)
{
...
...
@@ -93,7 +93,11 @@ GrpcRequestHandler::SearchInFiles(::grpc::ServerContext *context,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
*
writer
)
{
std
::
vector
<
std
::
string
>
file_id_array
;
BaseTaskPtr
task_ptr
=
SearchTask
::
Create
(
request
->
search_param
(),
file_id_array
,
*
writer
);
for
(
int
i
=
0
;
i
<
request
->
file_id_array_size
();
i
++
)
{
file_id_array
.
push_back
(
request
->
file_id_array
(
i
));
}
::
milvus
::
grpc
::
SearchInFilesParam
*
request_mutable
=
const_cast
<::
milvus
::
grpc
::
SearchInFilesParam
*>
(
request
);
BaseTaskPtr
task_ptr
=
SearchTask
::
Create
(
request_mutable
->
mutable_search_param
(),
file_id_array
,
writer
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
if
(
grpc_status
.
error_code
()
!=
SERVER_SUCCESS
)
{
...
...
@@ -109,7 +113,7 @@ GrpcRequestHandler::DescribeTable(::grpc::ServerContext *context,
const
::
milvus
::
grpc
::
TableName
*
request
,
::
milvus
::
grpc
::
TableSchema
*
response
)
{
BaseTaskPtr
task_ptr
=
DescribeTableTask
::
Create
(
request
->
table_name
(),
*
response
);
BaseTaskPtr
task_ptr
=
DescribeTableTask
::
Create
(
request
->
table_name
(),
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
mutable_table_name
()
->
mutable_status
()
->
set_error_code
(
grpc_status
.
error_code
());
...
...
@@ -137,7 +141,7 @@ GrpcRequestHandler::ShowTables(::grpc::ServerContext *context,
const
::
milvus
::
grpc
::
Command
*
request
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
)
{
BaseTaskPtr
task_ptr
=
ShowTablesTask
::
Create
(
*
writer
);
BaseTaskPtr
task_ptr
=
ShowTablesTask
::
Create
(
writer
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
if
(
grpc_status
.
error_code
()
!=
SERVER_SUCCESS
)
{
...
...
@@ -167,7 +171,7 @@ GrpcRequestHandler::Cmd(::grpc::ServerContext *context,
GrpcRequestHandler
::
DeleteByRange
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
DeleteByRangeParam
*
request
,
::
milvus
::
grpc
::
Status
*
response
)
{
BaseTaskPtr
task_ptr
=
DeleteByRangeTask
::
Create
(
*
request
);
BaseTaskPtr
task_ptr
=
DeleteByRangeTask
::
Create
(
request
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
set_error_code
(
grpc_status
.
error_code
());
...
...
@@ -191,7 +195,7 @@ GrpcRequestHandler::PreloadTable(::grpc::ServerContext *context,
GrpcRequestHandler
::
DescribeIndex
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
TableName
*
request
,
::
milvus
::
grpc
::
IndexParam
*
response
)
{
BaseTaskPtr
task_ptr
=
DescribeIndexTask
::
Create
(
request
->
table_name
(),
*
response
);
BaseTaskPtr
task_ptr
=
DescribeIndexTask
::
Create
(
request
->
table_name
(),
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
mutable_table_name
()
->
mutable_status
()
->
set_reason
(
grpc_status
.
reason
());
...
...
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
浏览文件 @
1d4b2173
此差异已折叠。
点击以展开。
cpp/src/server/grpc_impl/GrpcRequestTask.h
浏览文件 @
1d4b2173
...
...
@@ -23,17 +23,17 @@ namespace grpc {
class
CreateTableTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
TableSchema
&
schema
);
Create
(
const
::
milvus
::
grpc
::
TableSchema
*
schema
);
protected:
explicit
CreateTableTask
(
const
::
milvus
::
grpc
::
TableSchema
&
request
);
CreateTableTask
(
const
::
milvus
::
grpc
::
TableSchema
*
request
);
ServerError
OnExecute
()
override
;
private:
const
::
milvus
::
grpc
::
TableSchema
schema_
;
const
::
milvus
::
grpc
::
TableSchema
*
schema_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -58,10 +58,10 @@ private:
class
DescribeTableTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
&
schema
);
Create
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
*
schema
);
protected:
DescribeTableTask
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
&
schema
);
DescribeTableTask
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
*
schema
);
ServerError
OnExecute
()
override
;
...
...
@@ -69,7 +69,7 @@ protected:
private:
std
::
string
table_name_
;
::
milvus
::
grpc
::
TableSchema
&
schema_
;
::
milvus
::
grpc
::
TableSchema
*
schema_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -94,76 +94,76 @@ private:
class
CreateIndexTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
IndexParam
&
index_Param
);
Create
(
const
::
milvus
::
grpc
::
IndexParam
*
index_Param
);
protected:
explicit
CreateIndexTask
(
const
::
milvus
::
grpc
::
IndexParam
&
index_Param
);
CreateIndexTask
(
const
::
milvus
::
grpc
::
IndexParam
*
index_Param
);
ServerError
OnExecute
()
override
;
private:
::
milvus
::
grpc
::
IndexParam
index_param_
;
const
::
milvus
::
grpc
::
IndexParam
*
index_param_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
ShowTablesTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
&
writer
);
Create
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
);
protected:
explicit
ShowTablesTask
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
&
writer
);
ShowTablesTask
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
);
ServerError
OnExecute
()
override
;
private:
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
writer_
;
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
InsertTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
InsertParam
&
insert_Param
,
::
milvus
::
grpc
::
VectorIds
&
record_ids_
);
Create
(
const
::
milvus
::
grpc
::
InsertParam
*
insert_Param
,
::
milvus
::
grpc
::
VectorIds
*
record_ids_
);
protected:
InsertTask
(
const
::
milvus
::
grpc
::
InsertParam
&
insert_Param
,
::
milvus
::
grpc
::
VectorIds
&
record_ids_
);
InsertTask
(
const
::
milvus
::
grpc
::
InsertParam
*
insert_Param
,
::
milvus
::
grpc
::
VectorIds
*
record_ids_
);
ServerError
OnExecute
()
override
;
private:
const
::
milvus
::
grpc
::
InsertParam
insert_param_
;
::
milvus
::
grpc
::
VectorIds
&
record_ids_
;
const
::
milvus
::
grpc
::
InsertParam
*
insert_param_
;
::
milvus
::
grpc
::
VectorIds
*
record_ids_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
SearchTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
SearchParam
&
search_param
,
Create
(
const
::
milvus
::
grpc
::
SearchParam
*
search_param
,
const
std
::
vector
<
std
::
string
>
&
file_id_array
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
&
writer
);
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
*
writer
);
protected:
SearchTask
(
const
::
milvus
::
grpc
::
SearchParam
&
search_param
,
SearchTask
(
const
::
milvus
::
grpc
::
SearchParam
*
search_param
,
const
std
::
vector
<
std
::
string
>
&
file_id_array
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
&
writer
);
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
*
writer
);
ServerError
OnExecute
()
override
;
private:
const
::
milvus
::
grpc
::
SearchParam
search_param_
;
const
::
milvus
::
grpc
::
SearchParam
*
search_param_
;
std
::
vector
<
std
::
string
>
file_id_array_
;
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
writer_
;
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>
*
writer_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -204,16 +204,16 @@ private:
class
DeleteByRangeTask
:
public
GrpcBaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
DeleteByRangeParam
&
delete_by_range_param
);
Create
(
const
::
milvus
::
grpc
::
DeleteByRangeParam
*
delete_by_range_param
);
protected:
DeleteByRangeTask
(
const
::
milvus
::
grpc
::
DeleteByRangeParam
&
delete_by_range_param
);
DeleteByRangeTask
(
const
::
milvus
::
grpc
::
DeleteByRangeParam
*
delete_by_range_param
);
ServerError
OnExecute
()
override
;
private:
::
milvus
::
grpc
::
DeleteByRangeParam
delete_by_range_param_
;
const
::
milvus
::
grpc
::
DeleteByRangeParam
*
delete_by_range_param_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -237,18 +237,18 @@ class DescribeIndexTask : public GrpcBaseTask {
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
IndexParam
&
index_param
);
::
milvus
::
grpc
::
IndexParam
*
index_param
);
protected:
DescribeIndexTask
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
IndexParam
&
index_param
);
::
milvus
::
grpc
::
IndexParam
*
index_param
);
ServerError
OnExecute
()
override
;
private:
std
::
string
table_name_
;
::
milvus
::
grpc
::
IndexParam
&
index_param_
;
::
milvus
::
grpc
::
IndexParam
*
index_param_
;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录