1
0
Fork 0

nolock swap active member in agent configuration not needed

This commit is contained in:
Kaveh Vahedipour 2017-01-03 09:01:53 +01:00
parent bd28896b69
commit 202f0636df
2 changed files with 14 additions and 13 deletions

View File

@ -197,12 +197,6 @@ struct config_t {
/// @brief Update an indivdual uuid's endpoint
bool updateEndpoint(std::string const&, std::string const&);
private:
/// @brief Get replacement for deceased active agent
bool swapActiveMemberNoLock(std::string const&, std::string const&);
};
}
}

View File

@ -419,6 +419,8 @@ inline RestStatus RestAgencyHandler::handleRead() {
}
RestStatus RestAgencyHandler::handleConfig() {
// Update endpoint of peer
if (_request->requestType() == rest::RequestType::POST) {
try {
arangodb::velocypack::Options options;
@ -429,15 +431,20 @@ RestStatus RestAgencyHandler::handleConfig() {
return RestStatus::DONE;
}
}
// Respond with configuration
Builder body;
body.add(VPackValue(VPackValueType::Object));
body.add("term", Value(_agent->term()));
body.add("leaderId", Value(_agent->leaderID()));
body.add("lastCommitted", Value(_agent->lastCommitted()));
body.add("lastAcked", _agent->lastAckedAgo()->slice());
body.add("configuration", _agent->config().toBuilder()->slice());
body.close();
{
VPackObjectBuilder b(&body);
body.add("term", Value(_agent->term()));
body.add("leaderId", Value(_agent->leaderID()));
body.add("lastCommitted", Value(_agent->lastCommitted()));
body.add("lastAcked", _agent->lastAckedAgo()->slice());
body.add("configuration", _agent->config().toBuilder()->slice());
}
generateResult(rest::ResponseCode::OK, body.slice());
return RestStatus::DONE;
}