mirror of https://gitee.com/bigwinds/arangodb
supervising on
This commit is contained in:
parent
c51e92f449
commit
182e1a2fbe
|
@ -450,4 +450,9 @@ Store const& Agent::readDB () const {
|
|||
return _readDB;
|
||||
}
|
||||
|
||||
Agent& Agent::operator= (VPackSlice const& slice) {
|
||||
_spearhead = slice;
|
||||
return *this;
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -130,7 +130,9 @@ public:
|
|||
Store const& readDB() const;
|
||||
|
||||
/// @brief Get spearhead store
|
||||
Store const& spearhead() const;
|
||||
Store const& spearhead() const;
|
||||
|
||||
Agent& operator= (VPackSlice const&);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
#include "VocBase/collection.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
|
||||
#warning iostream
|
||||
#include <iostream>
|
||||
|
||||
using namespace arangodb;
|
||||
using namespace arangodb::application_features;
|
||||
using namespace arangodb::consensus;
|
||||
|
@ -264,7 +267,6 @@ bool State::loadCollections(TRI_vocbase_t* vocbase, bool waitForSync) {
|
|||
return loadPersisted ();
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
bool State::loadPersisted() {
|
||||
|
||||
TRI_ASSERT(_vocbase != nullptr);
|
||||
|
@ -280,13 +282,13 @@ bool State::loadPersisted() {
|
|||
}
|
||||
|
||||
bool State::loadCompacted () {
|
||||
|
||||
auto bindVars = std::make_shared<VPackBuilder>();
|
||||
bindVars->openObject();
|
||||
bindVars->close();
|
||||
|
||||
std::string const aql(
|
||||
std::string("FOR c IN compact SORT c._key DESC LIMIT 1 RETURN c"));
|
||||
|
||||
arangodb::aql::Query query(
|
||||
false, _vocbase, aql.c_str(), aql.size(), bindVars, nullptr,
|
||||
arangodb::aql::PART_MAIN);
|
||||
|
@ -297,22 +299,14 @@ bool State::loadCompacted () {
|
|||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
}
|
||||
|
||||
auto result = queryResult.result->slice();
|
||||
VPackSlice result = queryResult.result->slice();
|
||||
|
||||
LOG(WARN) << result.toJson();
|
||||
|
||||
if (result.isArray()) {
|
||||
for (auto const& i : VPackArrayIterator(result)) {
|
||||
buffer_t tmp =
|
||||
std::make_shared<arangodb::velocypack::Buffer<uint8_t>>();
|
||||
auto req = i.get("request");
|
||||
tmp->append(req.startAs<char const>(), req.byteSize());
|
||||
_log.push_back(
|
||||
log_t(
|
||||
std::stoi(i.get(StaticStrings::KeyString).copyString()),
|
||||
static_cast<term_t>(i.get("term").getUInt()),
|
||||
static_cast<arangodb::consensus::id_t>(i.get("leader").getUInt()),
|
||||
tmp));
|
||||
(*_agent) = i.get("readDB");
|
||||
_cur = std::stoul(i.get("_key").copyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,6 +334,7 @@ bool State::loadRemaining () {
|
|||
auto result = queryResult.result->slice();
|
||||
|
||||
if (result.isArray()) {
|
||||
_log.clear();
|
||||
for (auto const& i : VPackArrayIterator(result)) {
|
||||
buffer_t tmp =
|
||||
std::make_shared<arangodb::velocypack::Buffer<uint8_t>>();
|
||||
|
@ -353,7 +348,7 @@ bool State::loadRemaining () {
|
|||
tmp));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -474,6 +474,11 @@ bool Store::applies (arangodb::velocypack::Slice const& slice) {
|
|||
return _node.applies(slice);
|
||||
}
|
||||
|
||||
Store& Store::operator= (VPackSlice const& slice) {
|
||||
MUTEX_LOCKER(storeLocker, _storeLock);
|
||||
_node.applies(slice[0]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Store::toBuilder (Builder& b) const {
|
||||
_node.toBuilder(b);
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
/// @brief Get node specified by path string
|
||||
Node const operator ()(std::string const& path) const;
|
||||
|
||||
Store& operator= (VPackSlice const& slice);
|
||||
|
||||
/// @brief Apply single slice
|
||||
bool applies (arangodb::velocypack::Slice const&);
|
||||
|
||||
|
|
Loading…
Reference in New Issue