Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
2990e847
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,发现更多精彩内容 >>
提交
2990e847
编写于
8月 08, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix functions define format
Former-commit-id: eaf28ed034aa82f609e4e6a0c7d7ba0f1596c06e
上级
db1b3862
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
101 addition
and
50 deletion
+101
-50
cpp/src/sdk/include/Status.h
cpp/src/sdk/include/Status.h
+54
-27
cpp/src/server/grpc_impl/MilvusServer.h
cpp/src/server/grpc_impl/MilvusServer.h
+5
-2
cpp/src/server/grpc_impl/RequestTask.h
cpp/src/server/grpc_impl/RequestTask.h
+42
-21
未找到文件。
cpp/src/sdk/include/Status.h
浏览文件 @
2990e847
...
...
@@ -63,7 +63,8 @@ public:
* @param status, status to be copied.
*
*/
inline
Status
(
const
Status
&
status
);
inline
Status
(
const
Status
&
status
);
/**
* @brief Status
...
...
@@ -74,7 +75,8 @@ public:
* @return, the status is assigned.
*
*/
Status
&
operator
=
(
const
Status
&
s
);
Status
&
operator
=
(
const
Status
&
s
);
/**
* @brief Status
...
...
@@ -84,7 +86,8 @@ public:
* @param status, status to be moved.
*
*/
inline
Status
(
Status
&&
s
)
noexcept
:
state_
(
s
.
state_
)
{};
inline
Status
(
Status
&&
s
)
noexcept
:
state_
(
s
.
state_
)
{};
/**
* @brief Status
...
...
@@ -95,7 +98,8 @@ public:
* @return, the status is moved.
*
*/
Status
&
operator
=
(
Status
&&
s
)
noexcept
;
Status
&
operator
=
(
Status
&&
s
)
noexcept
;
/**
* @brief Status
...
...
@@ -106,7 +110,8 @@ public:
* @return, the status after AND operation.
*
*/
inline
Status
operator
&
(
const
Status
&
s
)
const
noexcept
;
inline
Status
operator
&
(
const
Status
&
s
)
const
noexcept
;
/**
* @brief Status
...
...
@@ -117,7 +122,8 @@ public:
* @return, the status after AND operation.
*
*/
inline
Status
operator
&
(
Status
&&
s
)
const
noexcept
;
inline
Status
operator
&
(
Status
&&
s
)
const
noexcept
;
/**
* @brief Status
...
...
@@ -128,7 +134,8 @@ public:
* @return, the status after AND operation.
*
*/
inline
Status
&
operator
&=
(
const
Status
&
s
)
noexcept
;
inline
Status
&
operator
&=
(
const
Status
&
s
)
noexcept
;
/**
* @brief Status
...
...
@@ -139,7 +146,8 @@ public:
* @return, the status after AND operation.
*
*/
inline
Status
&
operator
&=
(
Status
&&
s
)
noexcept
;
inline
Status
&
operator
&=
(
Status
&&
s
)
noexcept
;
/**
* @brief OK
...
...
@@ -149,7 +157,8 @@ public:
* @return, the status with OK.
*
*/
static
Status
OK
()
{
return
Status
();
}
static
Status
OK
()
{
return
Status
();
}
/**
* @brief OK
...
...
@@ -161,7 +170,8 @@ public:
*
*/
template
<
typename
...
Args
>
static
Status
OK
(
Args
&&
...
args
)
{
static
Status
OK
(
Args
&&
...
args
)
{
return
Status
(
StatusCode
::
OK
,
MessageBuilder
(
std
::
forward
<
Args
>
(
args
)...));
}
...
...
@@ -175,7 +185,8 @@ public:
*
*/
template
<
typename
...
Args
>
static
Status
Invalid
(
Args
&&
...
args
)
{
static
Status
Invalid
(
Args
&&
...
args
)
{
return
Status
(
StatusCode
::
InvalidAgument
,
MessageBuilder
(
std
::
forward
<
Args
>
(
args
)...));
}
...
...
@@ -190,7 +201,8 @@ static Status Invalid(Args &&... args) {
*
*/
template
<
typename
...
Args
>
static
Status
UnknownError
(
Args
&&
...
args
)
{
static
Status
UnknownError
(
Args
&&
...
args
)
{
return
Status
(
StatusCode
::
UnknownError
,
MessageBuilder
(
std
::
forward
<
Args
>
(
args
)...));
}
...
...
@@ -204,7 +216,8 @@ static Status UnknownError(Args &&... args) {
*
*/
template
<
typename
...
Args
>
static
Status
NotSupported
(
Args
&&
...
args
)
{
static
Status
NotSupported
(
Args
&&
...
args
)
{
return
Status
(
StatusCode
::
NotSupported
,
MessageBuilder
(
std
::
forward
<
Args
>
(
args
)...));
}
...
...
@@ -216,7 +229,8 @@ static Status NotSupported(Args &&... args) {
* @return, if the status indicates success.
*
*/
bool
ok
()
const
{
return
(
state_
==
nullptr
);
}
bool
ok
()
const
{
return
(
state_
==
nullptr
);
}
/**
* @brief IsInvalid
...
...
@@ -226,7 +240,8 @@ bool ok() const { return (state_ == nullptr); }
* @return, if the status indicates invalid.
*
*/
bool
IsInvalid
()
const
{
return
code
()
==
StatusCode
::
InvalidAgument
;
}
bool
IsInvalid
()
const
{
return
code
()
==
StatusCode
::
InvalidAgument
;
}
/**
* @brief IsUnknownError
...
...
@@ -236,7 +251,8 @@ bool IsInvalid() const { return code() == StatusCode::InvalidAgument; }
* @return, if the status indicates unknown error.
*
*/
bool
IsUnknownError
()
const
{
return
code
()
==
StatusCode
::
UnknownError
;
}
bool
IsUnknownError
()
const
{
return
code
()
==
StatusCode
::
UnknownError
;
}
/**
* @brief IsNotSupported
...
...
@@ -246,7 +262,8 @@ bool IsUnknownError() const { return code() == StatusCode::UnknownError; }
* @return, if the status indicates not supported.
*
*/
bool
IsNotSupported
()
const
{
return
code
()
==
StatusCode
::
NotSupported
;
}
bool
IsNotSupported
()
const
{
return
code
()
==
StatusCode
::
NotSupported
;
}
/**
* @brief ToString
...
...
@@ -256,7 +273,8 @@ bool IsNotSupported() const { return code() == StatusCode::NotSupported; }
* @return, error message string.
*
*/
std
::
string
ToString
()
const
;
std
::
string
ToString
()
const
;
/**
* @brief CodeAsString
...
...
@@ -266,7 +284,8 @@ std::string ToString() const;
* @return, a string representation of the status code.
*
*/
std
::
string
CodeAsString
()
const
;
std
::
string
CodeAsString
()
const
;
/**
* @brief code
...
...
@@ -276,7 +295,8 @@ std::string CodeAsString() const;
* @return, the status code value attached to this status.
*
*/
StatusCode
code
()
const
{
return
ok
()
?
StatusCode
::
OK
:
state_
->
code
;
}
StatusCode
code
()
const
{
return
ok
()
?
StatusCode
::
OK
:
state_
->
code
;
}
/**
* @brief message
...
...
@@ -286,7 +306,8 @@ StatusCode code() const { return ok() ? StatusCode::OK : state_->code; }
* @return, the specific error message attached to this status.
*
*/
std
::
string
message
()
const
{
return
ok
()
?
""
:
state_
->
message
;
}
std
::
string
message
()
const
{
return
ok
()
?
""
:
state_
->
message
;
}
private:
struct
State
{
...
...
@@ -298,28 +319,34 @@ struct State {
// a `State` structure containing the error code and message.
State
*
state_
=
nullptr
;
void
DeleteState
()
{
void
DeleteState
()
{
delete
state_
;
state_
=
nullptr
;
}
void
CopyFrom
(
const
Status
&
s
);
void
CopyFrom
(
const
Status
&
s
);
inline
void
MoveFrom
(
Status
&
s
);
inline
void
MoveFrom
(
Status
&
s
);
template
<
typename
Head
>
static
void
MessageBuilderRecursive
(
std
::
stringstream
&
stream
,
Head
&&
head
)
{
static
void
MessageBuilderRecursive
(
std
::
stringstream
&
stream
,
Head
&&
head
)
{
stream
<<
head
;
}
template
<
typename
Head
,
typename
...
Tail
>
static
void
MessageBuilderRecursive
(
std
::
stringstream
&
stream
,
Head
&&
head
,
Tail
&&
...
tail
)
{
static
void
MessageBuilderRecursive
(
std
::
stringstream
&
stream
,
Head
&&
head
,
Tail
&&
...
tail
)
{
MessageBuilderRecursive
(
stream
,
std
::
forward
<
Head
>
(
head
));
MessageBuilderRecursive
(
stream
,
std
::
forward
<
Tail
>
(
tail
)...);
}
template
<
typename
...
Args
>
static
std
::
string
MessageBuilder
(
Args
&&
...
args
)
{
static
std
::
string
MessageBuilder
(
Args
&&
...
args
)
{
std
::
stringstream
stream
;
MessageBuilderRecursive
(
stream
,
std
::
forward
<
Args
>
(
args
)...);
...
...
cpp/src/server/grpc_impl/MilvusServer.h
浏览文件 @
2990e847
...
...
@@ -13,8 +13,11 @@ namespace milvus {
namespace
server
{
class
MilvusServer
{
public:
static
void
StartService
();
static
void
StopService
();
static
void
StartService
();
static
void
StopService
();
};
}
...
...
cpp/src/server/grpc_impl/RequestTask.h
浏览文件 @
2990e847
...
...
@@ -38,12 +38,14 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
HasTableTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
bool
&
has_table
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
bool
&
has_table
);
protected:
HasTableTask
(
const
std
::
string
&
request
,
bool
&
has_table
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
...
...
@@ -54,12 +56,14 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
DescribeTableTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
&
schema
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
&
schema
);
protected:
DescribeTableTask
(
const
std
::
string
&
table_name
,
::
milvus
::
grpc
::
TableSchema
&
schema
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
...
...
@@ -70,12 +74,15 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
DropTableTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
);
protected:
explicit
DropTableTask
(
const
std
::
string
&
table_name
);
explicit
DropTableTask
(
const
std
::
string
&
table_name
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
...
...
@@ -85,12 +92,15 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
BuildIndexTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
);
protected:
explicit
BuildIndexTask
(
const
std
::
string
&
table_name
);
explicit
BuildIndexTask
(
const
std
::
string
&
table_name
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
...
...
@@ -100,12 +110,15 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
ShowTablesTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>&
writer
);
static
BaseTaskPtr
Create
(
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>&
writer
);
protected:
explicit
ShowTablesTask
(
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>&
writer
);
explicit
ShowTablesTask
(
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>&
writer
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
::
grpc
::
ServerWriter
<
::
milvus
::
grpc
::
TableName
>
writer_
;
...
...
@@ -114,14 +127,16 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
InsertVectorTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
InsertInfos
&
insert_infos
,
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
InsertInfos
&
insert_infos
,
::
milvus
::
grpc
::
VectorIds
&
record_ids_
);
protected:
InsertVectorTask
(
const
::
milvus
::
grpc
::
InsertInfos
&
insert_infos
,
::
milvus
::
grpc
::
VectorIds
&
record_ids_
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
const
::
milvus
::
grpc
::
InsertInfos
insert_infos_
;
...
...
@@ -131,7 +146,8 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
SearchVectorTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
SearchVectorInfos
&
searchVectorInfos
,
static
BaseTaskPtr
Create
(
const
::
milvus
::
grpc
::
SearchVectorInfos
&
searchVectorInfos
,
const
std
::
vector
<
std
::
string
>&
file_id_array
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>&
writer
);
...
...
@@ -140,7 +156,8 @@ protected:
const
std
::
vector
<
std
::
string
>&
file_id_array
,
::
grpc
::
ServerWriter
<::
milvus
::
grpc
::
TopKQueryResult
>&
writer
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
const
::
milvus
::
grpc
::
SearchVectorInfos
search_vector_infos_
;
...
...
@@ -151,12 +168,14 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
GetTableRowCountTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
int64_t
&
row_count
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
table_name
,
int64_t
&
row_count
);
protected:
GetTableRowCountTask
(
const
std
::
string
&
table_name
,
int64_t
&
row_count
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
std
::
string
table_name_
;
...
...
@@ -166,12 +185,14 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
PingTask
:
public
BaseTask
{
public:
static
BaseTaskPtr
Create
(
const
std
::
string
&
cmd
,
std
::
string
&
result
);
static
BaseTaskPtr
Create
(
const
std
::
string
&
cmd
,
std
::
string
&
result
);
protected:
PingTask
(
const
std
::
string
&
cmd
,
std
::
string
&
result
);
ServerError
OnExecute
()
override
;
ServerError
OnExecute
()
override
;
private:
std
::
string
cmd_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录