mirror of https://gitee.com/bigwinds/arangodb
fixed some tests
This commit is contained in:
parent
8e0a59285b
commit
2eaf7196e2
|
@ -285,8 +285,7 @@ bool Index::Compare(VPackSlice const& lhs, VPackSlice const& rhs) {
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string tmp = lhsType.copyString();
|
||||
auto type = Index::type(tmp.c_str());
|
||||
auto type = Index::type(lhsType.copyString());
|
||||
|
||||
// unique must be identical if present
|
||||
VPackSlice value = lhs.get("unique");
|
||||
|
|
|
@ -224,10 +224,7 @@ class Index {
|
|||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not any attribute is expanded
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool attributeMatches(
|
||||
std::vector<arangodb::basics::AttributeName> const& attribute) const {
|
||||
for (auto const& it : _fields) {
|
||||
|
@ -238,10 +235,7 @@ class Index {
|
|||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not any attribute is expanded
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool hasExpansion() const {
|
||||
for (auto const& it : _fields) {
|
||||
for (auto const& it2 : it) {
|
||||
|
@ -253,76 +247,48 @@ class Index {
|
|||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the underlying collection
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline LogicalCollection* collection() const {
|
||||
return _collection;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a contextual string for logging
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string context() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not the index is sparse
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool sparse() const { return _sparse; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not the index is unique
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool unique() const { return _unique; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the name of the index
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* typeName() const { return typeName(type()); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the index type based on a type name
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
static IndexType type(char const* type);
|
||||
|
||||
static IndexType type(char const*);
|
||||
static IndexType type(std::string const& type) {
|
||||
return Index::type(type.c_str());
|
||||
}
|
||||
|
||||
virtual IndexType type() const = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the name of an index type
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static char const* typeName(IndexType);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief validate an index id
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool validateId(char const*);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief validate an index handle (collection name + / + index id)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool validateHandle(char const*, size_t*);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief generate a new index id
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_idx_iid_t generateId();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief index comparator, used by the coordinator to detect if two index
|
||||
/// contents are the same
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool Compare(VPackSlice const& lhs, VPackSlice const& rhs);
|
||||
|
||||
virtual IndexType type() const = 0;
|
||||
virtual bool isPersistent() const { return false; }
|
||||
virtual bool canBeDropped() const = 0;
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static int EnhanceIndexJson(v8::FunctionCallbackInfo<v8::Value> const& args,
|
|||
}
|
||||
}
|
||||
|
||||
type = arangodb::Index::type(t.c_str());
|
||||
type = arangodb::Index::type(t);
|
||||
}
|
||||
|
||||
if (type == arangodb::Index::TRI_IDX_TYPE_UNKNOWN) {
|
||||
|
@ -394,9 +394,7 @@ static int EnhanceIndexJson(v8::FunctionCallbackInfo<v8::Value> const& args,
|
|||
if (obj->Has(TRI_V8_ASCII_STRING("id"))) {
|
||||
uint64_t id = TRI_ObjectToUInt64(obj->Get(TRI_V8_ASCII_STRING("id")), true);
|
||||
if (id > 0) {
|
||||
char* idString = TRI_StringUInt64(id);
|
||||
builder.add("id", VPackValue(idString));
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, idString);
|
||||
builder.add("id", VPackValue(std::to_string(id)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -824,6 +824,7 @@ void LogicalCollection::setStatus(TRI_vocbase_col_status_e status) {
|
|||
void LogicalCollection::toVelocyPack(VPackBuilder& result) const {
|
||||
result.openObject();
|
||||
result.add("id", VPackValue(std::to_string(_cid)));
|
||||
result.add("cid", VPackValue(std::to_string(_cid))); // export cid for compatibility, too
|
||||
result.add("name", VPackValue(_name));
|
||||
result.add("status", VPackValue(_status));
|
||||
result.add("deleted", VPackValue(_isDeleted));
|
||||
|
@ -833,6 +834,7 @@ void LogicalCollection::toVelocyPack(VPackBuilder& result) const {
|
|||
result.add("isVolatile", VPackValue(_isVolatile));
|
||||
result.add("waitForSync", VPackValue(_waitForSync));
|
||||
result.add("journalSize", VPackValue(_journalSize));
|
||||
result.add("version", VPackValue(5)); // hard-coded version number, here for compatibility only
|
||||
if (_keyOptions != nullptr) {
|
||||
result.add("keyOptions", VPackSlice(_keyOptions->data()));
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ function ReplicationLoggerSuite () {
|
|||
assertEqual(cn, entry.data.name);
|
||||
assertEqual(2, entry.data.type);
|
||||
assertEqual(false, entry.data.deleted);
|
||||
assertEqual(2097152, entry.data.maximalSize);
|
||||
assertEqual(2097152, entry.data.journalSize);
|
||||
assertEqual(true, entry.data.waitForSync);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue