mirror of https://gitee.com/bigwinds/arangodb
issue 465.4: remove unused functions (#6398)
This commit is contained in:
parent
c4d878ece8
commit
d365c7cfd5
|
@ -63,25 +63,13 @@ transaction::Methods* AqlTransaction::clone(
|
|||
/// @brief add a collection to the transaction
|
||||
Result AqlTransaction::processCollection(aql::Collection* collection) {
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
return processCollectionCoordinator(collection);
|
||||
}
|
||||
return processCollectionNormal(collection);
|
||||
}
|
||||
|
||||
/// @brief add a coordinator collection to the transaction
|
||||
|
||||
Result AqlTransaction::processCollectionCoordinator(
|
||||
aql::Collection* collection) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collection->name());
|
||||
auto cid = resolver()->getCollectionId(collection->name());
|
||||
|
||||
return addCollection(cid, collection->name(), collection->accessType());
|
||||
}
|
||||
|
||||
/// @brief add a regular collection to the transaction
|
||||
|
||||
Result AqlTransaction::processCollectionNormal(aql::Collection* collection) {
|
||||
TRI_voc_cid_t cid = 0;
|
||||
auto col = resolver()->getCollectionStruct(collection->name());
|
||||
auto col = resolver()->getCollection(collection->name());
|
||||
|
||||
if (col != nullptr) {
|
||||
cid = col->id();
|
||||
|
|
|
@ -66,12 +66,6 @@ class AqlTransaction : public transaction::Methods {
|
|||
/// @brief add a collection to the transaction
|
||||
Result processCollection(aql::Collection*);
|
||||
|
||||
/// @brief add a coordinator collection to the transaction
|
||||
Result processCollectionCoordinator(aql::Collection*);
|
||||
|
||||
/// @brief add a regular collection to the transaction
|
||||
Result processCollectionNormal(aql::Collection* collection);
|
||||
|
||||
/// @brief documentCollection
|
||||
LogicalCollection* documentCollection(TRI_voc_cid_t cid);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "RestServer/DatabasePathFeature.h"
|
||||
#include "StorageEngine/TransactionState.h"
|
||||
#include "Transaction/Methods.h"
|
||||
#include "VocBase/LogicalCollection.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
|
||||
namespace {
|
||||
|
@ -618,14 +619,15 @@ PrimaryKeyIndexReader* IResearchViewDBServer::snapshot(
|
|||
|
||||
try {
|
||||
for (auto& shardId : shards) {
|
||||
auto const cid = resolver->getCollectionIdLocal(shardId);
|
||||
auto shard = resolver->getCollection(shardId);
|
||||
|
||||
if (0 == cid) {
|
||||
if (!shard) {
|
||||
LOG_TOPIC(ERR, arangodb::iresearch::TOPIC)
|
||||
<< "failed to find shard by id '" << shardId << "', skipping it";
|
||||
continue;
|
||||
}
|
||||
|
||||
auto cid = shard->id();
|
||||
auto const shardView = _collections.find(cid);
|
||||
|
||||
if (shardView == _collections.end()) {
|
||||
|
|
|
@ -286,7 +286,7 @@ bool RestEdgesHandler::readEdges() {
|
|||
if (ServerState::instance()->isDBServer()) {
|
||||
// If we are a DBserver, we want to use the cluster-wide collection
|
||||
// name for error reporting:
|
||||
collectionName = trx->resolver()->getCollectionName(trx->cid());
|
||||
collectionName = trx->resolver()->getCollectionNameCluster(trx->cid());
|
||||
}
|
||||
generateTransactionError(collectionName, res, "");
|
||||
return false;
|
||||
|
@ -437,7 +437,7 @@ bool RestEdgesHandler::readEdgesForMultipleVertices() {
|
|||
if (ServerState::instance()->isDBServer()) {
|
||||
// If we are a DBserver, we want to use the cluster-wide collection
|
||||
// name for error reporting:
|
||||
collectionName = trx->resolver()->getCollectionName(trx->cid());
|
||||
collectionName = trx->resolver()->getCollectionNameCluster(trx->cid());
|
||||
}
|
||||
generateTransactionError(collectionName, res, "");
|
||||
return false;
|
||||
|
|
|
@ -61,6 +61,8 @@ class CollectionNameResolver {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a collection struct for a collection id
|
||||
/// @return the local collection on dbserver / standalone
|
||||
/// the cluster collection on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalCollection> getCollection(
|
||||
TRI_voc_cid_t id
|
||||
|
@ -69,6 +71,8 @@ class CollectionNameResolver {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a collection struct for a
|
||||
/// collection name, stringified id (or uuid for dbserver / standalone)
|
||||
/// @return the local collection on dbserver / standalone
|
||||
/// the cluster collection on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalCollection> getCollection(
|
||||
std::string const& nameOrId
|
||||
|
@ -99,6 +103,8 @@ class CollectionNameResolver {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
TRI_voc_cid_t getCollectionId(std::string const& name) const;
|
||||
|
||||
private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a collection struct for a collection name
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -106,6 +112,8 @@ class CollectionNameResolver {
|
|||
std::string const& name
|
||||
) const;
|
||||
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a collection name for a collection id, this implements
|
||||
/// some magic in the cluster case: a DBserver in a cluster will automatically
|
||||
|
@ -128,6 +136,8 @@ class CollectionNameResolver {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a data-source struct for a data-source id
|
||||
/// @return the local data-source on dbserver / standalone
|
||||
/// the cluster data-source on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalDataSource> getDataSource(
|
||||
TRI_voc_cid_t id
|
||||
|
@ -136,6 +146,8 @@ class CollectionNameResolver {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a data-source struct for a
|
||||
/// data-source name, stringified id (or uuid for dbserver/standalone)
|
||||
/// @return the local data-source on dbserver / standalone
|
||||
/// the cluster data-source on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalDataSource> getDataSource(
|
||||
std::string const& nameOrId
|
||||
|
@ -143,12 +155,16 @@ class CollectionNameResolver {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a view struct for a view id
|
||||
/// @return the local view on dbserver / standalone
|
||||
/// the cluster view on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalView> getView(TRI_voc_cid_t id) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a view struct for a
|
||||
/// view name, stringified id (or uuid for dbserver / standalone)
|
||||
/// @return the local view on dbserver / standalone
|
||||
/// the cluster view on coordinator
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<LogicalView> getView(
|
||||
std::string const& nameOrId
|
||||
|
|
|
@ -172,7 +172,6 @@ static std::string ExtractIdString(v8::Isolate* isolate,
|
|||
|
||||
static int ParseDocumentOrDocumentHandle(
|
||||
v8::Isolate* isolate,
|
||||
TRI_vocbase_t* vocbase,
|
||||
CollectionNameResolver const* resolver,
|
||||
std::shared_ptr<arangodb::LogicalCollection>& collection,
|
||||
std::string& collectionName,
|
||||
|
@ -211,16 +210,8 @@ static int ParseDocumentOrDocumentHandle(
|
|||
if (collection == nullptr) {
|
||||
// no collection object was passed, now check the user-supplied collection
|
||||
// name
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
ClusterInfo* ci = ClusterInfo::instance();
|
||||
try {
|
||||
collection = ci->getCollection(vocbase->name(), collectionName);
|
||||
} catch (...) {
|
||||
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
|
||||
}
|
||||
} else {
|
||||
collection = resolver->getCollectionStruct(collectionName);
|
||||
}
|
||||
collection = resolver->getCollection(collectionName);
|
||||
|
||||
if (collection == nullptr) {
|
||||
// collection not found
|
||||
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
|
||||
|
@ -344,7 +335,6 @@ static void ExistsVocbaseVPack(
|
|||
|
||||
res = ParseDocumentOrDocumentHandle(
|
||||
isolate,
|
||||
vocbase,
|
||||
&(transactionContext->resolver()),
|
||||
collection,
|
||||
collectionName,
|
||||
|
@ -511,7 +501,6 @@ static void DocumentVocbase(
|
|||
VPackObjectBuilder guard(&builder);
|
||||
int res = ParseDocumentOrDocumentHandle(
|
||||
isolate,
|
||||
&vocbase,
|
||||
&(transactionContext->resolver()),
|
||||
collection,
|
||||
collectionName,
|
||||
|
@ -749,7 +738,6 @@ static void RemoveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
VPackObjectBuilder guard(&builder);
|
||||
int res = ParseDocumentOrDocumentHandle(
|
||||
isolate,
|
||||
&vocbase,
|
||||
&(transactionContext->resolver()),
|
||||
collection,
|
||||
collectionName,
|
||||
|
@ -1733,7 +1721,6 @@ static void ModifyVocbase(TRI_voc_document_operation_e operation,
|
|||
|
||||
res = ParseDocumentOrDocumentHandle(
|
||||
isolate,
|
||||
&vocbase,
|
||||
&(transactionContext->resolver()),
|
||||
collection,
|
||||
collectionName,
|
||||
|
|
Loading…
Reference in New Issue