Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
c2e563be
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,发现更多精彩内容 >>
提交
c2e563be
编写于
9月 26, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-592 Change showtables stream transport to unary
Former-commit-id: 7e56c1ddb0184617a00dcc9c3833bd0bb47231de
上级
4ec3c905
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
1366 addition
and
567 deletion
+1366
-567
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc
cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc
+25
-13
cpp/src/grpc/gen-milvus/milvus.grpc.pb.h
cpp/src/grpc/gen-milvus/milvus.grpc.pb.h
+77
-65
cpp/src/grpc/gen-milvus/milvus.pb.cc
cpp/src/grpc/gen-milvus/milvus.pb.cc
+703
-266
cpp/src/grpc/gen-milvus/milvus.pb.h
cpp/src/grpc/gen-milvus/milvus.pb.h
+490
-156
cpp/src/grpc/milvus.proto
cpp/src/grpc/milvus.proto
+17
-8
cpp/src/sdk/examples/grpcsimple/src/ClientTest.cpp
cpp/src/sdk/examples/grpcsimple/src/ClientTest.cpp
+5
-5
cpp/src/sdk/grpc/ClientProxy.cpp
cpp/src/sdk/grpc/ClientProxy.cpp
+12
-4
cpp/src/sdk/grpc/GrpcClient.cpp
cpp/src/sdk/grpc/GrpcClient.cpp
+11
-18
cpp/src/sdk/grpc/GrpcClient.h
cpp/src/sdk/grpc/GrpcClient.h
+1
-1
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
+9
-12
cpp/src/server/grpc_impl/GrpcRequestHandler.h
cpp/src/server/grpc_impl/GrpcRequestHandler.h
+1
-1
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
+10
-14
cpp/src/server/grpc_impl/GrpcRequestTask.h
cpp/src/server/grpc_impl/GrpcRequestTask.h
+3
-3
cpp/unittest/CMakeLists.txt
cpp/unittest/CMakeLists.txt
+1
-1
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
c2e563be
...
@@ -153,6 +153,7 @@ Please mark all change in change log and use the ticket from JIRA.
...
@@ -153,6 +153,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-546 - Add simple mode resource_config
-
MS-546 - Add simple mode resource_config
-
MS-570 - Add prometheus docker-compose file
-
MS-570 - Add prometheus docker-compose file
-
MS-576 - Scheduler refactor
-
MS-576 - Scheduler refactor
-
MS-592 - Change showtables stream transport to unary
## New Feature
## New Feature
-
MS-343 - Implement ResourceMgr
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/grpc/gen-milvus/milvus.grpc.pb.cc
浏览文件 @
c2e563be
...
@@ -53,7 +53,7 @@ MilvusService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& chan
...
@@ -53,7 +53,7 @@ MilvusService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& chan
,
rpcmethod_SearchInFiles_
(
MilvusService_method_names
[
6
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_SearchInFiles_
(
MilvusService_method_names
[
6
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_DescribeTable_
(
MilvusService_method_names
[
7
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_DescribeTable_
(
MilvusService_method_names
[
7
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_CountTable_
(
MilvusService_method_names
[
8
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_CountTable_
(
MilvusService_method_names
[
8
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_ShowTables_
(
MilvusService_method_names
[
9
],
::
grpc
::
internal
::
RpcMethod
::
SERVER_STREAMING
,
channel
)
,
rpcmethod_ShowTables_
(
MilvusService_method_names
[
9
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_Cmd_
(
MilvusService_method_names
[
10
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_Cmd_
(
MilvusService_method_names
[
10
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_DeleteByRange_
(
MilvusService_method_names
[
11
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_DeleteByRange_
(
MilvusService_method_names
[
11
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_PreloadTable_
(
MilvusService_method_names
[
12
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
,
rpcmethod_PreloadTable_
(
MilvusService_method_names
[
12
],
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
channel
)
...
@@ -313,20 +313,32 @@ void MilvusService::Stub::experimental_async::CountTable(::grpc::ClientContext*
...
@@ -313,20 +313,32 @@ void MilvusService::Stub::experimental_async::CountTable(::grpc::ClientContext*
return
::
grpc_impl
::
internal
::
ClientAsyncResponseReaderFactory
<
::
milvus
::
grpc
::
TableRowCount
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_CountTable_
,
context
,
request
,
false
);
return
::
grpc_impl
::
internal
::
ClientAsyncResponseReaderFactory
<
::
milvus
::
grpc
::
TableRowCount
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_CountTable_
,
context
,
request
,
false
);
}
}
::
grpc
::
ClientReader
<
::
milvus
::
grpc
::
TableName
>*
MilvusService
::
Stub
::
ShowTablesRaw
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
)
{
::
grpc
::
Status
MilvusService
::
Stub
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
milvus
::
grpc
::
TableNameList
*
response
)
{
return
::
grpc
_impl
::
internal
::
ClientReaderFactory
<
::
milvus
::
grpc
::
TableName
>::
Create
(
channel_
.
get
(),
rpcmethod_ShowTables_
,
context
,
request
);
return
::
grpc
::
internal
::
BlockingUnaryCall
(
channel_
.
get
(),
rpcmethod_ShowTables_
,
context
,
request
,
response
);
}
}
void
MilvusService
::
Stub
::
experimental_async
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
::
milvus
::
grpc
::
Command
*
request
,
::
grpc
::
experimental
::
ClientReadReactor
<
::
milvus
::
grpc
::
TableName
>*
reactor
)
{
void
MilvusService
::
Stub
::
experimental_async
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
milvus
::
grpc
::
TableNameList
*
response
,
std
::
function
<
void
(
::
grpc
::
Status
)
>
f
)
{
::
grpc_impl
::
internal
::
C
lientCallbackReaderFactory
<
::
milvus
::
grpc
::
TableName
>::
Create
(
stub_
->
channel_
.
get
(),
stub_
->
rpcmethod_ShowTables_
,
context
,
request
,
reactor
);
::
grpc_impl
::
internal
::
C
allbackUnaryCall
(
stub_
->
channel_
.
get
(),
stub_
->
rpcmethod_ShowTables_
,
context
,
request
,
response
,
std
::
move
(
f
)
);
}
}
::
grpc
::
ClientAsyncReader
<
::
milvus
::
grpc
::
TableName
>*
MilvusService
::
Stub
::
AsyncShowTablesRaw
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
grpc
::
CompletionQueue
*
cq
,
void
*
tag
)
{
void
MilvusService
::
Stub
::
experimental_async
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
const
::
grpc
::
ByteBuffer
*
request
,
::
milvus
::
grpc
::
TableNameList
*
response
,
std
::
function
<
void
(
::
grpc
::
Status
)
>
f
)
{
return
::
grpc_impl
::
internal
::
ClientAsyncReaderFactory
<
::
milvus
::
grpc
::
TableName
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_ShowTables_
,
context
,
request
,
true
,
tag
);
::
grpc_impl
::
internal
::
CallbackUnaryCall
(
stub_
->
channel_
.
get
(),
stub_
->
rpcmethod_ShowTables_
,
context
,
request
,
response
,
std
::
move
(
f
)
);
}
}
::
grpc
::
ClientAsyncReader
<
::
milvus
::
grpc
::
TableName
>*
MilvusService
::
Stub
::
PrepareAsyncShowTablesRaw
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
grpc
::
CompletionQueue
*
cq
)
{
void
MilvusService
::
Stub
::
experimental_async
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
milvus
::
grpc
::
TableNameList
*
response
,
::
grpc
::
experimental
::
ClientUnaryReactor
*
reactor
)
{
return
::
grpc_impl
::
internal
::
ClientAsyncReaderFactory
<
::
milvus
::
grpc
::
TableName
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_ShowTables_
,
context
,
request
,
false
,
nullptr
);
::
grpc_impl
::
internal
::
ClientCallbackUnaryFactory
::
Create
(
stub_
->
channel_
.
get
(),
stub_
->
rpcmethod_ShowTables_
,
context
,
request
,
response
,
reactor
);
}
void
MilvusService
::
Stub
::
experimental_async
::
ShowTables
(
::
grpc
::
ClientContext
*
context
,
const
::
grpc
::
ByteBuffer
*
request
,
::
milvus
::
grpc
::
TableNameList
*
response
,
::
grpc
::
experimental
::
ClientUnaryReactor
*
reactor
)
{
::
grpc_impl
::
internal
::
ClientCallbackUnaryFactory
::
Create
(
stub_
->
channel_
.
get
(),
stub_
->
rpcmethod_ShowTables_
,
context
,
request
,
response
,
reactor
);
}
::
grpc
::
ClientAsyncResponseReader
<
::
milvus
::
grpc
::
TableNameList
>*
MilvusService
::
Stub
::
AsyncShowTablesRaw
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
grpc
::
CompletionQueue
*
cq
)
{
return
::
grpc_impl
::
internal
::
ClientAsyncResponseReaderFactory
<
::
milvus
::
grpc
::
TableNameList
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_ShowTables_
,
context
,
request
,
true
);
}
::
grpc
::
ClientAsyncResponseReader
<
::
milvus
::
grpc
::
TableNameList
>*
MilvusService
::
Stub
::
PrepareAsyncShowTablesRaw
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
grpc
::
CompletionQueue
*
cq
)
{
return
::
grpc_impl
::
internal
::
ClientAsyncResponseReaderFactory
<
::
milvus
::
grpc
::
TableNameList
>::
Create
(
channel_
.
get
(),
cq
,
rpcmethod_ShowTables_
,
context
,
request
,
false
);
}
}
::
grpc
::
Status
MilvusService
::
Stub
::
Cmd
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
milvus
::
grpc
::
StringReply
*
response
)
{
::
grpc
::
Status
MilvusService
::
Stub
::
Cmd
(
::
grpc
::
ClientContext
*
context
,
const
::
milvus
::
grpc
::
Command
&
request
,
::
milvus
::
grpc
::
StringReply
*
response
)
{
...
@@ -517,8 +529,8 @@ MilvusService::Service::Service() {
...
@@ -517,8 +529,8 @@ MilvusService::Service::Service() {
std
::
mem_fn
(
&
MilvusService
::
Service
::
CountTable
),
this
)));
std
::
mem_fn
(
&
MilvusService
::
Service
::
CountTable
),
this
)));
AddMethod
(
new
::
grpc
::
internal
::
RpcServiceMethod
(
AddMethod
(
new
::
grpc
::
internal
::
RpcServiceMethod
(
MilvusService_method_names
[
9
],
MilvusService_method_names
[
9
],
::
grpc
::
internal
::
RpcMethod
::
SERVER_STREAMING
,
::
grpc
::
internal
::
RpcMethod
::
NORMAL_RPC
,
new
::
grpc
::
internal
::
ServerStreamingHandler
<
MilvusService
::
Service
,
::
milvus
::
grpc
::
Command
,
::
milvus
::
grpc
::
TableName
>
(
new
::
grpc
::
internal
::
RpcMethodHandler
<
MilvusService
::
Service
,
::
milvus
::
grpc
::
Command
,
::
milvus
::
grpc
::
TableNameList
>
(
std
::
mem_fn
(
&
MilvusService
::
Service
::
ShowTables
),
this
)));
std
::
mem_fn
(
&
MilvusService
::
Service
::
ShowTables
),
this
)));
AddMethod
(
new
::
grpc
::
internal
::
RpcServiceMethod
(
AddMethod
(
new
::
grpc
::
internal
::
RpcServiceMethod
(
MilvusService_method_names
[
10
],
MilvusService_method_names
[
10
],
...
@@ -613,10 +625,10 @@ MilvusService::Service::~Service() {
...
@@ -613,10 +625,10 @@ MilvusService::Service::~Service() {
return
::
grpc
::
Status
(
::
grpc
::
StatusCode
::
UNIMPLEMENTED
,
""
);
return
::
grpc
::
Status
(
::
grpc
::
StatusCode
::
UNIMPLEMENTED
,
""
);
}
}
::
grpc
::
Status
MilvusService
::
Service
::
ShowTables
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>*
writer
)
{
::
grpc
::
Status
MilvusService
::
Service
::
ShowTables
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
milvus
::
grpc
::
TableNameList
*
response
)
{
(
void
)
context
;
(
void
)
context
;
(
void
)
request
;
(
void
)
request
;
(
void
)
writer
;
(
void
)
response
;
return
::
grpc
::
Status
(
::
grpc
::
StatusCode
::
UNIMPLEMENTED
,
""
);
return
::
grpc
::
Status
(
::
grpc
::
StatusCode
::
UNIMPLEMENTED
,
""
);
}
}
...
...
cpp/src/grpc/gen-milvus/milvus.grpc.pb.h
浏览文件 @
c2e563be
此差异已折叠。
点击以展开。
cpp/src/grpc/gen-milvus/milvus.pb.cc
浏览文件 @
c2e563be
此差异已折叠。
点击以展开。
cpp/src/grpc/gen-milvus/milvus.pb.h
浏览文件 @
c2e563be
此差异已折叠。
点击以展开。
cpp/src/grpc/milvus.proto
浏览文件 @
c2e563be
...
@@ -8,18 +8,26 @@ package milvus.grpc;
...
@@ -8,18 +8,26 @@ package milvus.grpc;
* @brief Table Name
* @brief Table Name
*/
*/
message
TableName
{
message
TableName
{
string
table_name
=
1
;
}
/**
* @brief Table Name List
*/
message
TableNameList
{
Status
status
=
1
;
Status
status
=
1
;
string
table_name
=
2
;
repeated
string
table_names
=
2
;
}
}
/**
/**
* @brief Table Schema
* @brief Table Schema
*/
*/
message
TableSchema
{
message
TableSchema
{
TableName
table_name
=
1
;
Status
status
=
1
;
int64
dimension
=
2
;
string
table_name
=
2
;
int64
index_file_size
=
3
;
int64
dimension
=
3
;
int32
metric_type
=
4
;
int64
index_file_size
=
4
;
int32
metric_type
=
5
;
}
}
/**
/**
...
@@ -141,8 +149,9 @@ message Index {
...
@@ -141,8 +149,9 @@ message Index {
* @brief Index params
* @brief Index params
*/
*/
message
IndexParam
{
message
IndexParam
{
TableName
table_name
=
1
;
Status
status
=
1
;
Index
index
=
2
;
string
table_name
=
2
;
Index
index
=
3
;
}
}
/**
/**
...
@@ -264,7 +273,7 @@ service MilvusService {
...
@@ -264,7 +273,7 @@ service MilvusService {
*
*
* @return table names.
* @return table names.
*/
*/
rpc
ShowTables
(
Command
)
returns
(
stream
TableName
)
{}
rpc
ShowTables
(
Command
)
returns
(
TableNameList
)
{}
/**
/**
* @brief Give the server status
* @brief Give the server status
...
...
cpp/src/sdk/examples/grpcsimple/src/ClientTest.cpp
浏览文件 @
c2e563be
...
@@ -227,9 +227,9 @@ ClientTest::Test(const std::string& address, const std::string& port) {
...
@@ -227,9 +227,9 @@ ClientTest::Test(const std::string& address, const std::string& port) {
std
::
cout
<<
"All tables: "
<<
std
::
endl
;
std
::
cout
<<
"All tables: "
<<
std
::
endl
;
for
(
auto
&
table
:
tables
)
{
for
(
auto
&
table
:
tables
)
{
int64_t
row_count
=
0
;
int64_t
row_count
=
0
;
conn
->
DropTable
(
table
);
//
conn->DropTable(table);
//
stat = conn->CountTable(table, row_count);
stat
=
conn
->
CountTable
(
table
,
row_count
);
//
std::cout << "\t" << table << "(" << row_count << " rows)" << std::endl;
std
::
cout
<<
"
\t
"
<<
table
<<
"("
<<
row_count
<<
" rows)"
<<
std
::
endl
;
}
}
}
}
...
@@ -343,8 +343,8 @@ ClientTest::Test(const std::string& address, const std::string& port) {
...
@@ -343,8 +343,8 @@ ClientTest::Test(const std::string& address, const std::string& port) {
}
}
{
//delete table
{
//delete table
Status
stat
=
conn
->
DropTable
(
TABLE_NAME
);
//
Status stat = conn->DropTable(TABLE_NAME);
std
::
cout
<<
"DeleteTable function call status: "
<<
stat
.
message
()
<<
std
::
endl
;
//
std::cout << "DeleteTable function call status: " << stat.message() << std::endl;
}
}
{
//server status
{
//server status
...
...
cpp/src/sdk/grpc/ClientProxy.cpp
浏览文件 @
c2e563be
...
@@ -93,7 +93,7 @@ Status
...
@@ -93,7 +93,7 @@ Status
ClientProxy
::
CreateTable
(
const
TableSchema
&
param
)
{
ClientProxy
::
CreateTable
(
const
TableSchema
&
param
)
{
try
{
try
{
::
milvus
::
grpc
::
TableSchema
schema
;
::
milvus
::
grpc
::
TableSchema
schema
;
schema
.
mutable_table_name
()
->
set_table_name
(
param
.
table_name
);
schema
.
set_table_name
(
param
.
table_name
);
schema
.
set_dimension
(
param
.
dimension
);
schema
.
set_dimension
(
param
.
dimension
);
schema
.
set_index_file_size
(
param
.
index_file_size
);
schema
.
set_index_file_size
(
param
.
index_file_size
);
schema
.
set_metric_type
((
int32_t
)
param
.
metric_type
);
schema
.
set_metric_type
((
int32_t
)
param
.
metric_type
);
...
@@ -129,7 +129,7 @@ ClientProxy::CreateIndex(const IndexParam &index_param) {
...
@@ -129,7 +129,7 @@ ClientProxy::CreateIndex(const IndexParam &index_param) {
try
{
try
{
//TODO:add index params
//TODO:add index params
::
milvus
::
grpc
::
IndexParam
grpc_index_param
;
::
milvus
::
grpc
::
IndexParam
grpc_index_param
;
grpc_index_param
.
mutable_table_name
()
->
set_table_name
(
index_param
.
table_name
);
grpc_index_param
.
set_table_name
(
index_param
.
table_name
);
grpc_index_param
.
mutable_index
()
->
set_index_type
((
int32_t
)
index_param
.
index_type
);
grpc_index_param
.
mutable_index
()
->
set_index_type
((
int32_t
)
index_param
.
index_type
);
grpc_index_param
.
mutable_index
()
->
set_nlist
(
index_param
.
nlist
);
grpc_index_param
.
mutable_index
()
->
set_nlist
(
index_param
.
nlist
);
return
client_ptr_
->
CreateIndex
(
grpc_index_param
);
return
client_ptr_
->
CreateIndex
(
grpc_index_param
);
...
@@ -281,7 +281,7 @@ ClientProxy::DescribeTable(const std::string &table_name, TableSchema &table_sch
...
@@ -281,7 +281,7 @@ ClientProxy::DescribeTable(const std::string &table_name, TableSchema &table_sch
Status
status
=
client_ptr_
->
DescribeTable
(
grpc_schema
,
table_name
);
Status
status
=
client_ptr_
->
DescribeTable
(
grpc_schema
,
table_name
);
table_schema
.
table_name
=
grpc_schema
.
table_name
()
.
table_name
()
;
table_schema
.
table_name
=
grpc_schema
.
table_name
();
table_schema
.
dimension
=
grpc_schema
.
dimension
();
table_schema
.
dimension
=
grpc_schema
.
dimension
();
table_schema
.
index_file_size
=
grpc_schema
.
index_file_size
();
table_schema
.
index_file_size
=
grpc_schema
.
index_file_size
();
table_schema
.
metric_type
=
(
MetricType
)
grpc_schema
.
metric_type
();
table_schema
.
metric_type
=
(
MetricType
)
grpc_schema
.
metric_type
();
...
@@ -307,7 +307,15 @@ ClientProxy::CountTable(const std::string &table_name, int64_t &row_count) {
...
@@ -307,7 +307,15 @@ ClientProxy::CountTable(const std::string &table_name, int64_t &row_count) {
Status
Status
ClientProxy
::
ShowTables
(
std
::
vector
<
std
::
string
>
&
table_array
)
{
ClientProxy
::
ShowTables
(
std
::
vector
<
std
::
string
>
&
table_array
)
{
try
{
try
{
return
client_ptr_
->
ShowTables
(
table_array
);
Status
status
;
milvus
::
grpc
::
TableNameList
table_name_list
;
status
=
client_ptr_
->
ShowTables
(
table_name_list
);
table_array
.
resize
(
table_name_list
.
table_names_size
());
for
(
uint64_t
i
=
0
;
i
<
table_name_list
.
table_names_size
();
++
i
)
{
table_array
[
i
]
=
table_name_list
.
table_names
(
i
);
}
return
status
;
}
catch
(
std
::
exception
&
ex
)
{
}
catch
(
std
::
exception
&
ex
)
{
return
Status
(
StatusCode
::
UnknownError
,
"fail to show tables: "
+
std
::
string
(
ex
.
what
()));
return
Status
(
StatusCode
::
UnknownError
,
"fail to show tables: "
+
std
::
string
(
ex
.
what
()));
...
...
cpp/src/sdk/grpc/GrpcClient.cpp
浏览文件 @
c2e563be
...
@@ -167,10 +167,10 @@ GrpcClient::DescribeTable(::milvus::grpc::TableSchema& grpc_schema,
...
@@ -167,10 +167,10 @@ GrpcClient::DescribeTable(::milvus::grpc::TableSchema& grpc_schema,
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
}
}
if
(
grpc_schema
.
table_name
().
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
if
(
grpc_schema
.
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
std
::
cerr
<<
grpc_schema
.
table_name
().
status
().
reason
()
<<
std
::
endl
;
std
::
cerr
<<
grpc_schema
.
status
().
reason
()
<<
std
::
endl
;
return
Status
(
StatusCode
::
ServerFailed
,
return
Status
(
StatusCode
::
ServerFailed
,
grpc_schema
.
table_name
().
status
().
reason
());
grpc_schema
.
status
().
reason
());
}
}
return
Status
::
OK
();
return
Status
::
OK
();
...
@@ -201,17 +201,10 @@ GrpcClient::CountTable(const std::string& table_name, Status& status) {
...
@@ -201,17 +201,10 @@ GrpcClient::CountTable(const std::string& table_name, Status& status) {
}
}
Status
Status
GrpcClient
::
ShowTables
(
std
::
vector
<
std
::
string
>
&
table_array
)
{
GrpcClient
::
ShowTables
(
milvus
::
grpc
::
TableNameList
&
table_name_list
)
{
ClientContext
context
;
ClientContext
context
;
::
milvus
::
grpc
::
Command
command
;
::
milvus
::
grpc
::
Command
command
;
std
::
unique_ptr
<
ClientReader
<::
milvus
::
grpc
::
TableName
>
>
reader
(
::
grpc
::
Status
grpc_status
=
stub_
->
ShowTables
(
&
context
,
command
,
&
table_name_list
);
stub_
->
ShowTables
(
&
context
,
command
));
::
milvus
::
grpc
::
TableName
table_name
;
while
(
reader
->
Read
(
&
table_name
))
{
table_array
.
emplace_back
(
table_name
.
table_name
());
}
::
grpc
::
Status
grpc_status
=
reader
->
Finish
();
if
(
!
grpc_status
.
ok
())
{
if
(
!
grpc_status
.
ok
())
{
std
::
cerr
<<
"ShowTables gRPC failed!"
<<
std
::
endl
;
std
::
cerr
<<
"ShowTables gRPC failed!"
<<
std
::
endl
;
...
@@ -219,10 +212,10 @@ GrpcClient::ShowTables(std::vector<std::string> &table_array) {
...
@@ -219,10 +212,10 @@ GrpcClient::ShowTables(std::vector<std::string> &table_array) {
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
}
}
if
(
table_name
.
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
if
(
table_name
_list
.
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
std
::
cerr
<<
table_name
.
status
().
reason
()
<<
std
::
endl
;
std
::
cerr
<<
table_name
_list
.
status
().
reason
()
<<
std
::
endl
;
return
Status
(
StatusCode
::
ServerFailed
,
return
Status
(
StatusCode
::
ServerFailed
,
table_name
.
status
().
reason
());
table_name_list
.
status
().
reason
());
}
}
return
Status
::
OK
();
return
Status
::
OK
();
...
@@ -302,9 +295,9 @@ GrpcClient::DescribeIndex(grpc::TableName &table_name, grpc::IndexParam &index_p
...
@@ -302,9 +295,9 @@ GrpcClient::DescribeIndex(grpc::TableName &table_name, grpc::IndexParam &index_p
std
::
cerr
<<
"DescribeIndex rpc failed!"
<<
std
::
endl
;
std
::
cerr
<<
"DescribeIndex rpc failed!"
<<
std
::
endl
;
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
return
Status
(
StatusCode
::
RPCFailed
,
grpc_status
.
error_message
());
}
}
if
(
index_param
.
mutable_table_name
()
->
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
if
(
index_param
.
status
().
error_code
()
!=
grpc
::
SUCCESS
)
{
std
::
cerr
<<
index_param
.
mutable_table_name
()
->
status
().
reason
()
<<
std
::
endl
;
std
::
cerr
<<
index_param
.
status
().
reason
()
<<
std
::
endl
;
return
Status
(
StatusCode
::
ServerFailed
,
index_param
.
mutable_table_name
()
->
status
().
reason
());
return
Status
(
StatusCode
::
ServerFailed
,
index_param
.
status
().
reason
());
}
}
return
Status
::
OK
();
return
Status
::
OK
();
...
...
cpp/src/sdk/grpc/GrpcClient.h
浏览文件 @
c2e563be
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
CountTable
(
const
std
::
string
&
table_name
,
Status
&
status
);
CountTable
(
const
std
::
string
&
table_name
,
Status
&
status
);
Status
Status
ShowTables
(
std
::
vector
<
std
::
string
>
&
table_array
);
ShowTables
(
milvus
::
grpc
::
TableNameList
&
table_name_list
);
Status
Status
Cmd
(
std
::
string
&
result
,
const
std
::
string
&
cmd
);
Cmd
(
std
::
string
&
result
,
const
std
::
string
&
cmd
);
...
...
cpp/src/server/grpc_impl/GrpcRequestHandler.cpp
浏览文件 @
c2e563be
...
@@ -122,8 +122,8 @@ GrpcRequestHandler::DescribeTable(::grpc::ServerContext *context,
...
@@ -122,8 +122,8 @@ GrpcRequestHandler::DescribeTable(::grpc::ServerContext *context,
BaseTaskPtr
task_ptr
=
DescribeTableTask
::
Create
(
request
->
table_name
(),
response
);
BaseTaskPtr
task_ptr
=
DescribeTableTask
::
Create
(
request
->
table_name
(),
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
mutable_
table_name
()
->
mutable_
status
()
->
set_error_code
(
grpc_status
.
error_code
());
response
->
mutable_status
()
->
set_error_code
(
grpc_status
.
error_code
());
response
->
mutable_
table_name
()
->
mutable_
status
()
->
set_reason
(
grpc_status
.
reason
());
response
->
mutable_status
()
->
set_reason
(
grpc_status
.
reason
());
return
::
grpc
::
Status
::
OK
;
return
::
grpc
::
Status
::
OK
;
}
}
...
@@ -145,17 +145,14 @@ GrpcRequestHandler::CountTable(::grpc::ServerContext *context,
...
@@ -145,17 +145,14 @@ GrpcRequestHandler::CountTable(::grpc::ServerContext *context,
::
grpc
::
Status
::
grpc
::
Status
GrpcRequestHandler
::
ShowTables
(
::
grpc
::
ServerContext
*
context
,
GrpcRequestHandler
::
ShowTables
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
)
{
::
milvus
::
grpc
::
TableNameList
*
response
)
{
BaseTaskPtr
task_ptr
=
ShowTablesTask
::
Create
(
writer
);
BaseTaskPtr
task_ptr
=
ShowTablesTask
::
Create
(
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
if
(
grpc_status
.
error_code
()
!=
SERVER_SUCCESS
)
{
response
->
mutable_status
()
->
set_error_code
(
grpc_status
.
error_code
());
::
grpc
::
Status
status
(
::
grpc
::
UNKNOWN
,
grpc_status
.
reason
());
response
->
mutable_status
()
->
set_reason
(
grpc_status
.
reason
());
return
status
;
return
::
grpc
::
Status
::
OK
;
}
else
{
return
::
grpc
::
Status
::
OK
;
}
}
}
::
grpc
::
Status
::
grpc
::
Status
...
@@ -204,8 +201,8 @@ GrpcRequestHandler::DescribeIndex(::grpc::ServerContext *context,
...
@@ -204,8 +201,8 @@ GrpcRequestHandler::DescribeIndex(::grpc::ServerContext *context,
BaseTaskPtr
task_ptr
=
DescribeIndexTask
::
Create
(
request
->
table_name
(),
response
);
BaseTaskPtr
task_ptr
=
DescribeIndexTask
::
Create
(
request
->
table_name
(),
response
);
::
milvus
::
grpc
::
Status
grpc_status
;
::
milvus
::
grpc
::
Status
grpc_status
;
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
GrpcRequestScheduler
::
ExecTask
(
task_ptr
,
&
grpc_status
);
response
->
mutable_
table_name
()
->
mutable_
status
()
->
set_reason
(
grpc_status
.
reason
());
response
->
mutable_status
()
->
set_reason
(
grpc_status
.
reason
());
response
->
mutable_
table_name
()
->
mutable_
status
()
->
set_error_code
(
grpc_status
.
error_code
());
response
->
mutable_status
()
->
set_error_code
(
grpc_status
.
error_code
());
return
::
grpc
::
Status
::
OK
;
return
::
grpc
::
Status
::
OK
;
}
}
...
...
cpp/src/server/grpc_impl/GrpcRequestHandler.h
浏览文件 @
c2e563be
...
@@ -234,7 +234,7 @@ public:
...
@@ -234,7 +234,7 @@ public:
::
grpc
::
Status
::
grpc
::
Status
ShowTables
(
::
grpc
::
ServerContext
*
context
,
ShowTables
(
::
grpc
::
ServerContext
*
context
,
const
::
milvus
::
grpc
::
Command
*
request
,
const
::
milvus
::
grpc
::
Command
*
request
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
)
override
;
::
milvus
::
grpc
::
TableNameList
*
table_name_list
)
override
;
/**
/**
* @brief Give the server status
* @brief Give the server status
...
...
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
浏览文件 @
c2e563be
...
@@ -137,7 +137,7 @@ CreateTableTask::OnExecute() {
...
@@ -137,7 +137,7 @@ CreateTableTask::OnExecute() {
try
{
try
{
//step 1: check arguments
//step 1: check arguments
auto
status
=
ValidationUtil
::
ValidateTableName
(
schema_
->
table_name
()
.
table_name
()
);
auto
status
=
ValidationUtil
::
ValidateTableName
(
schema_
->
table_name
());
if
(
!
status
.
ok
())
{
if
(
!
status
.
ok
())
{
return
status
;
return
status
;
}
}
...
@@ -159,7 +159,7 @@ CreateTableTask::OnExecute() {
...
@@ -159,7 +159,7 @@ CreateTableTask::OnExecute() {
//step 2: construct table schema
//step 2: construct table schema
engine
::
meta
::
TableSchema
table_info
;
engine
::
meta
::
TableSchema
table_info
;
table_info
.
table_id_
=
schema_
->
table_name
()
.
table_name
()
;
table_info
.
table_id_
=
schema_
->
table_name
();
table_info
.
dimension_
=
(
uint16_t
)
schema_
->
dimension
();
table_info
.
dimension_
=
(
uint16_t
)
schema_
->
dimension
();
table_info
.
index_file_size_
=
schema_
->
index_file_size
();
table_info
.
index_file_size_
=
schema_
->
index_file_size
();
table_info
.
metric_type_
=
schema_
->
metric_type
();
table_info
.
metric_type_
=
schema_
->
metric_type
();
...
@@ -214,7 +214,7 @@ DescribeTableTask::OnExecute() {
...
@@ -214,7 +214,7 @@ DescribeTableTask::OnExecute() {
return
status
;
return
status
;
}
}
schema_
->
mutable_table_name
()
->
set_table_name
(
table_info
.
table_id_
);
schema_
->
set_table_name
(
table_info
.
table_id_
);
schema_
->
set_dimension
(
table_info
.
dimension_
);
schema_
->
set_dimension
(
table_info
.
dimension_
);
schema_
->
set_index_file_size
(
table_info
.
index_file_size_
);
schema_
->
set_index_file_size
(
table_info
.
index_file_size_
);
schema_
->
set_metric_type
(
table_info
.
metric_type_
);
schema_
->
set_metric_type
(
table_info
.
metric_type_
);
...
@@ -249,7 +249,7 @@ CreateIndexTask::OnExecute() {
...
@@ -249,7 +249,7 @@ CreateIndexTask::OnExecute() {
TimeRecorder
rc
(
"CreateIndexTask"
);
TimeRecorder
rc
(
"CreateIndexTask"
);
//step 1: check arguments
//step 1: check arguments
std
::
string
table_name_
=
index_param_
->
table_name
()
.
table_name
()
;
std
::
string
table_name_
=
index_param_
->
table_name
();
auto
status
=
ValidationUtil
::
ValidateTableName
(
table_name_
);
auto
status
=
ValidationUtil
::
ValidateTableName
(
table_name_
);
if
(
!
status
.
ok
())
{
if
(
!
status
.
ok
())
{
return
status
;
return
status
;
...
@@ -384,15 +384,15 @@ DropTableTask::OnExecute() {
...
@@ -384,15 +384,15 @@ DropTableTask::OnExecute() {
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ShowTablesTask
::
ShowTablesTask
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
)
ShowTablesTask
::
ShowTablesTask
(
::
milvus
::
grpc
::
TableNameList
*
table_name_list
)
:
GrpcBaseTask
(
DDL_DML_TASK_GROUP
),
:
GrpcBaseTask
(
DDL_DML_TASK_GROUP
),
writer_
(
writer
)
{
table_name_list_
(
table_name_list
)
{
}
}
BaseTaskPtr
BaseTaskPtr
ShowTablesTask
::
Create
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
)
{
ShowTablesTask
::
Create
(
::
milvus
::
grpc
::
TableNameList
*
table_name_list
)
{
return
std
::
shared_ptr
<
GrpcBaseTask
>
(
new
ShowTablesTask
(
writer
));
return
std
::
shared_ptr
<
GrpcBaseTask
>
(
new
ShowTablesTask
(
table_name_list
));
}
}
Status
Status
...
@@ -404,11 +404,7 @@ ShowTablesTask::OnExecute() {
...
@@ -404,11 +404,7 @@ ShowTablesTask::OnExecute() {
}
}
for
(
auto
&
schema
:
schema_array
)
{
for
(
auto
&
schema
:
schema_array
)
{
::
milvus
::
grpc
::
TableName
tableName
;
table_name_list_
->
add_table_names
(
schema
.
table_id_
);
tableName
.
set_table_name
(
schema
.
table_id_
);
if
(
!
writer_
->
Write
(
tableName
))
{
return
Status
(
SERVER_WRITE_ERROR
,
"Write table name failed!"
);
}
}
}
return
Status
::
OK
();
return
Status
::
OK
();
}
}
...
@@ -920,7 +916,7 @@ DescribeIndexTask::OnExecute() {
...
@@ -920,7 +916,7 @@ DescribeIndexTask::OnExecute() {
return
status
;
return
status
;
}
}
index_param_
->
mutable_table_name
()
->
set_table_name
(
table_name_
);
index_param_
->
set_table_name
(
table_name_
);
index_param_
->
mutable_index
()
->
set_index_type
(
index
.
engine_type_
);
index_param_
->
mutable_index
()
->
set_index_type
(
index
.
engine_type_
);
index_param_
->
mutable_index
()
->
set_nlist
(
index
.
nlist_
);
index_param_
->
mutable_index
()
->
set_nlist
(
index
.
nlist_
);
...
...
cpp/src/server/grpc_impl/GrpcRequestTask.h
浏览文件 @
c2e563be
...
@@ -124,17 +124,17 @@ private:
...
@@ -124,17 +124,17 @@ private:
class
ShowTablesTask
:
public
GrpcBaseTask
{
class
ShowTablesTask
:
public
GrpcBaseTask
{
public:
public:
static
BaseTaskPtr
static
BaseTaskPtr
Create
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
);
Create
(
::
milvus
::
grpc
::
TableNameList
*
table_name_list
);
protected:
protected:
explicit
explicit
ShowTablesTask
(
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
);
ShowTablesTask
(
::
milvus
::
grpc
::
TableNameList
*
table_name_list
);
Status
Status
OnExecute
()
override
;
OnExecute
()
override
;
private:
private:
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TableName
>
*
writer
_
;
::
milvus
::
grpc
::
TableNameList
*
table_name_list
_
;
};
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
cpp/unittest/CMakeLists.txt
浏览文件 @
c2e563be
...
@@ -72,7 +72,7 @@ set(unittest_files
...
@@ -72,7 +72,7 @@ set(unittest_files
${
CMAKE_CURRENT_SOURCE_DIR
}
/main.cpp
)
${
CMAKE_CURRENT_SOURCE_DIR
}
/main.cpp
)
set
(
helper_files
set
(
helper_files
${
MILVUS_ENGINE_SRC
}
/server/ServerConfig.cpp
#
${MILVUS_ENGINE_SRC}/server/ServerConfig.cpp
${
MILVUS_ENGINE_SRC
}
/utils/CommonUtil.cpp
${
MILVUS_ENGINE_SRC
}
/utils/CommonUtil.cpp
${
MILVUS_ENGINE_SRC
}
/utils/TimeRecorder.cpp
${
MILVUS_ENGINE_SRC
}
/utils/TimeRecorder.cpp
${
MILVUS_ENGINE_SRC
}
/utils/Status.cpp
${
MILVUS_ENGINE_SRC
}
/utils/Status.cpp
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录