mirror of https://gitee.com/bigwinds/arangodb
add engine capabilities
This commit is contained in:
parent
e42813dafb
commit
f59c78b587
|
@ -55,6 +55,8 @@ class IndexFactory {
|
|||
virtual void fillSystemIndexes(
|
||||
arangodb::LogicalCollection* col,
|
||||
std::vector<std::shared_ptr<arangodb::Index>>& systemIndexes) const = 0;
|
||||
|
||||
virtual std::vector<std::string> supportedIndexes() const = 0;
|
||||
};
|
||||
|
||||
} // namespace arangodb
|
||||
|
|
|
@ -448,3 +448,7 @@ void MMFilesIndexFactory::fillSystemIndexes(
|
|||
std::make_shared<arangodb::MMFilesEdgeIndex>(1, col));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> MMFilesIndexFactory::supportedIndexes() const {
|
||||
return std::vector<std::string>{ "primary", "edge", "hash", "skiplist", "persistent", "geo", "fulltext" };
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ class MMFilesIndexFactory final : public IndexFactory {
|
|||
void fillSystemIndexes(arangodb::LogicalCollection* col,
|
||||
std::vector<std::shared_ptr<arangodb::Index>>&
|
||||
systemIndexes) const override;
|
||||
|
||||
std::vector<std::string> supportedIndexes() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "RestEngineHandler.h"
|
||||
#include "Rest/HttpRequest.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
|
||||
#include <velocypack/Builder.h>
|
||||
#include <velocypack/velocypack-aliases.h>
|
||||
|
@ -38,9 +39,9 @@ RestEngineHandler::RestEngineHandler(GeneralRequest* request,
|
|||
|
||||
RestStatus RestEngineHandler::execute() {
|
||||
VPackBuilder result;
|
||||
result.add(VPackValue(VPackValueType::Object));
|
||||
result.add("name", VPackValue(EngineSelectorFeature::engineName()));
|
||||
result.close();
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
engine->getCapabilities(result);
|
||||
|
||||
generateResult(rest::ResponseCode::OK, result.slice());
|
||||
return RestStatus::DONE;
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ class RocksDBEngine final : public StorageEngine {
|
|||
arangodb::velocypack::Slice info) override;
|
||||
void addParametersForNewIndex(arangodb::velocypack::Builder& builder,
|
||||
arangodb::velocypack::Slice info) override;
|
||||
|
||||
|
||||
rocksdb::TransactionDB* db() const { return _db; }
|
||||
|
||||
RocksDBComparator* cmp() const { return _cmp.get(); }
|
||||
|
|
|
@ -421,3 +421,7 @@ void RocksDBIndexFactory::fillSystemIndexes(
|
|||
2, col, builder.slice(), StaticStrings::ToString));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> RocksDBIndexFactory::supportedIndexes() const {
|
||||
return std::vector<std::string>{ "primary", "edge", "hash", "skiplist", "persistent" };
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ class RocksDBIndexFactory final : public IndexFactory {
|
|||
void fillSystemIndexes(arangodb::LogicalCollection* col,
|
||||
std::vector<std::shared_ptr<arangodb::Index>>&
|
||||
systemIndexes) const override;
|
||||
|
||||
std::vector<std::string> supportedIndexes() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ class StorageEngine : public application_features::ApplicationFeature {
|
|||
// Returns the StorageEngine-specific implementation
|
||||
// of the IndexFactory. This is used to validate
|
||||
// information about indexes.
|
||||
IndexFactory const* indexFactory() {
|
||||
IndexFactory const* indexFactory() const {
|
||||
// The factory has to be created by the implementation
|
||||
// and shall never be deleted
|
||||
TRI_ASSERT(_indexFactory.get() != nullptr);
|
||||
|
@ -406,6 +406,21 @@ class StorageEngine : public application_features::ApplicationFeature {
|
|||
virtual std::shared_ptr<arangodb::velocypack::Builder> getReplicationApplierConfiguration(TRI_vocbase_t*, int& status) = 0;
|
||||
virtual int removeReplicationApplierConfiguration(TRI_vocbase_t* vocbase) = 0;
|
||||
virtual int saveReplicationApplierConfiguration(TRI_vocbase_t* vocbase, arangodb::velocypack::Slice slice, bool doSync) = 0;
|
||||
|
||||
void getCapabilities(VPackBuilder& builder) const {
|
||||
builder.openObject();
|
||||
builder.add("name", VPackValue(typeName()));
|
||||
builder.add("supports", VPackValue(VPackValueType::Object));
|
||||
builder.add("indexes", VPackValue(VPackValueType::Array));
|
||||
|
||||
for (auto const& it : indexFactory()->supportedIndexes()) {
|
||||
builder.add(VPackValue(it));
|
||||
}
|
||||
|
||||
builder.close(); // indexes
|
||||
builder.close(); // supports
|
||||
builder.close(); // object
|
||||
}
|
||||
|
||||
protected:
|
||||
void registerCollection(TRI_vocbase_t* vocbase,
|
||||
|
|
|
@ -2785,6 +2785,7 @@ static void JS_CompletionsVocbase(
|
|||
result->Set(j++, TRI_V8_ASCII_STRING("_drop()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_dropDatabase()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_dropView()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_engine()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_executeTransaction()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_exists()"));
|
||||
result->Set(j++, TRI_V8_ASCII_STRING("_id"));
|
||||
|
|
|
@ -1694,10 +1694,12 @@ static void JS_EngineServer(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
// return engine name
|
||||
v8::Handle<v8::Object> result = v8::Object::New(isolate);
|
||||
result->Set(TRI_V8_ASCII_STRING("name"), TRI_V8_ASCII_STRING(EngineSelectorFeature::engineName()));
|
||||
TRI_V8_RETURN(result);
|
||||
// return engine data
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
VPackBuilder builder;
|
||||
engine->getCapabilities(builder);
|
||||
|
||||
TRI_V8_RETURN(TRI_VPackToV8(isolate, builder.slice()));
|
||||
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue