From 49aef67ccadbcc67fec38042aad7eb30a046df8f Mon Sep 17 00:00:00 2001 From: jsteemann Date: Wed, 15 Mar 2017 13:07:08 +0100 Subject: [PATCH] use std::shared_ptrs for views --- arangod/MMFiles/MMFilesView.cpp | 9 +-- arangod/MMFiles/MMFilesWalRecoverState.cpp | 6 +- arangod/RestHandler/RestViewHandler.cpp | 21 ++---- arangod/RestHandler/RestViewHandler.h | 4 -- arangod/V8Server/v8-views.cpp | 76 +++++++++++++--------- arangod/VocBase/LogicalView.cpp | 5 +- arangod/VocBase/vocbase.cpp | 74 +++++++++------------ arangod/VocBase/vocbase.h | 22 +++---- 8 files changed, 99 insertions(+), 118 deletions(-) diff --git a/arangod/MMFiles/MMFilesView.cpp b/arangod/MMFiles/MMFilesView.cpp index 03223ec444..5f74a4a256 100644 --- a/arangod/MMFiles/MMFilesView.cpp +++ b/arangod/MMFiles/MMFilesView.cpp @@ -108,7 +108,6 @@ PhysicalView* MMFilesView::clone(LogicalView* logical, PhysicalView* physical){ MMFilesView::MMFilesView(LogicalView* view, VPackSlice const& info) : PhysicalView(view, info) { - LOG_TOPIC(ERR, Logger::FIXME) << "CTOR PHYSICAL " << this; auto pathSlice = info.get("path"); if (pathSlice.isString()) { _path = pathSlice.copyString(); @@ -117,13 +116,9 @@ MMFilesView::MMFilesView(LogicalView* view, MMFilesView::MMFilesView(LogicalView* logical, PhysicalView* physical) - : PhysicalView(logical, VPackSlice::emptyObjectSlice()) { - LOG_TOPIC(ERR, Logger::FIXME) << "CTOR2 PHYSICAL " << this; - } + : PhysicalView(logical, VPackSlice::emptyObjectSlice()) {} -MMFilesView::~MMFilesView() { - LOG_TOPIC(ERR, Logger::FIXME) << "DTOR PHYSICAL " << this; -} +MMFilesView::~MMFilesView() {} void MMFilesView::getPropertiesVPack(velocypack::Builder& result) const { TRI_ASSERT(result.isOpenObject()); diff --git a/arangod/MMFiles/MMFilesWalRecoverState.cpp b/arangod/MMFiles/MMFilesWalRecoverState.cpp index 56ed7be90a..6c88dd5a77 100644 --- a/arangod/MMFiles/MMFilesWalRecoverState.cpp +++ b/arangod/MMFiles/MMFilesWalRecoverState.cpp @@ -784,7 +784,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker, return true; } - LogicalView* view = vocbase->lookupView(viewId); + std::shared_ptr view = vocbase->lookupView(viewId); if (view == nullptr) { // if the underlying collection is gone, we can go on @@ -1039,7 +1039,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker, return true; } - arangodb::LogicalView* view = vocbase->lookupView(viewId); + std::shared_ptr view = vocbase->lookupView(viewId); if (view != nullptr) { // drop an existing view @@ -1277,7 +1277,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker, } // ignore any potential error returned by this call - arangodb::LogicalView* view = vocbase->lookupView(viewId); + std::shared_ptr view = vocbase->lookupView(viewId); if (view != nullptr) { vocbase->dropView(view); diff --git a/arangod/RestHandler/RestViewHandler.cpp b/arangod/RestHandler/RestViewHandler.cpp index 3cf56f0259..e6525307e2 100644 --- a/arangod/RestHandler/RestViewHandler.cpp +++ b/arangod/RestHandler/RestViewHandler.cpp @@ -24,13 +24,8 @@ #include "RestViewHandler.h" #include "Basics/Exceptions.h" -#include "Basics/StaticStrings.h" -#include "Basics/VelocyPackDumper.h" #include "Basics/VelocyPackHelper.h" -#include "Transaction/Context.h" -#include -#include #include using namespace arangodb; @@ -109,7 +104,7 @@ void RestViewHandler::createView() { } TRI_voc_cid_t id = 0; - LogicalView* view = _vocbase->createView(body, id); + std::shared_ptr view = _vocbase->createView(body, id); if (view != nullptr) { generateOk(rest::ResponseCode::CREATED); } else { @@ -141,7 +136,7 @@ void RestViewHandler::modifyView() { } std::string const& name = suffixes[0]; - LogicalView* view = _vocbase->lookupView(name); + std::shared_ptr view = _vocbase->lookupView(name); if (view == nullptr) { generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, "could not find view by that name"); @@ -180,16 +175,14 @@ void RestViewHandler::deleteView() { } std::string const& name = suffixes[0]; - LogicalView* view = _vocbase->lookupView(name); - if (view == nullptr) { - generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, - "could not find view by that name"); - return; - } - int res = _vocbase->dropView(view); + int res = _vocbase->dropView(name); + if (res == TRI_ERROR_NO_ERROR) { generateOk(); + } else if (res == TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND) { + generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, + "could not find view by that name"); } else { generateError(rest::ResponseCode::SERVER_ERROR, TRI_ERROR_INTERNAL, "problem dropping view"); diff --git a/arangod/RestHandler/RestViewHandler.h b/arangod/RestHandler/RestViewHandler.h index 2a78e6edf5..f98e14f04f 100644 --- a/arangod/RestHandler/RestViewHandler.h +++ b/arangod/RestHandler/RestViewHandler.h @@ -28,10 +28,6 @@ #include "Basics/Common.h" #include "RestHandler/RestVocbaseBaseHandler.h" -#include -#include -#include - namespace arangodb { //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/V8Server/v8-views.cpp b/arangod/V8Server/v8-views.cpp index 455f61014a..305053a6d6 100644 --- a/arangod/V8Server/v8-views.cpp +++ b/arangod/V8Server/v8-views.cpp @@ -40,7 +40,7 @@ using namespace arangodb; using namespace arangodb::basics; -static arangodb::LogicalView* GetViewFromArgument( +static std::shared_ptr GetViewFromArgument( TRI_vocbase_t* vocbase, v8::Handle const val) { // number if (val->IsNumber() || val->IsNumberObject()) { @@ -57,10 +57,14 @@ static void WeakViewCallback(const v8::WeakCallbackInfo< auto isolate = data.GetIsolate(); auto persistent = data.GetParameter(); auto myView = v8::Local::New(isolate, *persistent); - auto view = static_cast(myView->Value()); + auto v = static_cast*>(myView->Value()); + + TRI_ASSERT(v != nullptr); + LogicalView* view = v->get(); + TRI_ASSERT(view != nullptr); + TRI_GET_GLOBALS(); -LOG_TOPIC(ERR, Logger::FIXME) << "WEAK CALLBACK FOR VIEW: " << view << "; VIEW: " << view->name(); v8g->decreaseActiveExternals(); // decrease the reference-counter for the database @@ -77,41 +81,41 @@ LOG_TOPIC(ERR, Logger::FIXME) << "WEAK CALLBACK FOR VIEW: " << view << "; VIEW: v8g->JSViews.erase(view); view->vocbase()->release(); - delete view; + delete v; // delete the shared_ptr on the heap } /// @brief wraps a LogicalView v8::Handle WrapView(v8::Isolate* isolate, - arangodb::LogicalView* view) { + std::shared_ptr view) { v8::EscapableHandleScope scope(isolate); -LOG_TOPIC(ERR, Logger::FIXME) << "WRAPPER FOR VIEW: " << view << "; VIEW: " << view->name(); - TRI_GET_GLOBALS(); TRI_GET_GLOBAL(VocbaseViewTempl, v8::ObjectTemplate); v8::Handle result = VocbaseViewTempl->NewInstance(); if (!result.IsEmpty()) { + // create a new shared_ptr on the heap + auto v = new std::shared_ptr(view); result->SetInternalField(SLOT_CLASS_TYPE, v8::Integer::New(isolate, WRP_VOCBASE_VIEW_TYPE)); result->SetInternalField(SLOT_CLASS, - v8::External::New(isolate, view)); + v8::External::New(isolate, v)); - auto const& it = v8g->JSViews.find(view); + auto const& it = v8g->JSViews.find(view.get()); if (it == v8g->JSViews.end()) { // increase the reference-counter for the database TRI_ASSERT(!view->vocbase()->isDangling()); view->vocbase()->forceUse(); try { - auto externalView = v8::External::New(isolate, view); + auto externalView = v8::External::New(isolate, v); result->SetInternalField(SLOT_EXTERNAL, externalView); - v8g->JSViews[view].Reset(isolate, externalView); - v8g->JSViews[view].SetWeak(&v8g->JSViews[view], - WeakViewCallback, - v8::WeakCallbackType::kFinalizer); + v8g->JSViews[view.get()].Reset(isolate, externalView); + v8g->JSViews[view.get()].SetWeak(&v8g->JSViews[view.get()], + WeakViewCallback, + v8::WeakCallbackType::kFinalizer); v8g->increaseActiveExternals(); } catch (...) { view->vocbase()->release(); @@ -125,7 +129,7 @@ LOG_TOPIC(ERR, Logger::FIXME) << "WRAPPER FOR VIEW: " << view << "; VIEW: " << v TRI_GET_GLOBAL_STRING(_DbNameKey); result->ForceSet(_IdKey, TRI_V8UInt64String(isolate, view->id()), v8::ReadOnly); - result->Set(_DbNameKey, TRI_V8_STRING(view->vocbase()->name().c_str())); + result->Set(_DbNameKey, TRI_V8_STD_STRING(view->vocbase()->name())); } return scope.Escape(result); @@ -184,7 +188,7 @@ static void JS_CreateViewVocbase(v8::FunctionCallbackInfo const& args try { TRI_voc_cid_t id = 0; - arangodb::LogicalView* view = vocbase->createView(infoSlice, id); + std::shared_ptr view = vocbase->createView(infoSlice, id); TRI_ASSERT(view != nullptr); @@ -209,16 +213,18 @@ static void JS_DropViewVocbase(v8::FunctionCallbackInfo const& args) TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); - arangodb::LogicalView* view = - TRI_UnwrapClass(args.Holder(), WRP_VOCBASE_VIEW_TYPE); + std::shared_ptr* v = + TRI_UnwrapClass>(args.Holder(), WRP_VOCBASE_VIEW_TYPE); - if (view == nullptr) { + if (v == nullptr || v->get() == nullptr) { TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract view"); } + + LogicalView* view = v->get(); PREVENT_EMBEDDED_TRANSACTION(); - int res = view->vocbase()->dropView(view); + int res = view->vocbase()->dropView(view->name()); if (res != TRI_ERROR_NO_ERROR) { TRI_V8_THROW_EXCEPTION_MESSAGE(res, "cannot drop view"); @@ -249,7 +255,7 @@ static void JS_ViewVocbase( } v8::Handle val = args[0]; - arangodb::LogicalView* view = GetViewFromArgument(vocbase, val); + std::shared_ptr view = GetViewFromArgument(vocbase, val); if (view == nullptr) { TRI_V8_RETURN_NULL(); @@ -277,9 +283,9 @@ static void JS_ViewsVocbase( TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_DATABASE_NOT_FOUND); } - std::vector views = vocbase->views(); + std::vector> views = vocbase->views(); - std::sort(views.begin(), views.end(), [](LogicalView* lhs, LogicalView* rhs) -> bool { + std::sort(views.begin(), views.end(), [](std::shared_ptr const& lhs, std::shared_ptr const& rhs) -> bool { return StringUtils::tolower(lhs->name()) < StringUtils::tolower(rhs->name()); }); @@ -315,13 +321,15 @@ static void JS_NameViewVocbase(v8::FunctionCallbackInfo const& args) TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); - arangodb::LogicalView* view = - TRI_UnwrapClass(args.Holder(), WRP_VOCBASE_VIEW_TYPE); + std::shared_ptr* v = + TRI_UnwrapClass>(args.Holder(), WRP_VOCBASE_VIEW_TYPE); - if (view == nullptr) { + if (v == nullptr || v->get() == nullptr) { TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract view"); } + LogicalView* view = v->get(); + std::string const name(view->name()); if (name.empty()) { @@ -339,13 +347,15 @@ static void JS_PropertiesViewVocbase( TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); - arangodb::LogicalView* view = - TRI_UnwrapClass(args.Holder(), WRP_VOCBASE_VIEW_TYPE); + std::shared_ptr* v = + TRI_UnwrapClass>(args.Holder(), WRP_VOCBASE_VIEW_TYPE); - if (view == nullptr) { + if (v == nullptr || v->get() == nullptr) { TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract view"); } + LogicalView* view = v->get(); + bool const isModification = (args.Length() != 0); // check if we want to change some parameters @@ -396,13 +406,15 @@ static void JS_TypeViewVocbase(v8::FunctionCallbackInfo const& args) TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); - arangodb::LogicalView* view = - TRI_UnwrapClass(args.Holder(), WRP_VOCBASE_VIEW_TYPE); + std::shared_ptr* v = + TRI_UnwrapClass>(args.Holder(), WRP_VOCBASE_VIEW_TYPE); - if (view == nullptr) { + if (v == nullptr || v->get() == nullptr) { TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract view"); } + LogicalView* view = v->get(); + std::string const type = view->type(); TRI_V8_RETURN(TRI_V8_STD_STRING(type)); TRI_V8_TRY_CATCH_END diff --git a/arangod/VocBase/LogicalView.cpp b/arangod/VocBase/LogicalView.cpp index a0b0a58bbe..ef5c08c900 100644 --- a/arangod/VocBase/LogicalView.cpp +++ b/arangod/VocBase/LogicalView.cpp @@ -120,7 +120,6 @@ LogicalView::LogicalView(TRI_vocbase_t* vocbase, _vocbase(vocbase), _physical( EngineSelectorFeature::ENGINE->createPhysicalView(this, info)) { - LOG_TOPIC(ERR, Logger::FIXME) << "CTOR LOGICAL " << this; TRI_ASSERT(_physical != nullptr); if (!IsAllowedName(info)) { THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_ILLEGAL_NAME); @@ -130,9 +129,7 @@ LogicalView::LogicalView(TRI_vocbase_t* vocbase, TRI_UpdateTickServer(static_cast(_id)); } -LogicalView::~LogicalView() { - LOG_TOPIC(ERR, Logger::FIXME) << "DTOR LOGICAL " << this; - } +LogicalView::~LogicalView() {} bool LogicalView::IsAllowedName(VPackSlice parameters) { std::string name = ReadStringValue(parameters, "name", ""); diff --git a/arangod/VocBase/vocbase.cpp b/arangod/VocBase/vocbase.cpp index 3ad537da4b..b06a964b04 100644 --- a/arangod/VocBase/vocbase.cpp +++ b/arangod/VocBase/vocbase.cpp @@ -222,7 +222,7 @@ bool TRI_vocbase_t::unregisterCollection(arangodb::LogicalCollection* collection /// @brief adds a new view /// caller must hold _viewLock in write mode or set doLock void TRI_vocbase_t::registerView( - bool doLock, arangodb::LogicalView* view) { + bool doLock, std::shared_ptr view) { std::string const name = view->name(); TRI_voc_cid_t const id = view->id(); { @@ -259,25 +259,13 @@ void TRI_vocbase_t::registerView( } TRI_ASSERT(_viewsByName.size() == _viewsById.size()); - - try { - _views.emplace_back(view); - } - catch (...) { - _viewsByName.erase(name); - _viewsById.erase(id); - TRI_ASSERT(_viewsByName.size() == _viewsById.size()); - throw; - } - - TRI_ASSERT(_viewsByName.size() == _viewsById.size()); } } /// @brief removes a views name from the global list of views /// This function is called when a view is dropped. /// NOTE: You need a writelock on _viewsLock -bool TRI_vocbase_t::unregisterView(arangodb::LogicalView* view) { +bool TRI_vocbase_t::unregisterView(std::shared_ptr view) { TRI_ASSERT(view != nullptr); std::string const name(view->name()); @@ -926,9 +914,9 @@ LogicalCollection* TRI_vocbase_t::lookupCollection(TRI_voc_cid_t id) { } /// @brief looks up a view by name -LogicalView* TRI_vocbase_t::lookupView(std::string const& name) { +std::shared_ptr TRI_vocbase_t::lookupView(std::string const& name) { if (name.empty()) { - return nullptr; + return std::shared_ptr(); } // if view name is passed as a stringified id, we'll use the lookupbyid @@ -944,19 +932,19 @@ LogicalView* TRI_vocbase_t::lookupView(std::string const& name) { auto it = _viewsByName.find(name); if (it == _viewsByName.end()) { - return nullptr; + return std::shared_ptr(); } return (*it).second; } /// @brief looks up a view by identifier -LogicalView* TRI_vocbase_t::lookupView(TRI_voc_cid_t id) { +std::shared_ptr TRI_vocbase_t::lookupView(TRI_voc_cid_t id) { READ_LOCKER(readLocker, _viewsLock); auto it = _viewsById.find(id); if (it == _viewsById.end()) { - return nullptr; + return std::shared_ptr(); } return (*it).second; } @@ -1301,22 +1289,19 @@ void TRI_vocbase_t::releaseCollection(arangodb::LogicalCollection* collection) { } /// @brief creates a new view, worker function -arangodb::LogicalView* TRI_vocbase_t::createViewWorker( +std::shared_ptr TRI_vocbase_t::createViewWorker( VPackSlice parameters, TRI_voc_cid_t& id) { std::string name = arangodb::basics::VelocyPackHelper::getStringValue(parameters, "name" , ""); TRI_ASSERT(!name.empty()); // Try to create a new view. This is not registered yet - std::unique_ptr view = - std::make_unique(this, parameters); + std::shared_ptr view = + std::make_shared(this, parameters); TRI_ASSERT(view != nullptr); WRITE_LOCKER(writeLocker, _viewsLock); - // reserve room for the new view - _views.reserve(_views.size() + 1); - auto it = _viewsByName.find(name); if (it != _viewsByName.end()) { @@ -1324,7 +1309,7 @@ arangodb::LogicalView* TRI_vocbase_t::createViewWorker( THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DUPLICATE_NAME); } - registerView(basics::ConditionalLocking::DoNotLock, view.get()); + registerView(basics::ConditionalLocking::DoNotLock, view); try { // cid might have been assigned @@ -1334,9 +1319,9 @@ arangodb::LogicalView* TRI_vocbase_t::createViewWorker( view->persistPhysicalView(); events::CreateView(name, TRI_ERROR_NO_ERROR); - return view.release(); + return view; } catch (...) { - unregisterView(view.get()); + unregisterView(view); throw; } } @@ -1346,7 +1331,7 @@ arangodb::LogicalView* TRI_vocbase_t::createViewWorker( /// this means that the system will assign a new id automatically /// using a cid of > 0 is supported to import dumps from other servers etc. /// but the functionality is not advertised -arangodb::LogicalView* TRI_vocbase_t::createView( +std::shared_ptr TRI_vocbase_t::createView( VPackSlice parameters, TRI_voc_cid_t id) { // check that the name does not contain any strange characters @@ -1357,7 +1342,7 @@ arangodb::LogicalView* TRI_vocbase_t::createView( READ_LOCKER(readLocker, _inventoryLock); // note: id may be modified by this function call - arangodb::LogicalView* view = createViewWorker(parameters, id); + std::shared_ptr view = createViewWorker(parameters, id); if (view == nullptr) { // something went wrong... must not continue @@ -1367,19 +1352,27 @@ arangodb::LogicalView* TRI_vocbase_t::createView( StorageEngine* engine = EngineSelectorFeature::ENGINE; TRI_ASSERT(engine != nullptr); // TODO Review - arangodb::Result res2 = engine->persistView(this, view); + arangodb::Result res2 = engine->persistView(this, view.get()); // API compatibility, we always return the view, even if creation failed. return view; } +int TRI_vocbase_t::dropView(std::string const& name) { + std::shared_ptr view = lookupView(name); + + if (view == nullptr) { + return TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND; + } + + return dropView(view); +} + /// @brief drops a view -int TRI_vocbase_t::dropView(arangodb::LogicalView* view) { +int TRI_vocbase_t::dropView(std::shared_ptr view) { TRI_ASSERT(view != nullptr); READ_LOCKER(readLocker, _inventoryLock); - - std::string const viewName(view->name()); // do not acquire these locks instantly CONDITIONAL_WRITE_LOCKER(writeLocker, _viewsLock, basics::ConditionalLocking::DoNotLock); @@ -1421,12 +1414,12 @@ int TRI_vocbase_t::dropView(arangodb::LogicalView* view) { unregisterView(view); StorageEngine* engine = EngineSelectorFeature::ENGINE; - engine->dropView(this, view); + engine->dropView(this, view.get()); locker.unlock(); writeLocker.unlock(); - events::DropView(viewName, TRI_ERROR_NO_ERROR); + events::DropView(view->name(), TRI_ERROR_NO_ERROR); return TRI_ERROR_NO_ERROR; } @@ -1467,11 +1460,6 @@ TRI_vocbase_t::~TRI_vocbase_t() { for (auto& it : _collections) { delete it; } - - // do a final cleanup of views - for (auto& it : _views) { - delete it; - } } std::string TRI_vocbase_t::path() const { @@ -1556,8 +1544,8 @@ TRI_vocbase_t::getReplicationClients() { return result; } -std::vector TRI_vocbase_t::views() { - std::vector views; +std::vector> TRI_vocbase_t::views() { + std::vector> views; { READ_LOCKER(readLocker, _viewsLock); diff --git a/arangod/VocBase/vocbase.h b/arangod/VocBase/vocbase.h index 0ca7933a3b..01010a92cd 100644 --- a/arangod/VocBase/vocbase.h +++ b/arangod/VocBase/vocbase.h @@ -164,9 +164,8 @@ struct TRI_vocbase_t { std::unordered_map _collectionsById; // collections by id arangodb::basics::ReadWriteLock _viewsLock; // views management lock - std::vector _views; // pointers to ALL views - std::unordered_map _viewsByName; // views by name - std::unordered_map _viewsById; // views by id + std::unordered_map> _viewsByName; // views by name + std::unordered_map> _viewsById; // views by id std::unique_ptr _queries; @@ -240,7 +239,7 @@ struct TRI_vocbase_t { void shutdown(); /// @brief returns all known views - std::vector views(); + std::vector> views(); /// @brief returns all known collections std::vector collections(bool includeDeleted); @@ -259,9 +258,9 @@ struct TRI_vocbase_t { arangodb::LogicalCollection* lookupCollection(TRI_voc_cid_t id); /// @brief looks up a view by name - arangodb::LogicalView* lookupView(std::string const& name); + std::shared_ptr lookupView(std::string const& name); /// @brief looks up a view by identifier - arangodb::LogicalView* lookupView(TRI_voc_cid_t id); + std::shared_ptr lookupView(TRI_voc_cid_t id); /// @brief returns all known collections with their parameters /// and optionally indexes @@ -299,11 +298,12 @@ struct TRI_vocbase_t { /// this means that the system will assign a new id automatically /// using a cid of > 0 is supported to import dumps from other servers etc. /// but the functionality is not advertised - arangodb::LogicalView* createView( + std::shared_ptr createView( arangodb::velocypack::Slice parameters, TRI_voc_cid_t id); /// @brief drops a view - int dropView(arangodb::LogicalView* view); + int dropView(std::string const& name); + int dropView(std::shared_ptr view); /// @brief locks a collection for usage, loading or manifesting it /// Note that this will READ lock the collection you have to release the @@ -350,17 +350,17 @@ struct TRI_vocbase_t { DropState& state); /// @brief creates a new view, worker function - arangodb::LogicalView* createViewWorker( + std::shared_ptr createViewWorker( arangodb::velocypack::Slice parameters, TRI_voc_cid_t& id); /// @brief adds a new view /// caller must hold _viewsLock in write mode or set doLock - void registerView(bool doLock, arangodb::LogicalView* view); + void registerView(bool doLock, std::shared_ptr view); /// @brief removes a view from the global list of views /// This function is called when a view is dropped. - bool unregisterView(arangodb::LogicalView* view); + bool unregisterView(std::shared_ptr view); }; // scope guard for a database