From e6e864cd7aea2dd93321bf84a2e78cb901037505 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 2 Mar 2016 10:53:59 +0100 Subject: [PATCH] removed unused functions --- arangod/RestHandler/RestDocumentHandler.cpp | 174 -------------------- arangod/RestHandler/RestDocumentHandler.h | 41 ----- arangod/VocBase/document-collection.h | 1 - lib/Basics/WorkMonitor.cpp | 1 + 4 files changed, 1 insertion(+), 216 deletions(-) diff --git a/arangod/RestHandler/RestDocumentHandler.cpp b/arangod/RestHandler/RestDocumentHandler.cpp index 13f987e1d3..bb05581471 100644 --- a/arangod/RestHandler/RestDocumentHandler.cpp +++ b/arangod/RestHandler/RestDocumentHandler.cpp @@ -158,37 +158,6 @@ bool RestDocumentHandler::createDocument() { return true; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief creates a document, coordinator case in a cluster -//////////////////////////////////////////////////////////////////////////////// - -bool RestDocumentHandler::createDocumentCoordinator( - char const* collection, bool waitForSync, VPackSlice const& document) { - std::string const& dbname = _request->databaseName(); - std::string const collname(collection); - arangodb::rest::HttpResponse::HttpResponseCode responseCode; - std::map headers = - arangodb::getForwardableRequestHeaders(_request); - std::map resultHeaders; - std::string resultBody; - - int res = arangodb::createDocumentOnCoordinator( - dbname, collname, waitForSync, document, headers, responseCode, - resultHeaders, resultBody); - - if (res != TRI_ERROR_NO_ERROR) { - generateTransactionError(collection, res, ""); - return false; - } - - // Essentially return the response we got from the DBserver, be it - // OK or an error: - createResponse(responseCode); - arangodb::mergeResponseHeaders(_response, resultHeaders); - _response->body().appendText(resultBody.c_str(), resultBody.size()); - return responseCode >= arangodb::rest::HttpResponse::BAD; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief reads a single or all documents /// @@ -309,51 +278,6 @@ bool RestDocumentHandler::readSingleDocument(bool generateBody) { return true; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief reads a single a document, coordinator case in a cluster -//////////////////////////////////////////////////////////////////////////////// - -bool RestDocumentHandler::getDocumentCoordinator(std::string const& collname, - std::string const& key, - bool generateBody) { - std::string const& dbname = _request->databaseName(); - arangodb::rest::HttpResponse::HttpResponseCode responseCode; - std::unique_ptr> headers( - new std::map( - arangodb::getForwardableRequestHeaders(_request))); - std::map resultHeaders; - std::string resultBody; - - TRI_voc_rid_t rev = 0; - bool found; - char const* revstr = _request->value("rev", found); - if (found) { - rev = StringUtils::uint64(revstr); - } - - int error = arangodb::getDocumentOnCoordinator( - dbname, collname, key, rev, headers, generateBody, responseCode, - resultHeaders, resultBody); - - if (error != TRI_ERROR_NO_ERROR) { - generateTransactionError(collname, error, ""); - return false; - } - // Essentially return the response we got from the DBserver, be it - // OK or an error: - createResponse(responseCode); - arangodb::mergeResponseHeaders(_response, resultHeaders); - - if (!generateBody) { - // a head request... - _response->headResponse( - (size_t)StringUtils::uint64(resultHeaders["content-length"])); - } else { - _response->body().appendText(resultBody.c_str(), resultBody.size()); - } - return responseCode >= arangodb::rest::HttpResponse::BAD; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief was docuBlock REST_DOCUMENT_READ_ALL //////////////////////////////////////////////////////////////////////////////// @@ -393,32 +317,6 @@ bool RestDocumentHandler::readAllDocuments() { return true; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief reads a single a document, coordinator case in a cluster -//////////////////////////////////////////////////////////////////////////////// - -bool RestDocumentHandler::getAllDocumentsCoordinator( - std::string const& collname, std::string const& returnType) { - std::string const& dbname = _request->databaseName(); - - arangodb::rest::HttpResponse::HttpResponseCode responseCode; - std::string contentType; - std::string resultBody; - - int error = arangodb::getAllDocumentsOnCoordinator( - dbname, collname, returnType, responseCode, contentType, resultBody); - - if (error != TRI_ERROR_NO_ERROR) { - generateTransactionError(collname, error, ""); - return false; - } - // Return the response we got: - createResponse(responseCode); - _response->setContentType(contentType); - _response->body().appendText(resultBody.c_str(), resultBody.size()); - return responseCode >= arangodb::rest::HttpResponse::BAD; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief was docuBlock REST_DOCUMENT_READ_HEAD //////////////////////////////////////////////////////////////////////////////// @@ -573,48 +471,6 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) { return true; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief modifies a document, coordinator case in a cluster -//////////////////////////////////////////////////////////////////////////////// - -bool RestDocumentHandler::modifyDocumentCoordinator( - std::string const& collname, std::string const& key, - TRI_voc_rid_t const rev, TRI_doc_update_policy_e policy, bool waitForSync, - bool isPatch, VPackSlice const& document) { - std::string const& dbname = _request->databaseName(); - std::unique_ptr> headers( - new std::map( - arangodb::getForwardableRequestHeaders(_request))); - arangodb::rest::HttpResponse::HttpResponseCode responseCode; - std::map resultHeaders; - std::string resultBody; - - bool keepNull = true; - if (!strcmp(_request->value("keepNull"), "false")) { - keepNull = false; - } - bool mergeObjects = true; - if (TRI_EqualString(_request->value("mergeObjects"), "false")) { - mergeObjects = false; - } - - int error = arangodb::modifyDocumentOnCoordinator( - dbname, collname, key, rev, policy, waitForSync, isPatch, keepNull, - mergeObjects, document, headers, responseCode, resultHeaders, resultBody); - - if (error != TRI_ERROR_NO_ERROR) { - generateTransactionError(collname, error, ""); - return false; - } - - // Essentially return the response we got from the DBserver, be it - // OK or an error: - createResponse(responseCode); - arangodb::mergeResponseHeaders(_response, resultHeaders); - _response->body().appendText(resultBody.c_str(), resultBody.size()); - return responseCode >= arangodb::rest::HttpResponse::BAD; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief was docuBlock REST_DOCUMENT_DELETE //////////////////////////////////////////////////////////////////////////////// @@ -694,33 +550,3 @@ bool RestDocumentHandler::deleteDocument() { return true; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief deletes a document, coordinator case in a cluster -//////////////////////////////////////////////////////////////////////////////// - -bool RestDocumentHandler::deleteDocumentCoordinator( - std::string const& collname, std::string const& key, - TRI_voc_rid_t const rev, TRI_doc_update_policy_e policy, bool waitForSync) { - std::string const& dbname = _request->databaseName(); - arangodb::rest::HttpResponse::HttpResponseCode responseCode; - std::unique_ptr> headers( - new std::map( - arangodb::getForwardableRequestHeaders(_request))); - std::map resultHeaders; - std::string resultBody; - - int error = arangodb::deleteDocumentOnCoordinator( - dbname, collname, key, rev, policy, waitForSync, headers, responseCode, - resultHeaders, resultBody); - - if (error != TRI_ERROR_NO_ERROR) { - generateTransactionError(collname, error, ""); - return false; - } - // Essentially return the response we got from the DBserver, be it - // OK or an error: - createResponse(responseCode); - arangodb::mergeResponseHeaders(_response, resultHeaders); - _response->body().appendText(resultBody.c_str(), resultBody.size()); - return responseCode >= arangodb::rest::HttpResponse::BAD; -} diff --git a/arangod/RestHandler/RestDocumentHandler.h b/arangod/RestHandler/RestDocumentHandler.h index 2c7befa478..7ba5ccfebf 100644 --- a/arangod/RestHandler/RestDocumentHandler.h +++ b/arangod/RestHandler/RestDocumentHandler.h @@ -103,47 +103,6 @@ class RestDocumentHandler : public RestVocbaseBaseHandler { bool deleteDocument(); - ////////////////////////////////////////////////////////////////////////////// - /// @brief creates a document, coordinator case in a cluster - ////////////////////////////////////////////////////////////////////////////// - - bool createDocumentCoordinator(char const* collection, bool waitForSync, - VPackSlice const& document); - - ////////////////////////////////////////////////////////////////////////////// - /// @brief delete a document, coordinator case in a cluster - ////////////////////////////////////////////////////////////////////////////// - - bool deleteDocumentCoordinator(std::string const& collname, - std::string const& key, - TRI_voc_rid_t const rev, - TRI_doc_update_policy_e policy, - bool waitForSync); - - ////////////////////////////////////////////////////////////////////////////// - /// @brief read a single document, coordinator case in a cluster - ////////////////////////////////////////////////////////////////////////////// - - bool getDocumentCoordinator(std::string const& collname, - std::string const& key, bool generateBody); - - ////////////////////////////////////////////////////////////////////////////// - /// @brief read all documents, coordinator case in a cluster - ////////////////////////////////////////////////////////////////////////////// - - bool getAllDocumentsCoordinator(std::string const& collname, - std::string const& returnType); - - ////////////////////////////////////////////////////////////////////////////// - /// @brief read a single document, coordinator case in a cluster - ////////////////////////////////////////////////////////////////////////////// - - bool modifyDocumentCoordinator(std::string const& collname, - std::string const& key, - TRI_voc_rid_t const rev, - TRI_doc_update_policy_e policy, - bool waitForSync, bool isPatch, - VPackSlice const& document); }; } diff --git a/arangod/VocBase/document-collection.h b/arangod/VocBase/document-collection.h index 9899fb2aac..1bf81751dd 100644 --- a/arangod/VocBase/document-collection.h +++ b/arangod/VocBase/document-collection.h @@ -113,7 +113,6 @@ struct TRI_doc_mptr_t { // master pointer points into the WAL, and if not, it points into // a datafile inline void setFid(TRI_voc_fid_t fid, bool isWal) { - TRI_ASSERT((_fid & TRI_WAL_FILE_BITMASK) == 0); // set the WAL bit if required _fid = fid; if (isWal) { diff --git a/lib/Basics/WorkMonitor.cpp b/lib/Basics/WorkMonitor.cpp index d64082cf3a..39f1ceb27a 100644 --- a/lib/Basics/WorkMonitor.cpp +++ b/lib/Basics/WorkMonitor.cpp @@ -484,6 +484,7 @@ void WorkMonitor::activateWorkDescription(WorkDescription* desc) { WorkDescription* WorkMonitor::deactivateWorkDescription() { if (Thread::CURRENT_THREAD == nullptr) { WorkDescription* desc = CURRENT_WORK_DESCRIPTION; + TRI_ASSERT(desc != nullptr); CURRENT_WORK_DESCRIPTION = desc->_prev.load(); return desc; } else {