1
0
Fork 0

fix broken vacillant interface

This commit is contained in:
Kaveh Vahedipour 2017-01-16 10:26:17 +01:00
parent 272324c506
commit a6c48619b7
2 changed files with 8 additions and 2 deletions

View File

@ -48,6 +48,7 @@ Agent::Agent(config_t const& config)
_lastCommitIndex(0), _lastCommitIndex(0),
_spearhead(this), _spearhead(this),
_readDB(this), _readDB(this),
_vacillant(this),
_nextCompationAfter(_config.compactionStepSize()), _nextCompationAfter(_config.compactionStepSize()),
_inception(std::make_unique<Inception>(this)), _inception(std::make_unique<Inception>(this)),
_activator(nullptr), _activator(nullptr),
@ -648,7 +649,7 @@ trans_ret_t Agent::transact(query_t const& queries) {
// Non-persistent write to non-persisted key-value store // Non-persistent write to non-persisted key-value store
write_ret_t Agent::write(query_t const& query) { write_ret_t Agent::vacillant(query_t const& query) {
} }

View File

@ -86,13 +86,15 @@ void RestAgencyHandler::redirectRequest(std::string const& leaderId) {
} }
} }
RestStatus RestAgencyHandler::handleVaccilant() { RestStatus RestAgencyHandler::handleVacillant() {
// Must be a POST request // Must be a POST request
if (_request->requestType() != rest::RequestType::POST) { if (_request->requestType() != rest::RequestType::POST) {
generateError(rest::ResponseCode::METHOD_NOT_ALLOWED, 405); generateError(rest::ResponseCode::METHOD_NOT_ALLOWED, 405);
} }
query_t query;
// Need Array input // Need Array input
if (!query->slice().isArray()) { if (!query->slice().isArray()) {
Builder body; Builder body;
@ -134,12 +136,15 @@ RestStatus RestAgencyHandler::handleVaccilant() {
try { try {
ret = _agent->vacillant(query); ret = _agent->vacillant(query);
} catch (std::exception const& e) { } catch (std::exception const& e) {
Builder body;
body.openObject(); body.openObject();
body.add("message", VPackValue(e.what())); body.add("message", VPackValue(e.what()));
body.close(); body.close();
generateResult(rest::ResponseCode::BAD, body.slice()); generateResult(rest::ResponseCode::BAD, body.slice());
return RestStatus::DONE; return RestStatus::DONE;
} }
return RestStatus::DONE;
} }