mirror of https://gitee.com/bigwinds/arangodb
Further internal cleanup of Traversal and ShortestPath. wrt Template Classes. Also moved maxDepth test into the pathEnumerator in preparation for BreadthFirstTraversals
This commit is contained in:
parent
419cfdab14
commit
dce3864285
|
@ -28,7 +28,7 @@
|
|||
#define BOOST_TEST_INCLUDED
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "Basics/Traverser.h"
|
||||
#include "Basics/ShortestPathFinder.h"
|
||||
#include "Basics/voc-errors.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -284,7 +284,7 @@ void ClusterTraverser::setStartVertex(std::string const& id) {
|
|||
_vertexGetter->reset();
|
||||
_enumerator.reset(
|
||||
new arangodb::basics::PathEnumerator<std::string, std::string, size_t>(
|
||||
_edgeGetter, _vertexGetter.get(), id));
|
||||
_edgeGetter, _vertexGetter.get(), id, _opts.maxDepth));
|
||||
_done = false;
|
||||
auto it = _vertices.find(id);
|
||||
if (it == _vertices.end()) {
|
||||
|
@ -385,9 +385,6 @@ arangodb::traverser::TraversalPath* ClusterTraverser::next() {
|
|||
size_t countEdges = path.edges.size();
|
||||
|
||||
auto p = std::make_unique<ClusterTraversalPath>(this, path);
|
||||
if (countEdges >= _opts.maxDepth) {
|
||||
_pruneNext = true;
|
||||
}
|
||||
if (countEdges < _opts.minDepth) {
|
||||
return next();
|
||||
}
|
||||
|
|
|
@ -70,42 +70,6 @@ VPackSlice ShortestPathOptions::getEnd() const {
|
|||
return endBuilder.slice();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get a document by it's ID. Also lazy locks the collection.
|
||||
/// If DOCUMENT_NOT_FOUND this function will return normally
|
||||
/// with a OperationResult.failed() == true.
|
||||
/// On all other cases this function throws.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int FetchDocumentById(arangodb::Transaction* trx,
|
||||
std::string const& id,
|
||||
VPackBuilder& builder,
|
||||
VPackBuilder& result) {
|
||||
size_t pos = id.find('/');
|
||||
if (pos == std::string::npos) {
|
||||
TRI_ASSERT(false);
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
if (id.find('/', pos + 1) != std::string::npos) {
|
||||
TRI_ASSERT(false);
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
std::string col = id.substr(0, pos);
|
||||
trx->addCollectionAtRuntime(col);
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
builder.add(StaticStrings::KeyString, VPackValue(id.substr(pos + 1)));
|
||||
builder.close();
|
||||
|
||||
int res = trx->documentFastPath(col, builder.slice(), result);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Insert a new vertex matcher object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -231,7 +231,7 @@ void SingleServerTraverser::setStartVertex(std::string const& v) {
|
|||
|
||||
_vertexGetter->reset();
|
||||
_enumerator.reset(new basics::PathEnumerator<std::string, std::string, VPackValueLength>(
|
||||
_edgeGetter, _vertexGetter.get(), v));
|
||||
_edgeGetter, _vertexGetter.get(), v, _opts.maxDepth));
|
||||
_done = false;
|
||||
}
|
||||
|
||||
|
@ -263,9 +263,6 @@ TraversalPath* SingleServerTraverser::next() {
|
|||
size_t countEdges = path.edges.size();
|
||||
|
||||
auto p = std::make_unique<SingleServerTraversalPath>(path, this);
|
||||
if (countEdges >= _opts.maxDepth) {
|
||||
_pruneNext = true;
|
||||
}
|
||||
if (countEdges < _opts.minDepth) {
|
||||
return next();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "Basics/Common.h"
|
||||
#include "Basics/hashes.h"
|
||||
#include "Basics/ShortestPathFinder.h"
|
||||
#include "Basics/Traverser.h"
|
||||
#include "Aql/AstNode.h"
|
||||
#include "Utils/CollectionNameResolver.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue