Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
660953af
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,发现更多精彩内容 >>
提交
660953af
编写于
11月 16, 2019
作者:
Y
yhz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify sdk
上级
f9ece14f
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
60 addition
and
46 deletion
+60
-46
core/src/sdk/examples/partition/src/ClientTest.cpp
core/src/sdk/examples/partition/src/ClientTest.cpp
+35
-34
core/src/sdk/examples/simple/main.cpp
core/src/sdk/examples/simple/main.cpp
+1
-1
core/src/sdk/examples/simple/src/ClientTest.cpp
core/src/sdk/examples/simple/src/ClientTest.cpp
+2
-1
core/src/sdk/grpc/ClientProxy.cpp
core/src/sdk/grpc/ClientProxy.cpp
+21
-9
core/src/sdk/grpc/ClientProxy.h
core/src/sdk/grpc/ClientProxy.h
+1
-1
未找到文件。
core/src/sdk/examples/partition/src/ClientTest.cpp
浏览文件 @
660953af
...
...
@@ -31,45 +31,45 @@
namespace
{
const
char
*
TABLE_NAME
=
milvus_sdk
::
Utils
::
GenTableName
().
c_str
();
constexpr
int64_t
TABLE_DIMENSION
=
512
;
constexpr
int64_t
TABLE_INDEX_FILE_SIZE
=
1024
;
constexpr
milvus
::
MetricType
TABLE_METRIC_TYPE
=
milvus
::
MetricType
::
L2
;
constexpr
int64_t
BATCH_ROW_COUNT
=
10000
;
constexpr
int64_t
NQ
=
5
;
constexpr
int64_t
TOP_K
=
10
;
constexpr
int64_t
NPROBE
=
32
;
constexpr
int64_t
SEARCH_TARGET
=
5000
;
// change this value, result is different
constexpr
milvus
::
IndexType
INDEX_TYPE
=
milvus
::
IndexType
::
IVFSQ8
;
constexpr
int32_t
N_LIST
=
15000
;
constexpr
int32_t
PARTITION_COUNT
=
5
;
constexpr
int32_t
TARGET_PARTITION
=
3
;
milvus
::
TableSchema
BuildTableSchema
()
{
const
char
*
TABLE_NAME
=
milvus_sdk
::
Utils
::
GenTableName
().
c_str
();
constexpr
int64_t
TABLE_DIMENSION
=
512
;
constexpr
int64_t
TABLE_INDEX_FILE_SIZE
=
1024
;
constexpr
milvus
::
MetricType
TABLE_METRIC_TYPE
=
milvus
::
MetricType
::
L2
;
constexpr
int64_t
BATCH_ROW_COUNT
=
10000
;
constexpr
int64_t
NQ
=
5
;
constexpr
int64_t
TOP_K
=
10
;
constexpr
int64_t
NPROBE
=
32
;
constexpr
int64_t
SEARCH_TARGET
=
5000
;
// change this value, result is different
constexpr
milvus
::
IndexType
INDEX_TYPE
=
milvus
::
IndexType
::
IVFSQ8
;
constexpr
int32_t
N_LIST
=
15000
;
constexpr
int32_t
PARTITION_COUNT
=
5
;
constexpr
int32_t
TARGET_PARTITION
=
3
;
milvus
::
TableSchema
BuildTableSchema
()
{
milvus
::
TableSchema
tb_schema
=
{
TABLE_NAME
,
TABLE_DIMENSION
,
TABLE_INDEX_FILE_SIZE
,
TABLE_METRIC_TYPE
};
return
tb_schema
;
}
}
milvus
::
PartitionParam
BuildPartitionParam
(
int32_t
index
)
{
milvus
::
PartitionParam
BuildPartitionParam
(
int32_t
index
)
{
std
::
string
tag
=
std
::
to_string
(
index
);
std
::
string
partition_name
=
std
::
string
(
TABLE_NAME
)
+
"_"
+
tag
;
milvus
::
PartitionParam
partition_param
=
{
TABLE_NAME
,
partition_name
,
tag
};
return
partition_param
;
}
}
milvus
::
IndexParam
BuildIndexParam
()
{
milvus
::
IndexParam
BuildIndexParam
()
{
milvus
::
IndexParam
index_param
=
{
TABLE_NAME
,
INDEX_TYPE
,
N_LIST
};
return
index_param
;
}
}
}
// namespace
void
ClientTest
::
Test
(
const
std
::
string
&
address
,
const
std
::
string
&
port
)
{
ClientTest
::
Test
(
const
std
::
string
&
address
,
const
std
::
string
&
port
)
{
std
::
shared_ptr
<
milvus
::
Connection
>
conn
=
milvus
::
Connection
::
Create
();
milvus
::
Status
stat
;
...
...
@@ -78,7 +78,7 @@ ClientTest::Test(const std::string& address, const std::string& port) {
stat
=
conn
->
Connect
(
param
);
std
::
cout
<<
"Connect function call status: "
<<
stat
.
message
()
<<
std
::
endl
;
}
#ifdef yhz
{
// create table
milvus
::
TableSchema
tb_schema
=
BuildTableSchema
();
stat
=
conn
->
CreateTable
(
tb_schema
);
...
...
@@ -202,4 +202,5 @@ ClientTest::Test(const std::string& address, const std::string& port) {
}
milvus
::
Connection
::
Destroy
(
conn
);
#endif
}
core/src/sdk/examples/simple/main.cpp
浏览文件 @
660953af
...
...
@@ -36,7 +36,7 @@ main(int argc, char* argv[]) {
{
nullptr
,
0
,
nullptr
,
0
}};
int
option_index
=
0
;
std
::
string
address
=
"1
27.0.0.1
"
,
port
=
"19530"
;
std
::
string
address
=
"1
92.168.1.89
"
,
port
=
"19530"
;
app_name
=
argv
[
0
];
int
value
;
...
...
core/src/sdk/examples/simple/src/ClientTest.cpp
浏览文件 @
660953af
...
...
@@ -68,7 +68,7 @@ ClientTest::Test(const std::string& address, const std::string& port) {
stat
=
conn
->
Connect
(
param
);
std
::
cout
<<
"Connect function call status: "
<<
stat
.
message
()
<<
std
::
endl
;
}
#ifdef yhz
{
// server version
std
::
string
version
=
conn
->
ServerVersion
();
std
::
cout
<<
"Server version: "
<<
version
<<
std
::
endl
;
...
...
@@ -206,4 +206,5 @@ ClientTest::Test(const std::string& address, const std::string& port) {
std
::
string
status
=
conn
->
ServerStatus
();
std
::
cout
<<
"Server status after disconnect: "
<<
status
<<
std
::
endl
;
}
#endif
}
core/src/sdk/grpc/ClientProxy.cpp
浏览文件 @
660953af
...
...
@@ -43,16 +43,28 @@ Status
ClientProxy
::
Connect
(
const
ConnectParam
&
param
)
{
std
::
string
uri
=
param
.
ip_address
+
":"
+
param
.
port
;
channel_
=
::
grpc
::
CreateChannel
(
uri
,
::
grpc
::
InsecureChannelCredentials
());
if
(
channel_
!=
nullptr
)
{
connected_
=
true
;
client_ptr_
=
std
::
make_shared
<
GrpcClient
>
(
channel_
);
return
Status
::
OK
();
// channel_ = ::grpc::CreateChannel(uri, ::grpc::InsecureChannelCredentials());
// channel_ = std::make_shared<grpc_channel>(grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr));
// channel_ = std::shared_ptr<grpc_channel>(grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr));
auto
uri_str
=
uri
.
c_str
();
grpc_channel
*
channel
=
grpc_insecure_channel_create
(
uri_str
,
nullptr
,
nullptr
);
// grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr);
auto
state
=
grpc_channel_check_connectivity_state
(
channel
,
true
);
if
(
state
==
GRPC_CHANNEL_READY
)
{
std
::
cout
<<
"Connect "
<<
uri
<<
" successfully"
;
}
else
{
std
::
cout
<<
"Connect "
<<
uri
<<
" failed."
;
}
// if (channel_ != nullptr) {
// connected_ = true;
// client_ptr_ = std::make_shared<GrpcClient>(channel_);
// return Status::OK();
// }
std
::
string
reason
=
"connect failed!"
;
connected_
=
false
;
return
Status
(
StatusCode
::
NotConnected
,
reason
);
//
std::string reason = "connect failed!";
//
connected_ = false;
//
return Status(StatusCode::NotConnected, reason);
}
Status
...
...
core/src/sdk/grpc/ClientProxy.h
浏览文件 @
660953af
...
...
@@ -105,7 +105,7 @@ class ClientProxy : public Connection {
DropPartition
(
const
PartitionParam
&
partition_param
)
override
;
private:
std
::
shared_ptr
<
::
grpc
::
C
hannel
>
channel_
;
std
::
shared_ptr
<
grpc_c
hannel
>
channel_
;
private:
std
::
shared_ptr
<
GrpcClient
>
client_ptr_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录