Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
fcb56568
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,发现更多精彩内容 >>
提交
fcb56568
编写于
3月 08, 2020
作者:
G
groot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine c++sdk
Signed-off-by:
N
groot
<
yihua.mo@zilliz.com
>
上级
ab8339ce
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
102 addition
and
138 deletion
+102
-138
sdk/grpc/ClientProxy.cpp
sdk/grpc/ClientProxy.cpp
+0
-15
sdk/grpc/ClientProxy.h
sdk/grpc/ClientProxy.h
+0
-3
sdk/include/MilvusApi.h
sdk/include/MilvusApi.h
+102
-112
sdk/interface/ConnectionImpl.cpp
sdk/interface/ConnectionImpl.cpp
+0
-5
sdk/interface/ConnectionImpl.h
sdk/interface/ConnectionImpl.h
+0
-3
未找到文件。
sdk/grpc/ClientProxy.cpp
浏览文件 @
fcb56568
...
@@ -415,21 +415,6 @@ ClientProxy::ServerStatus() const {
...
@@ -415,21 +415,6 @@ ClientProxy::ServerStatus() const {
}
}
}
}
std
::
string
ClientProxy
::
DumpTaskTables
()
const
{
if
(
channel_
==
nullptr
)
{
return
"not connected to server"
;
}
try
{
std
::
string
dummy
;
Status
status
=
client_ptr_
->
Cmd
(
"tasktable"
,
dummy
);
return
dummy
;
}
catch
(
std
::
exception
&
ex
)
{
return
"connection lost"
;
}
}
Status
Status
ClientProxy
::
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
{
ClientProxy
::
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
{
try
{
try
{
...
...
sdk/grpc/ClientProxy.h
浏览文件 @
fcb56568
...
@@ -84,9 +84,6 @@ class ClientProxy : public Connection {
...
@@ -84,9 +84,6 @@ class ClientProxy : public Connection {
std
::
string
std
::
string
ServerStatus
()
const
override
;
ServerStatus
()
const
override
;
std
::
string
DumpTaskTables
()
const
override
;
Status
Status
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
override
;
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
override
;
...
...
sdk/include/MilvusApi.h
浏览文件 @
fcb56568
...
@@ -54,20 +54,19 @@ struct ConnectParam {
...
@@ -54,20 +54,19 @@ struct ConnectParam {
};
};
/**
/**
* @brief
Table Schema
* @brief
Collection parameters
*/
*/
struct
TableSchema
{
struct
CollectionParam
{
std
::
string
table_name
;
///< Tabl
e name
std
::
string
collection_name
;
///< Collection_nam
e name
int64_t
dimension
=
0
;
///< Vector dimension, must be a positive value
int64_t
dimension
=
0
;
///< Vector dimension, must be a positive value
int64_t
index_file_size
=
1024
;
///< Index file size, must be a positive value, unit: MB
int64_t
index_file_size
=
1024
;
///< Index file size, must be a positive value, unit: MB
MetricType
metric_type
=
MetricType
::
L2
;
///< Index metric type
MetricType
metric_type
=
MetricType
::
L2
;
///< Index metric type
};
};
/**
/**
* @brief
Record inserted
* @brief
Entity inserted, currently each entity represent a vector
*/
*/
struct
RowRecord
{
struct
Entity
{
std
::
vector
<
float
>
float_data
;
///< Vector raw float data
std
::
vector
<
float
>
float_data
;
///< Vector raw float data
std
::
vector
<
uint8_t
>
binary_data
;
///< Vector raw binary data
std
::
vector
<
uint8_t
>
binary_data
;
///< Vector raw binary data
};
};
...
@@ -76,7 +75,7 @@ struct RowRecord {
...
@@ -76,7 +75,7 @@ struct RowRecord {
* @brief TopK query result
* @brief TopK query result
*/
*/
struct
QueryResult
{
struct
QueryResult
{
std
::
vector
<
int64_t
>
ids
;
///< Query ids result
std
::
vector
<
int64_t
>
ids
;
///< Query
entity
ids result
std
::
vector
<
float
>
distances
;
///< Query distances result
std
::
vector
<
float
>
distances
;
///< Query distances result
};
};
using
TopKQueryResult
=
std
::
vector
<
QueryResult
>
;
///< Topk query result
using
TopKQueryResult
=
std
::
vector
<
QueryResult
>
;
///< Topk query result
...
@@ -85,13 +84,14 @@ using TopKQueryResult = std::vector<QueryResult>; ///< Topk query result
...
@@ -85,13 +84,14 @@ using TopKQueryResult = std::vector<QueryResult>; ///< Topk query result
* @brief Index parameters
* @brief Index parameters
* Note: extra_params is extra parameters list, it must be json format
* Note: extra_params is extra parameters list, it must be json format
* For different index type, parameter list is different accordingly, for example:
* For different index type, parameter list is different accordingly, for example:
* FLAT/IVFLAT/SQ8: "{nlist: '16384'}"
* FLAT/IVFLAT/SQ8: "{nlist: '16384'}" nlist range:[1, 999999]
* IVFPQ: "{nlist: '16384', nbits: "16"}"
* IVFPQ: "{nlist: '16384', m: "12"}" nlist range:[1, 999999] m is decided by dim and have a couple of results.
* NSG: "{search_length: '100', out_degree:'40', pool_size:'66'}"
* NSG: "{search_length: '45', out_degree:'50', candidate_pool_size:'300', "knng":'100'}"
* HNSW "{M: '16', ef_construct:'500'}"
* search_length range:[10, 300] out_degree range:[5, 300] candidate_pool_size range:[50, 1000] knng range:[5, 300]
* HNSW "{M: '16', efConstruction:'500'}" M range:[5, 48] efConstruction range:[topk, 4096]
*/
*/
struct
IndexParam
{
struct
IndexParam
{
std
::
string
table_name
;
///< Table
name for create index
std
::
string
collection_name
;
///< Collection
name for create index
IndexType
index_type
;
///< Index type
IndexType
index_type
;
///< Index type
std
::
string
extra_params
;
///< Extra parameters according to different index type, must be json format
std
::
string
extra_params
;
///< Extra parameters according to different index type, must be json format
};
};
...
@@ -100,7 +100,7 @@ struct IndexParam {
...
@@ -100,7 +100,7 @@ struct IndexParam {
* @brief partition parameters
* @brief partition parameters
*/
*/
struct
PartitionParam
{
struct
PartitionParam
{
std
::
string
table
_name
;
std
::
string
collection
_name
;
std
::
string
partition_tag
;
std
::
string
partition_tag
;
};
};
...
@@ -126,11 +126,11 @@ struct PartitionStat {
...
@@ -126,11 +126,11 @@ struct PartitionStat {
};
};
/**
/**
* @brief
table
info
* @brief
collection
info
*/
*/
struct
Table
Info
{
struct
Collection
Info
{
int64_t
total_row_count
;
///<
Table total row
count
int64_t
total_row_count
;
///<
Collection total entity
count
std
::
vector
<
PartitionStat
>
partitions_stat
;
///<
Table
's partitions statistics
std
::
vector
<
PartitionStat
>
partitions_stat
;
///<
Collection
's partitions statistics
};
};
/**
/**
...
@@ -210,112 +210,132 @@ class Connection {
...
@@ -210,112 +210,132 @@ class Connection {
Disconnect
()
=
0
;
Disconnect
()
=
0
;
/**
/**
* @brief
Create table method
* @brief
Give the client version
*
*
* This method is used to
create table
.
* This method is used to
give the client version
.
*
*
* @param param, use to provide table information to be created.
* @return Client version.
*/
virtual
std
::
string
ClientVersion
()
const
=
0
;
/**
* @brief Give the server version
*
* This method is used to give the server version.
*
*
* @return Indicate if table is created successfully
* @return Server version.
*/
virtual
std
::
string
ServerVersion
()
const
=
0
;
/**
* @brief Create collection method
*
* This method is used to create collection.
*
* @param param, use to provide collection information to be created.
*
* @return Indicate if collection is created successfully
*/
*/
virtual
Status
virtual
Status
Create
Table
(
const
TableSchema
&
param
)
=
0
;
Create
Collection
(
const
CollectionParam
&
param
)
=
0
;
/**
/**
* @brief Test
table
existence method
* @brief Test
collection
existence method
*
*
* This method is used to
create tabl
e.
* This method is used to
test collection existenc
e.
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
*
*
* @return Indicate if
table
is cexist
* @return Indicate if
collection
is cexist
*/
*/
virtual
bool
virtual
bool
Has
Table
(
const
std
::
string
&
table
_name
)
=
0
;
Has
Collection
(
const
std
::
string
&
collection
_name
)
=
0
;
/**
/**
* @brief Drop
table
method
* @brief Drop
collection
method
*
*
* This method is used to drop
table
(and its partitions).
* This method is used to drop
collection
(and its partitions).
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
*
*
* @return Indicate if
table
is drop successfully.
* @return Indicate if
collection
is drop successfully.
*/
*/
virtual
Status
virtual
Status
Drop
Table
(
const
std
::
string
&
table
_name
)
=
0
;
Drop
Collection
(
const
std
::
string
&
collection
_name
)
=
0
;
/**
/**
* @brief Create index method
* @brief Create index method
*
*
* This method is used to create index for whole
table
(and its partitions).
* This method is used to create index for whole
collection
(and its partitions).
*
*
* @param IndexParam
* @param index_param, use to provide index information to be created.
* table_name, table name is going to be create index.
* index type,
* nlist,
* index file size
*
*
* @return Indicate if
build
index successfully.
* @return Indicate if
create
index successfully.
*/
*/
virtual
Status
virtual
Status
CreateIndex
(
const
IndexParam
&
index_param
)
=
0
;
CreateIndex
(
const
IndexParam
&
index_param
)
=
0
;
/**
/**
* @brief Insert
vector
to table
* @brief Insert
entity
to table
*
*
* This method is used to insert vector array to table.
* This method is used to insert vector array to table.
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param partition_tag, target partition's tag, keep empty if no partition specified.
* @param partition_tag, target partition's tag, keep empty if no partition specified.
* @param
record_array, vector array is inserted
.
* @param
entity_array, entity array is inserted, each entitu represent a vector
.
* @param id_array,
* @param id_array,
* specify id for each
vector
,
* specify id for each
entity
,
* if this array is empty, milvus will generate unique id for each
vector
,
* if this array is empty, milvus will generate unique id for each
entity
,
* and return all ids by this parameter.
* and return all ids by this parameter.
*
*
* @return Indicate if
vector
array are inserted successfully
* @return Indicate if
entity
array are inserted successfully
*/
*/
virtual
Status
virtual
Status
Insert
(
const
std
::
string
&
table_name
,
const
std
::
string
&
partition_tag
,
const
std
::
vector
<
RowRecord
>&
record_array
,
Insert
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_tag
,
const
std
::
vector
<
Entity
>&
entity_array
,
std
::
vector
<
int64_t
>&
id_array
)
=
0
;
std
::
vector
<
int64_t
>&
id_array
)
=
0
;
/**
/**
* @brief Get
vector
data by id
* @brief Get
entity
data by id
*
*
* This method is used to get
vector data by id from a table
.
* This method is used to get
entity data by id from a collection
.
* Return the first found
vector if there are vector
s with duplicated id
* Return the first found
entity if there are entitie
s with duplicated id
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param
vector_id, target vector
id.
* @param
entity_id, target entity
id.
* @param
vector_data, returned vector
data.
* @param
entity_data, returned entity
data.
*
*
* @return Indicate if the operation is succeed.
* @return Indicate if the operation is succeed.
*/
*/
virtual
Status
virtual
Status
Get
VectorByID
(
const
std
::
string
&
table_name
,
int64_t
vector_id
,
RowRecord
&
vector
_data
)
=
0
;
Get
EntityByID
(
const
std
::
string
&
collection_name
,
int64_t
entity_id
,
Entity
&
entity
_data
)
=
0
;
/**
/**
* @brief Get
vector
ids from a segment
* @brief Get
entity
ids from a segment
*
*
* This method is used to get
vector
ids from a segment
* This method is used to get
entity
ids from a segment
* Return all
vector
(not deleted) ids
* Return all
entity
(not deleted) ids
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param segment_name, target segment name.
* @param segment_name, target segment name.
* @param id_array, returned
vector
id array.
* @param id_array, returned
entity
id array.
*
*
* @return Indicate if the operation is succeed.
* @return Indicate if the operation is succeed.
*/
*/
virtual
Status
virtual
Status
GetIDsInSegment
(
const
std
::
string
&
table_name
,
const
std
::
string
&
segment_name
,
std
::
vector
<
int64_t
>&
id_array
)
=
0
;
GetIDsInSegment
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
segment_name
,
std
::
vector
<
int64_t
>&
id_array
)
=
0
;
/**
/**
* @brief Search
vector
* @brief Search
entities in a collection
*
*
* This method is used to query
vector in table
.
* This method is used to query
entity in collection
.
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param partition_tag_array, target partitions, keep empty if no partition specified.
* @param partition_tag_array, target partitions, keep empty if no partition specified.
* @param query_record_array, vectors to be queried.
* @param query_record_array, vectors to be queried.
* @param topk, how many similarity vectors will be returned.
* @param topk, how many similarity vectors will be returned.
...
@@ -331,79 +351,59 @@ class Connection {
...
@@ -331,79 +351,59 @@ class Connection {
*/
*/
virtual
Status
virtual
Status
Search
(
const
std
::
string
&
table_name
,
const
PartitionTagList
&
partition_tag_array
,
Search
(
const
std
::
string
&
table_name
,
const
PartitionTagList
&
partition_tag_array
,
const
std
::
vector
<
RowRecord
>&
query_record_array
,
int64_t
topk
,
const
std
::
vector
<
Entity
>&
query_record_array
,
int64_t
topk
,
const
std
::
string
&
extra_params
,
TopKQueryResult
&
topk_query_result
)
=
0
;
const
std
::
string
&
extra_params
,
TopKQueryResult
&
topk_query_result
)
=
0
;
/**
/**
* @brief Show
table
description
* @brief Show
collection
description
*
*
* This method is used to show
table
information.
* This method is used to show
collection
information.
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param
table_schema, table
_schema is given when operation is successful.
* @param
collection_schema, collection
_schema is given when operation is successful.
*
*
* @return Indicate if this operation is successful.
* @return Indicate if this operation is successful.
*/
*/
virtual
Status
virtual
Status
Describe
Table
(
const
std
::
string
&
table_name
,
TableSchema
&
table
_schema
)
=
0
;
Describe
Collection
(
const
std
::
string
&
collection_name
,
TableSchema
&
collection
_schema
)
=
0
;
/**
/**
* @brief Get
table
row count
* @brief Get
collection
row count
*
*
* This method is used to get
table
row count.
* This method is used to get
collection
row count.
*
*
* @param
table_name, target table
's name.
* @param
collection_name, target collection
's name.
* @param
row_count, table total row
count(including partitions).
* @param
entity_count, collection total entity
count(including partitions).
*
*
* @return Indicate if this operation is successful.
* @return Indicate if this operation is successful.
*/
*/
virtual
Status
virtual
Status
Count
Table
(
const
std
::
string
&
table_name
,
int64_t
&
row
_count
)
=
0
;
Count
Collection
(
const
std
::
string
&
collection_name
,
int64_t
&
entity
_count
)
=
0
;
/**
/**
* @brief Show all
table
s in database
* @brief Show all
collection
s in database
*
*
* This method is used to list all
table
s.
* This method is used to list all
collection
s.
*
*
* @param
table_array, all table
s in database.
* @param
collection_array, all collection
s in database.
*
*
* @return Indicate if this operation is successful.
* @return Indicate if this operation is successful.
*/
*/
virtual
Status
virtual
Status
Show
Tables
(
std
::
vector
<
std
::
string
>&
table
_array
)
=
0
;
Show
Collections
(
std
::
vector
<
std
::
string
>&
collection
_array
)
=
0
;
/**
/**
* @brief Show
table
information
* @brief Show
collections
information
*
*
* This method is used to get detail information of a
table
.
* This method is used to get detail information of a
collections
.
*
*
* @param
table_name, target table
's name.
* @param
collections_name, target collections
's name.
* @param
table_info, target table
's information
* @param
collections_info, target collections
's information
*
*
* @return Indicate if this operation is successful.
* @return Indicate if this operation is successful.
*/
*/
virtual
Status
virtual
Status
ShowTableInfo
(
const
std
::
string
&
table_name
,
TableInfo
&
table_info
)
=
0
;
ShowCollectionInfo
(
const
std
::
string
&
collections_name
,
TableInfo
&
collections_info
)
=
0
;
/**
* @brief Give the client version
*
* This method is used to give the client version.
*
* @return Client version.
*/
virtual
std
::
string
ClientVersion
()
const
=
0
;
/**
* @brief Give the server version
*
* This method is used to give the server version.
*
* @return Server version.
*/
virtual
std
::
string
ServerVersion
()
const
=
0
;
/**
/**
* @brief Give the server status
* @brief Give the server status
...
@@ -415,16 +415,6 @@ class Connection {
...
@@ -415,16 +415,6 @@ class Connection {
virtual
std
::
string
virtual
std
::
string
ServerStatus
()
const
=
0
;
ServerStatus
()
const
=
0
;
/**
* @brief dump server tasks information
*
* This method is internal used.
*
* @return Task information in tasktables.
*/
virtual
std
::
string
DumpTaskTables
()
const
=
0
;
/**
/**
* [deprecated]
* [deprecated]
* @brief delete tables by vector id
* @brief delete tables by vector id
...
...
sdk/interface/ConnectionImpl.cpp
浏览文件 @
fcb56568
...
@@ -130,11 +130,6 @@ ConnectionImpl::ServerStatus() const {
...
@@ -130,11 +130,6 @@ ConnectionImpl::ServerStatus() const {
return
client_proxy_
->
ServerStatus
();
return
client_proxy_
->
ServerStatus
();
}
}
std
::
string
ConnectionImpl
::
DumpTaskTables
()
const
{
return
client_proxy_
->
DumpTaskTables
();
}
Status
Status
ConnectionImpl
::
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
{
ConnectionImpl
::
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
{
return
client_proxy_
->
DeleteByID
(
table_name
,
id_array
);
return
client_proxy_
->
DeleteByID
(
table_name
,
id_array
);
...
...
sdk/interface/ConnectionImpl.h
浏览文件 @
fcb56568
...
@@ -86,9 +86,6 @@ class ConnectionImpl : public Connection {
...
@@ -86,9 +86,6 @@ class ConnectionImpl : public Connection {
std
::
string
std
::
string
ServerStatus
()
const
override
;
ServerStatus
()
const
override
;
std
::
string
DumpTaskTables
()
const
override
;
Status
Status
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
override
;
DeleteByID
(
const
std
::
string
&
table_name
,
const
std
::
vector
<
int64_t
>&
id_array
)
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录