1
0
Fork 0

some fixes after review

This commit is contained in:
Andrey Abramov 2018-03-30 14:34:15 +03:00
parent 3eadf5aaf9
commit 57b5823fcf
2 changed files with 19 additions and 24 deletions

View File

@ -37,7 +37,6 @@
#include "Logger/Logger.h"
#include "Rest/HttpResponse.h"
#include "RestServer/DatabaseFeature.h"
#include "RestServer/ViewTypesFeature.h"
#include "StorageEngine/PhysicalCollection.h"
#include "Utils/Events.h"
#include "VocBase/LogicalCollection.h"

View File

@ -72,7 +72,7 @@ class LogicalDataSource {
bool operator==(Type const& other) const noexcept { return this == &other; }
bool operator!=(Type const& other) const noexcept { return this != &other; }
static Type const& emplace(arangodb::velocypack::StringRef const& name);
inline std::string const& name() const noexcept { return _name; }
std::string const& name() const noexcept { return _name; }
private:
std::string _name; // type name for e.g. log messages
@ -98,9 +98,10 @@ class LogicalDataSource {
_vocbase(vocbase),
_id(id),
_planId(planId ? planId : id),
_deleted(deleted),
_planVersion(0) {
_planVersion(0),
_deleted(deleted) {
}
LogicalDataSource(LogicalDataSource const& other)
: _name(other._name),
_category(other._category),
@ -108,34 +109,30 @@ class LogicalDataSource {
_vocbase(other._vocbase),
_id(other._id),
_planId(other._planId),
_deleted(other._deleted),
_planVersion(other._planVersion) {
_planVersion(other._planVersion),
_deleted(other._deleted) {
}
virtual ~LogicalDataSource() {}
virtual ~LogicalDataSource() = default;
inline Category const& category() const noexcept { return _category; }
inline bool deleted() const noexcept { return _deleted; }
Category const& category() const noexcept { return _category; }
bool deleted() const noexcept { return _deleted; }
virtual void drop() = 0;
inline TRI_voc_cid_t const& id() const noexcept { return _id; } // reference required for ShardDistributionReporterTest
inline std::string const& name() const noexcept { return _name; }
inline TRI_voc_cid_t planId() const noexcept { return _planId; }
TRI_voc_cid_t const& id() const noexcept { return _id; } // reference required for ShardDistributionReporterTest
std::string const& name() const noexcept { return _name; }
TRI_voc_cid_t planId() const noexcept { return _planId; }
virtual Result rename(std::string&& newName, bool doSync) = 0;
inline Type const& type() const noexcept { return _type; }
inline TRI_vocbase_t* vocbase() const noexcept { return _vocbase; }
Type const& type() const noexcept { return _type; }
TRI_vocbase_t* vocbase() const noexcept { return _vocbase; }
// Set and get _planVersion, this is only used if the object is used in
// ClusterInfo to represent a cluster wide collection in the agency.
void setPlanVersion(uint64_t v) {
_planVersion = v;
}
uint64_t getPlanVersion() const {
return _planVersion;
}
void setPlanVersion(uint64_t v) noexcept { _planVersion = v; }
uint64_t getPlanVersion() const noexcept { return _planVersion; }
protected:
inline void deleted(bool deleted) noexcept { _deleted = deleted; }
inline void name(std::string&& name) noexcept { _name = std::move(name); }
void deleted(bool deleted) noexcept { _deleted = deleted; }
void name(std::string&& name) noexcept { _name = std::move(name); }
private:
// members ordered by sizeof(decltype(..))
@ -145,13 +142,12 @@ class LogicalDataSource {
TRI_vocbase_t* const _vocbase; // the database where the data-source resides TODO change to reference
TRI_voc_cid_t const _id; // local data-source id (current database node)
TRI_voc_cid_t const _planId; // global data-source id (cluster-wide)
bool _deleted; // data-source marked as deleted
uint64_t _planVersion; // Only set if setPlanVersion was called. This only
// happens in ClusterInfo when this object is used
// to represent a cluster wide collection. This is
// then the version in the agency Plan that underpins
// the information in this object. Otherwise 0.
bool _deleted; // data-source marked as deleted
};
} // arangodb