提交 2990e847 编写于 作者: Y Yu Kun

fix functions define format


Former-commit-id: eaf28ed034aa82f609e4e6a0c7d7ba0f1596c06e
上级 db1b3862
......@@ -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)...);
......
......@@ -13,8 +13,11 @@ namespace milvus {
namespace server {
class MilvusServer {
public:
static void StartService();
static void StopService();
static void
StartService();
static void
StopService();
};
}
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册