Skip to content

Commit 65b6bad

Browse files
committed
Move extractCollectionName into VertexRef
1 parent 4ca92b0 commit 65b6bad

File tree

6 files changed

+11
-92
lines changed

6 files changed

+11
-92
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
target_sources(arango_graph PRIVATE
2-
ExtractCollectionName.cpp
32
TraceEntry.cpp)

arangod/Graph/Helpers/ExtractCollectionName.cpp

Lines changed: 0 additions & 52 deletions
This file was deleted.

arangod/Graph/Helpers/ExtractCollectionName.h

Lines changed: 0 additions & 36 deletions
This file was deleted.

arangod/Graph/PathManagement/PathValidator.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "Graph/Steps/SingleServerProviderStep.h"
3535
#include "Graph/Types/ValidationResult.h"
3636
#include "Transaction/Helpers.h"
37-
#include "Graph/Helpers/ExtractCollectionName.h"
3837

3938
#ifdef USE_ENTERPRISE
4039
#include "Enterprise/Graph/Steps/SmartGraphStep.h"
@@ -257,9 +256,13 @@ auto PathValidator<ProviderType, PathStore, vertexUniqueness, edgeUniqueness>::
257256
return true;
258257
}
259258

260-
auto collectionName = extractCollectionNameOrThrow(step.getVertex().getID());
259+
auto collectionNameResult = step.getVertex().collectionName();
260+
if (collectionNameResult.fail()) {
261+
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
262+
}
263+
261264
if (std::find(allowedCollections.begin(), allowedCollections.end(),
262-
collectionName) != allowedCollections.end()) {
265+
collectionNameResult.get()) != allowedCollections.end()) {
263266
// found in allowed collections => allowed
264267
return true;
265268
}

arangod/Graph/Types/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
target_sources(arango_graph PRIVATE
2+
VertexRef.cpp
23
UniquenessLevel.cpp
34
ValidationResult.cpp)

arangod/Graph/Types/VertexRef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
////////////////////////////////////////////////////////////////////////////////
2222
#pragma once
2323

24+
#include "Basics/ResultT.h"
25+
2426
#include <velocypack/HashedStringRef.h>
2527

2628
#include <compare>
@@ -57,6 +59,8 @@ class VertexRef {
5759

5860
operator velocypack::HashedStringRef() { return _vertex; }
5961

62+
[[nodiscard]] auto collectionName() const -> ResultT<std::string_view>;
63+
6064
private:
6165
RefType _vertex;
6266
};

0 commit comments

Comments
 (0)