@@ -38,27 +38,24 @@ using Traverser = arangodb::traverser::Traverser;
38
38
using TraverserOptions = arangodb::traverser::TraverserOptions;
39
39
40
40
PathEnumerator::PathEnumerator (Traverser* traverser, TraverserOptions* opts)
41
- : _traverser(traverser),
42
- _isFirst(true ),
43
- _opts(opts),
44
- _httpRequests(0 ) {}
41
+ : _traverser(traverser), _isFirst(true ), _opts(opts), _httpRequests(0 ) {}
45
42
46
43
PathEnumerator::~PathEnumerator () = default ;
47
44
48
45
void PathEnumerator::setStartVertex (arangodb::velocypack::StringRef startVertex) {
49
46
_enumeratedPath.edges .clear ();
50
47
_enumeratedPath.vertices .clear ();
51
- _isFirst = true ;
48
+ _isFirst = true ;
52
49
_httpRequests = 0 ;
53
-
50
+
54
51
_enumeratedPath.vertices .push_back (startVertex);
55
52
TRI_ASSERT (_enumeratedPath.vertices .size () == 1 );
56
53
}
57
54
58
55
bool PathEnumerator::keepEdge (arangodb::graph::EdgeDocumentToken& eid,
59
56
arangodb::velocypack::Slice edge,
60
- arangodb::velocypack::StringRef sourceVertex, size_t depth,
61
- size_t cursorId) {
57
+ arangodb::velocypack::StringRef sourceVertex,
58
+ size_t depth, size_t cursorId) {
62
59
if (_opts->hasEdgeFilter (depth, cursorId)) {
63
60
VPackSlice e = edge;
64
61
if (edge.isString ()) {
@@ -73,7 +70,8 @@ bool PathEnumerator::keepEdge(arangodb::graph::EdgeDocumentToken& eid,
73
70
return _opts->destinationCollectionAllowed (edge, sourceVertex);
74
71
}
75
72
76
- graph::EdgeCursor* PathEnumerator::getCursor (arangodb::velocypack::StringRef nextVertex, uint64_t currentDepth) {
73
+ graph::EdgeCursor* PathEnumerator::getCursor (arangodb::velocypack::StringRef nextVertex,
74
+ uint64_t currentDepth) {
77
75
if (currentDepth >= _cursors.size ()) {
78
76
_cursors.emplace_back (_opts->buildCursor (currentDepth));
79
77
}
@@ -83,15 +81,14 @@ graph::EdgeCursor* PathEnumerator::getCursor(arangodb::velocypack::StringRef nex
83
81
}
84
82
85
83
DepthFirstEnumerator::DepthFirstEnumerator (Traverser* traverser, TraverserOptions* opts)
86
- : PathEnumerator(traverser, opts),
87
- _activeCursors(0 ),
88
- _pruneNext(false ) {}
84
+ : PathEnumerator(traverser, opts), _activeCursors(0 ), _pruneNext(false ) {}
89
85
90
86
DepthFirstEnumerator::~DepthFirstEnumerator () = default ;
91
87
92
88
void DepthFirstEnumerator::setStartVertex (arangodb::velocypack::StringRef startVertex) {
93
89
PathEnumerator::setStartVertex (startVertex);
94
90
91
+ _activeCursors = 0 ;
95
92
_pruneNext = false ;
96
93
}
97
94
@@ -114,7 +111,9 @@ bool DepthFirstEnumerator::next() {
114
111
if (_enumeratedPath.edges .size () < _opts->maxDepth && !_pruneNext) {
115
112
// We are not done with this path, so
116
113
// we reserve the cursor for next depth
117
- graph::EdgeCursor* cursor = getCursor (arangodb::velocypack::StringRef (_enumeratedPath.vertices .back ()), _enumeratedPath.edges .size ());
114
+ graph::EdgeCursor* cursor =
115
+ getCursor (arangodb::velocypack::StringRef (_enumeratedPath.vertices .back ()),
116
+ _enumeratedPath.edges .size ());
118
117
incHttpRequests (cursor->httpRequests ());
119
118
++_activeCursors;
120
119
} else {
@@ -131,7 +130,7 @@ bool DepthFirstEnumerator::next() {
131
130
auto callback = [&](graph::EdgeDocumentToken&& eid, VPackSlice const & edge, size_t cursorId) {
132
131
if (!keepEdge (eid, edge,
133
132
arangodb::velocypack::StringRef (_enumeratedPath.vertices .back ()),
134
- _enumeratedPath.edges .size (), cursorId)) {
133
+ _enumeratedPath.edges .size (), cursorId)) {
135
134
return ;
136
135
}
137
136
@@ -257,13 +256,13 @@ bool DepthFirstEnumerator::shouldPrune() {
257
256
if (!_opts->usesPrune ()) {
258
257
return false ;
259
258
}
260
-
259
+
261
260
transaction::BuilderLeaser pathBuilder (_opts->trx ());
262
261
// evaluator->evaluate() might access these, so they have to live long
263
262
// enough
264
263
aql::AqlValue vertex, edge;
265
264
aql::AqlValueGuard vertexGuard{vertex, true }, edgeGuard{edge, true };
266
-
265
+
267
266
aql::PruneExpressionEvaluator* evaluator = _opts->getPruneEvaluator ();
268
267
TRI_ASSERT (evaluator != nullptr );
269
268
@@ -281,4 +280,3 @@ bool DepthFirstEnumerator::shouldPrune() {
281
280
}
282
281
return evaluator->evaluate ();
283
282
}
284
-
0 commit comments