-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add SaveGraphVersionProcessor to separate client version check and version saving * Update error code * Update error code
- Loading branch information
1 parent
1a2df35
commit 1ff5161
Showing
9 changed files
with
130 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2022 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
|
||
#include "meta/processors/admin/SaveGraphVersionProcessor.h" | ||
|
||
#include "common/graph/Response.h" | ||
#include "version/Version.h" | ||
|
||
namespace nebula { | ||
namespace meta { | ||
void SaveGraphVersionProcessor::process(const cpp2::SaveGraphVersionReq& req) { | ||
const auto& host = req.get_host(); | ||
|
||
// Build a map of graph service host and its version | ||
auto versionKey = MetaKeyUtils::versionKey(host); | ||
auto versionVal = MetaKeyUtils::versionVal(req.get_build_version().c_str()); | ||
std::vector<kvstore::KV> versionData; | ||
versionData.emplace_back(std::move(versionKey), std::move(versionVal)); | ||
|
||
// Save the version of the graph service | ||
auto errCode = doSyncPut(versionData); | ||
if (errCode != nebula::cpp2::ErrorCode::SUCCEEDED) { | ||
LOG(ERROR) << "Failed to save graph version, errorCode: " | ||
<< apache::thrift::util::enumNameSafe(errCode); | ||
handleErrorCode(errCode); | ||
onFinished(); | ||
return; | ||
} | ||
handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); | ||
|
||
onFinished(); | ||
} | ||
} // namespace meta | ||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Copyright (c) 2022 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
|
||
#ifndef META_SAVEGRAPHVERSIONPROCESSOR_H_ | ||
#define META_SAVEGRAPHVERSIONPROCESSOR_H_ | ||
|
||
#include "meta/processors/BaseProcessor.h" | ||
|
||
namespace nebula { | ||
namespace meta { | ||
class SaveGraphVersionProcessor final : public BaseProcessor<cpp2::SaveGraphVersionResp> { | ||
public: | ||
static SaveGraphVersionProcessor* instance(kvstore::KVStore* kvstore) { | ||
return new SaveGraphVersionProcessor(kvstore); | ||
} | ||
|
||
void process(const cpp2::SaveGraphVersionReq& req); | ||
|
||
private: | ||
explicit SaveGraphVersionProcessor(kvstore::KVStore* kvstore) | ||
: BaseProcessor<cpp2::SaveGraphVersionResp>(kvstore) {} | ||
}; | ||
} // namespace meta | ||
} // namespace nebula | ||
#endif // META_SAVEGRAPHVERSIONPROCESSOR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters