1
0
Fork 0

removed unused functions

This commit is contained in:
Jan Steemann 2016-03-02 10:53:59 +01:00
parent 285de1998b
commit e6e864cd7a
4 changed files with 1 additions and 216 deletions

View File

@ -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<std::string, std::string> headers =
arangodb::getForwardableRequestHeaders(_request);
std::map<std::string, std::string> 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<std::map<std::string, std::string>> headers(
new std::map<std::string, std::string>(
arangodb::getForwardableRequestHeaders(_request)));
std::map<std::string, std::string> 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<std::map<std::string, std::string>> headers(
new std::map<std::string, std::string>(
arangodb::getForwardableRequestHeaders(_request)));
arangodb::rest::HttpResponse::HttpResponseCode responseCode;
std::map<std::string, std::string> 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<std::map<std::string, std::string>> headers(
new std::map<std::string, std::string>(
arangodb::getForwardableRequestHeaders(_request)));
std::map<std::string, std::string> 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;
}

View File

@ -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);
};
}

View File

@ -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) {

View File

@ -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 {