mirror of https://gitee.com/bigwinds/arangodb
Rename getCollectionId -> getCollectionIdLocal.
This commit is contained in:
parent
687bc3c19b
commit
393ac7e753
|
@ -976,7 +976,7 @@ static void RequestEdges(arangodb::basics::Json const& vertexJson,
|
|||
vertexId);
|
||||
}
|
||||
|
||||
TRI_voc_cid_t startCid = resolver->getCollectionId(parts[0]);
|
||||
TRI_voc_cid_t startCid = resolver->getCollectionIdLocal(parts[0]);
|
||||
if (startCid == 0) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
|
||||
parts[0].c_str());
|
||||
|
@ -1059,7 +1059,7 @@ static void RequestEdges(VPackSlice const& vertexSlice,
|
|||
vertexId);
|
||||
}
|
||||
|
||||
TRI_voc_cid_t startCid = resolver->getCollectionId(parts[0]);
|
||||
TRI_voc_cid_t startCid = resolver->getCollectionIdLocal(parts[0]);
|
||||
if (startCid == 0) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
|
||||
parts[0].c_str());
|
||||
|
@ -4519,7 +4519,7 @@ AqlValue Functions::Neighbors(arangodb::aql::Query* query,
|
|||
VertexId v(coli->_cid, const_cast<char*>(str + split + 1));
|
||||
opts.start = v;
|
||||
} else {
|
||||
VertexId v(resolver->getCollectionId(vColName), vertexId.c_str());
|
||||
VertexId v(resolver->getCollectionIdLocal(vColName), vertexId.c_str());
|
||||
opts.start = v;
|
||||
}
|
||||
} else if (vertexInfo.isObject()) {
|
||||
|
@ -4597,7 +4597,7 @@ AqlValue Functions::Neighbors(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t eCid = resolver->getCollectionId(eColName);
|
||||
TRI_voc_cid_t eCid = resolver->getCollectionIdLocal(eColName);
|
||||
|
||||
{
|
||||
// ensure the collection is loaded
|
||||
|
@ -4736,7 +4736,7 @@ AqlValue$ Functions::NeighborsVPack(arangodb::aql::Query* query,
|
|||
VertexId v(coli->_cid, const_cast<char*>(str + split + 1));
|
||||
opts.start = v;
|
||||
} else {
|
||||
VertexId v(resolver->getCollectionId(vColName), vertexId.c_str());
|
||||
VertexId v(resolver->getCollectionIdLocal(vColName), vertexId.c_str());
|
||||
opts.start = v;
|
||||
}
|
||||
|
||||
|
@ -4783,7 +4783,7 @@ AqlValue$ Functions::NeighborsVPack(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t eCid = resolver->getCollectionId(eColName);
|
||||
TRI_voc_cid_t eCid = resolver->getCollectionIdLocal(eColName);
|
||||
|
||||
{
|
||||
// ensure the collection is loaded
|
||||
|
@ -4912,7 +4912,7 @@ AqlValue Functions::Near(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
auto collection = trx->trxCollection(cid);
|
||||
|
||||
// ensure the collection is loaded
|
||||
|
@ -5084,7 +5084,7 @@ AqlValue$ Functions::NearVPack(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
VocShaper* shaper = nullptr;
|
||||
arangodb::Index* index = getGeoIndex(trx, cid, colName, shaper);
|
||||
|
||||
|
@ -5155,7 +5155,7 @@ AqlValue Functions::Within(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
auto collection = trx->trxCollection(cid);
|
||||
|
||||
// ensure the collection is loaded
|
||||
|
@ -5314,7 +5314,7 @@ AqlValue$ Functions::WithinVPack(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
VocShaper* shaper = nullptr;
|
||||
arangodb::Index* index = getGeoIndex(trx, cid, colName, shaper);
|
||||
|
||||
|
@ -5709,7 +5709,7 @@ static void RegisterCollectionInTransaction(
|
|||
arangodb::AqlTransaction* trx, std::string const& collectionName,
|
||||
TRI_voc_cid_t& cid, TRI_transaction_collection_t*& collection) {
|
||||
TRI_ASSERT(collection == nullptr);
|
||||
cid = trx->resolver()->getCollectionId(collectionName);
|
||||
cid = trx->resolver()->getCollectionIdLocal(collectionName);
|
||||
if (cid == 0) {
|
||||
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
|
||||
collectionName.c_str());
|
||||
|
@ -7666,7 +7666,7 @@ AqlValue Functions::CollectionCount(arangodb::aql::Query* query,
|
|||
basics::JsonHelper::getStringValue(element.json(), "");
|
||||
|
||||
auto resolver = trx->resolver();
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
if (cid == 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
}
|
||||
|
@ -7721,7 +7721,7 @@ AqlValue$ Functions::CollectionCountVPack(
|
|||
basics::VelocyPackHelper::getStringValue(element, "");
|
||||
|
||||
auto resolver = trx->resolver();
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
if (cid == 0) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
}
|
||||
|
@ -8708,7 +8708,7 @@ AqlValue Functions::Fulltext(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
auto collection = trx->trxCollection(cid);
|
||||
|
||||
// ensure the collection is loaded
|
||||
|
@ -8862,7 +8862,7 @@ AqlValue$ Functions::FulltextVPack(arangodb::aql::Query* query,
|
|||
}
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver->getCollectionId(colName);
|
||||
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
|
||||
auto collection = trx->trxCollection(cid);
|
||||
|
||||
// ensure the collection is loaded
|
||||
|
|
|
@ -92,7 +92,7 @@ TraversalBlock::TraversalBlock(ExecutionEngine* engine, TraversalNode const* ep)
|
|||
} else {
|
||||
std::vector<TRI_document_collection_t*> edgeCollections;
|
||||
for (auto const& coll : ep->edgeColls()) {
|
||||
TRI_voc_cid_t cid = _resolver->getCollectionId(coll);
|
||||
TRI_voc_cid_t cid = _resolver->getCollectionIdLocal(coll);
|
||||
edgeCollections.push_back(_trx->documentCollection(cid));
|
||||
|
||||
auto trxCollection = _trx->trxCollection(cid);
|
||||
|
|
|
@ -2239,7 +2239,7 @@ void RestReplicationHandler::handleCommandRestoreData() {
|
|||
|
||||
CollectionNameResolver resolver(_vocbase);
|
||||
|
||||
TRI_voc_cid_t cid = resolver.getCollectionId(value);
|
||||
TRI_voc_cid_t cid = resolver.getCollectionIdLocal(value);
|
||||
|
||||
if (cid == 0) {
|
||||
std::string msg = "invalid collection parameter: '";
|
||||
|
|
|
@ -54,7 +54,7 @@ class CollectionNameResolver {
|
|||
/// @brief look up a collection id for a collection name (local case)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_voc_cid_t getCollectionId(std::string const& name) const {
|
||||
TRI_voc_cid_t getCollectionIdLocal(std::string const& name) const {
|
||||
if (name[0] >= '0' && name[0] <= '9') {
|
||||
// name is a numeric id
|
||||
return static_cast<TRI_voc_cid_t>(
|
||||
|
@ -115,7 +115,7 @@ class CollectionNameResolver {
|
|||
|
||||
TRI_voc_cid_t getCollectionIdCluster(std::string const& name) const {
|
||||
if (!ServerState::instance()->isRunningInCluster()) {
|
||||
return getCollectionId(name);
|
||||
return getCollectionIdLocal(name);
|
||||
}
|
||||
if (name[0] >= '0' && name[0] <= '9') {
|
||||
// name is a numeric id
|
||||
|
|
|
@ -73,7 +73,7 @@ class SingleCollectionTransaction : public Transaction {
|
|||
if (ServerState::instance()->isCoordinator()) {
|
||||
_cid = this->resolver()->getCollectionIdCluster(name);
|
||||
} else {
|
||||
_cid = this->resolver()->getCollectionId(name);
|
||||
_cid = this->resolver()->getCollectionIdLocal(name);
|
||||
}
|
||||
|
||||
this->addCollection(_cid, _accessType);
|
||||
|
|
|
@ -578,7 +578,7 @@ OperationResult Transaction::documentCoordinator(std::string const& collectionNa
|
|||
OperationResult Transaction::documentLocal(std::string const& collectionName,
|
||||
VPackSlice const& value,
|
||||
OperationOptions& options) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -712,7 +712,7 @@ OperationResult Transaction::insertLocal(std::string const& collectionName,
|
|||
VPackSlice const& value,
|
||||
OperationOptions& options) {
|
||||
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -884,7 +884,7 @@ OperationResult Transaction::updateLocal(std::string const& collectionName,
|
|||
VPackSlice const& oldValue,
|
||||
VPackSlice const& newValue,
|
||||
OperationOptions& options) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -1071,7 +1071,7 @@ OperationResult Transaction::replaceLocal(std::string const& collectionName,
|
|||
VPackSlice const& oldValue,
|
||||
VPackSlice const& newValue,
|
||||
OperationOptions& options) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -1246,7 +1246,7 @@ OperationResult Transaction::removeCoordinator(std::string const& collectionName
|
|||
OperationResult Transaction::removeLocal(std::string const& collectionName,
|
||||
VPackSlice const& value,
|
||||
OperationOptions& options) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -1369,7 +1369,7 @@ OperationResult Transaction::countCoordinator(std::string const& collectionName)
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OperationResult Transaction::countLocal(std::string const& collectionName) {
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collectionName);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collectionName);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationResult(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
@ -1407,7 +1407,7 @@ OperationCursor Transaction::indexScan(
|
|||
THROW_ARANGO_EXCEPTION(TRI_ERROR_CLUSTER_ONLY_ON_DBSERVER);
|
||||
}
|
||||
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collection);
|
||||
TRI_voc_cid_t cid = resolver()->getCollectionIdLocal(collection);
|
||||
|
||||
if (cid == 0) {
|
||||
return OperationCursor(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
|
|
|
@ -954,7 +954,7 @@ class Transaction {
|
|||
name.c_str(), type);
|
||||
}
|
||||
|
||||
return addCollection(this->resolver()->getCollectionId(name), name.c_str(),
|
||||
return addCollection(this->resolver()->getCollectionIdLocal(name), name.c_str(),
|
||||
type);
|
||||
}
|
||||
|
||||
|
|
|
@ -984,7 +984,7 @@ EdgeIndex* DepthFirstTraverser::EdgeGetter::getEdgeIndex(
|
|||
TRI_voc_cid_t& cid) {
|
||||
auto it = _indexCache.find(eColName);
|
||||
if (it == _indexCache.end()) {
|
||||
cid = _resolver->getCollectionId(eColName);
|
||||
cid = _resolver->getCollectionIdLocal(eColName);
|
||||
TRI_transaction_collection_t* trxCollection = _trx->trxCollection(cid);
|
||||
TRI_ASSERT(trxCollection != nullptr);
|
||||
TRI_document_collection_t* ecl = trxCollection->_collection->_collection;
|
||||
|
|
|
@ -2194,10 +2194,10 @@ static void JS_QueryShortestPath(
|
|||
CollectionNameResolver const* resolver = resolverGuard.getResolver();
|
||||
|
||||
for (auto const& it : edgeCollectionNames) {
|
||||
readCollections.emplace_back(resolver->getCollectionId(it));
|
||||
readCollections.emplace_back(resolver->getCollectionIdLocal(it));
|
||||
}
|
||||
for (auto const& it : vertexCollectionNames) {
|
||||
readCollections.emplace_back(resolver->getCollectionId(it));
|
||||
readCollections.emplace_back(resolver->getCollectionIdLocal(it));
|
||||
}
|
||||
|
||||
// Start the transaction and order ditches
|
||||
|
@ -2228,7 +2228,7 @@ static void JS_QueryShortestPath(
|
|||
|
||||
if (opts.useWeight) {
|
||||
for (auto const& it : edgeCollectionNames) {
|
||||
auto cid = resolver->getCollectionId(it);
|
||||
auto cid = resolver->getCollectionIdLocal(it);
|
||||
auto colObj = ditches.find(cid)->second.col->_collection->_collection;
|
||||
edgeCollectionInfos.emplace_back(new EdgeCollectionInfo(
|
||||
trx.get(), cid, colObj,
|
||||
|
@ -2237,7 +2237,7 @@ static void JS_QueryShortestPath(
|
|||
}
|
||||
} else {
|
||||
for (auto const& it : edgeCollectionNames) {
|
||||
auto cid = resolver->getCollectionId(it);
|
||||
auto cid = resolver->getCollectionIdLocal(it);
|
||||
auto colObj = ditches.find(cid)->second.col->_collection->_collection;
|
||||
edgeCollectionInfos.emplace_back(new EdgeCollectionInfo(
|
||||
trx.get(), cid, colObj, HopWeightCalculator()));
|
||||
|
@ -2245,7 +2245,7 @@ static void JS_QueryShortestPath(
|
|||
}
|
||||
|
||||
for (auto const& it : vertexCollectionNames) {
|
||||
auto cid = resolver->getCollectionId(it);
|
||||
auto cid = resolver->getCollectionIdLocal(it);
|
||||
auto colObj = ditches.find(cid)->second.col;
|
||||
vertexCollectionInfos.emplace_back(new VertexCollectionInfo(cid, colObj));
|
||||
}
|
||||
|
@ -2519,10 +2519,10 @@ static void JS_QueryNeighbors(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
CollectionNameResolver const* resolver = resolverGuard.getResolver();
|
||||
|
||||
for (auto const& it : edgeCollectionNames) {
|
||||
readCollections.emplace_back(resolver->getCollectionId(it));
|
||||
readCollections.emplace_back(resolver->getCollectionIdLocal(it));
|
||||
}
|
||||
for (auto const& it : vertexCollectionNames) {
|
||||
readCollections.emplace_back(resolver->getCollectionId(it));
|
||||
readCollections.emplace_back(resolver->getCollectionIdLocal(it));
|
||||
}
|
||||
|
||||
std::unordered_map<TRI_voc_cid_t, CollectionDitchInfo> ditches;
|
||||
|
@ -2550,7 +2550,7 @@ static void JS_QueryNeighbors(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
}};
|
||||
|
||||
for (auto const& it : edgeCollectionNames) {
|
||||
auto cid = resolver->getCollectionId(it);
|
||||
auto cid = resolver->getCollectionIdLocal(it);
|
||||
auto colObj = ditches.find(cid)->second.col->_collection->_collection;
|
||||
edgeCollectionInfos.emplace_back(
|
||||
new EdgeCollectionInfo(trx.get(), cid, colObj, HopWeightCalculator()));
|
||||
|
@ -2560,7 +2560,7 @@ static void JS_QueryNeighbors(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
}
|
||||
|
||||
for (auto it : vertexCollectionNames) {
|
||||
auto cid = resolver->getCollectionId(it);
|
||||
auto cid = resolver->getCollectionIdLocal(it);
|
||||
auto colObj = ditches.find(cid)->second.col;
|
||||
vertexCollectionInfos.emplace_back(new VertexCollectionInfo(cid, colObj));
|
||||
// Explicitly allow all collections.
|
||||
|
@ -3601,7 +3601,7 @@ int TRI_ParseVertex(v8::FunctionCallbackInfo<v8::Value> const& args,
|
|||
if (ServerState::instance()->isDBServer()) {
|
||||
cid = resolver->getCollectionIdCluster(collectionName);
|
||||
} else {
|
||||
cid = resolver->getCollectionId(collectionName);
|
||||
cid = resolver->getCollectionIdLocal(collectionName);
|
||||
}
|
||||
|
||||
if (cid == 0) {
|
||||
|
|
|
@ -109,15 +109,15 @@ void ExampleMatcher::fillExampleDefinition(
|
|||
if (TRI_VOC_ATTRIBUTE_ID == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::id,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_FROM == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::from,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_TO == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::to,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else {
|
||||
// no attribute path found. this means the result will be empty
|
||||
THROW_ARANGO_EXCEPTION(TRI_RESULT_ELEMENT_NOT_FOUND);
|
||||
|
@ -197,15 +197,15 @@ void ExampleMatcher::fillExampleDefinition(
|
|||
if (TRI_VOC_ATTRIBUTE_ID == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::id,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_FROM == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::from,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_TO == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::to,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else {
|
||||
// no attribute path found. this means the result will be empty
|
||||
THROW_ARANGO_EXCEPTION(TRI_RESULT_ELEMENT_NOT_FOUND);
|
||||
|
@ -283,15 +283,15 @@ void ExampleMatcher::fillExampleDefinition(
|
|||
if (TRI_VOC_ATTRIBUTE_ID == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::id,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_FROM == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::from,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else if (TRI_VOC_ATTRIBUTE_TO == key) {
|
||||
def._internal.insert(std::make_pair(
|
||||
internalAttr::to,
|
||||
DocumentId(resolver->getCollectionId(colName), keyVal)));
|
||||
DocumentId(resolver->getCollectionIdLocal(colName), keyVal)));
|
||||
} else {
|
||||
// no attribute path found. this means the result will be empty
|
||||
THROW_ARANGO_EXCEPTION(TRI_RESULT_ELEMENT_NOT_FOUND);
|
||||
|
|
Loading…
Reference in New Issue