Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[COR-57] Remove extractCollection helper from step#22166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
markuspf wants to merge4 commits intochore/unify-vertex-ref
base:chore/unify-vertex-ref
Choose a base branch
Loading
fromchore/remove-extract-collection-helper-from-step
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletionsarangod/Graph/Enumerators/WeightedTwoSidedEnumerator.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,15 +255,13 @@ class WeightedTwoSidedEnumerator {
return _haveSeenOtherSide;
}

auto setForbiddenVertices(std::shared_ptr<VertexSet> forbidden) -> void
requires HasForbidden<PathValidatorType>
{
auto setForbiddenVertices(std::shared_ptr<VertexSet> forbidden)
-> void requires HasForbidden<PathValidatorType> {
_validator.setForbiddenVertices(std::move(forbidden));
};

auto setForbiddenEdges(std::shared_ptr<EdgeSet> forbidden) -> void
requires HasForbidden<PathValidatorType>
{
auto setForbiddenEdges(std::shared_ptr<EdgeSet> forbidden)
-> void requires HasForbidden<PathValidatorType> {
_validator.setForbiddenEdges(std::move(forbidden));
};

Expand DownExpand Up@@ -395,22 +393,19 @@ class WeightedTwoSidedEnumerator {
*/
auto stealStats() -> aql::TraversalStats;

auto setForbiddenVertices(std::shared_ptr<VertexSet> forbidden) -> void
requires HasForbidden<PathValidatorType>
{
auto setForbiddenVertices(std::shared_ptr<VertexSet> forbidden)
-> void requires HasForbidden<PathValidatorType> {
_left.setForbiddenVertices(forbidden);
_right.setForbiddenVertices(std::move(forbidden));
};

auto setForbiddenEdges(std::shared_ptr<EdgeSet> forbidden) -> void
requires HasForbidden<PathValidatorType>
{
auto setForbiddenEdges(std::shared_ptr<EdgeSet> forbidden)
-> void requires HasForbidden<PathValidatorType> {
_left.setForbiddenEdges(forbidden);
_right.setForbiddenEdges(std::move(forbidden));
};

private:
[[nodiscard]] auto searchDone() const -> bool;
private : [[nodiscard]] auto searchDone() const -> bool;
// Ensure that we have fetched all vertices in the _results list. Otherwise,
// we will not be able to generate the resulting path
auto fetchResults() -> void;
Expand Down
8 changes: 6 additions & 2 deletionsarangod/Graph/PathManagement/PathValidator.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -256,9 +256,13 @@ auto PathValidator<ProviderType, PathStore, vertexUniqueness, edgeUniqueness>::
return true;
}

auto collectionName = step.getCollectionName();
auto collectionNameResult = step.getVertex().collectionName();
if (collectionNameResult.fail()) {
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
}

if (std::find(allowedCollections.begin(), allowedCollections.end(),
collectionName) != allowedCollections.end()) {
collectionNameResult.get()) != allowedCollections.end()) {
// found in allowed collections => allowed
return true;
}
Expand Down
16 changes: 1 addition & 15 deletionsarangod/Graph/Providers/BaseStep.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@

#include <velocypack/HashedStringRef.h>
#include "Basics/ResultT.h"
#include "Basics/Exceptions.h"

#include <numeric>

Expand DownExpand Up@@ -56,21 +57,6 @@ class BaseStep {

double getWeight() const { return _weight; }

[[nodiscard]] ResultT<std::pair<std::string, size_t>> extractCollectionName(
arangodb::velocypack::HashedStringRef const& idHashed) const {
size_t pos = idHashed.find('/');
if (pos == std::string::npos) {
// Invalid input. If we get here somehow we managed to store invalid
// _from/_to values or the traverser did a let an illegal start through
TRI_ASSERT(false);
return Result{TRI_ERROR_GRAPH_INVALID_EDGE,
"edge contains invalid value " + idHashed.toString()};
}

std::string colName = idHashed.substr(0, pos).toString();
return std::make_pair(std::move(colName), pos);
}

private:
size_t _previous;
size_t _depth;
Expand Down
8 changes: 0 additions & 8 deletionsarangod/Graph/Steps/ClusterProviderStep.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,14 +110,6 @@ class ClusterProviderStep : public arangodb::graph::BaseStep {
// beware: returns a *copy* of the edge id
[[nodiscard]] EdgeType getEdgeIdentifier() const { return _edge.getID(); }

[[nodiscard]] std::string getCollectionName() const {
auto collectionNameResult = extractCollectionName(_vertex.getID());
if (collectionNameResult.fail()) {
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
}
return collectionNameResult.get().first;
}

friend auto operator<<(std::ostream& out, ClusterProviderStep const& step)
-> std::ostream&;

Expand Down
13 changes: 0 additions & 13 deletionsarangod/Graph/Steps/SingleServerProviderStep.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,19 +79,6 @@ class SingleServerProviderStep : public arangodb::graph::BaseStep {
// beware: will return a *copy* of the edge id
EdgeType getEdgeIdentifier() const { return _edge.getID(); }

std::string getCollectionName() const {
/*
* Future optimization: When re-implementing the documentFastPathLocal
* method to support string refs or either string views, we can improve this
* section here as well.
*/
auto collectionNameResult = extractCollectionName(_vertex.getID());
if (collectionNameResult.fail()) {
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
}
return collectionNameResult.get().first;
};

friend auto operator<<(std::ostream& out,
SingleServerProviderStep const& step) -> std::ostream&;

Expand Down
1 change: 1 addition & 0 deletionsarangod/Graph/Types/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
target_sources(arango_graph PRIVATE
VertexRef.cpp
UniquenessLevel.cpp
ValidationResult.cpp)
4 changes: 4 additions & 0 deletionsarangod/Graph/Types/VertexRef.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,8 @@
////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Basics/ResultT.h"

#include <velocypack/HashedStringRef.h>

#include <compare>
Expand DownExpand Up@@ -57,6 +59,8 @@ class VertexRef {

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

[[nodiscard]] auto collectionName() const -> ResultT<std::string_view>;

private:
RefType _vertex;
};
Expand Down
8 changes: 0 additions & 8 deletionstests/Mocks/MockGraphProvider.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,14 +220,6 @@ class MockGraphProvider {
return _edge.getID();
}

std::string getCollectionName() const {
auto collectionNameResult = extractCollectionName(_vertex.getID());
if (collectionNameResult.fail()) {
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
}
return collectionNameResult.get().first;
};

void setLocalSchreierIndex(size_t index) {
TRI_ASSERT(index != std::numeric_limits<size_t>::max());
TRI_ASSERT(!hasLocalSchreierIndex());
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp