From b4715a5e50fb55a5ddce05e96935ef59135303cc Mon Sep 17 00:00:00 2001 From: antoniofilipovic Date: Thu, 7 Sep 2023 18:07:49 +0200 Subject: [PATCH] update naming --- src/query/db_accessor.hpp | 14 ++++++--- src/query/procedure/mg_procedure_impl.cpp | 36 ++++++++++++----------- src/storage/v2/edge_accessor.cpp | 4 +-- src/storage/v2/edge_accessor.hpp | 8 +++-- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/query/db_accessor.hpp b/src/query/db_accessor.hpp index 84809ad63..fb42b1744 100644 --- a/src/query/db_accessor.hpp +++ b/src/query/db_accessor.hpp @@ -94,9 +94,13 @@ class EdgeAccessor final { VertexAccessor From() const; - VertexAccessor ToWithDeleted() const; + /// When edge is deleted and you are accessing To vertex + /// for_deleted_ flag will in this case be updated properly + VertexAccessor DeletedEdgeToVertex() const; - VertexAccessor FromWithDeleted() const; + /// When edge is deleted and you are accessing From vertex + /// for_deleted_ flag will in this case be updated properly + VertexAccessor DeletedEdgeFromVertex() const; bool IsCycle() const; @@ -210,9 +214,11 @@ inline VertexAccessor EdgeAccessor::To() const { return VertexAccessor(impl_.ToV inline VertexAccessor EdgeAccessor::From() const { return VertexAccessor(impl_.FromVertex()); } -inline VertexAccessor EdgeAccessor::ToWithDeleted() const { return VertexAccessor(impl_.ToVertexWithDeleted()); } +inline VertexAccessor EdgeAccessor::DeletedEdgeToVertex() const { return VertexAccessor(impl_.DeletedEdgeToVertex()); } -inline VertexAccessor EdgeAccessor::FromWithDeleted() const { return VertexAccessor(impl_.FromVertexWithDeleted()); } +inline VertexAccessor EdgeAccessor::DeletedEdgeFromVertex() const { + return VertexAccessor(impl_.DeletedEdgeFromVertex()); +} inline bool EdgeAccessor::IsCycle() const { return To() == From(); } diff --git a/src/query/procedure/mg_procedure_impl.cpp b/src/query/procedure/mg_procedure_impl.cpp index 5e7aaec9f..0183f6b74 100644 --- a/src/query/procedure/mg_procedure_impl.cpp +++ b/src/query/procedure/mg_procedure_impl.cpp @@ -487,14 +487,15 @@ mgp_value::mgp_value(const memgraph::query::TypedValue &tv, mgp_graph *graph, me edge_v = std::visit( memgraph::utils::Overloaded{ [&tv, graph, &allocator](memgraph::query::DbAccessor *) { - return allocator.new_object(tv.ValueEdge(), tv.ValueEdge().FromWithDeleted(), - tv.ValueEdge().ToWithDeleted(), graph); + return allocator.new_object(tv.ValueEdge(), tv.ValueEdge().DeletedEdgeFromVertex(), + tv.ValueEdge().DeletedEdgeToVertex(), graph); }, [&tv, graph, &allocator](memgraph::query::SubgraphDbAccessor *db_impl) { return allocator.new_object( tv.ValueEdge(), - memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().FromWithDeleted(), db_impl->getGraph()), - memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().ToWithDeleted(), db_impl->getGraph()), + memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().DeletedEdgeFromVertex(), + db_impl->getGraph()), + memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().DeletedEdgeToVertex(), db_impl->getGraph()), graph); }}, graph->impl); @@ -850,19 +851,20 @@ mgp_value::mgp_value(mgp_value &&other, memgraph::utils::MemoryResource *m) : ty mgp_value::~mgp_value() noexcept { DeleteValueMember(this); } mgp_edge *mgp_edge::Copy(const mgp_edge &edge, mgp_memory &memory) { - return std::visit(memgraph::utils::Overloaded{ - [&](memgraph::query::DbAccessor *) { - return NewRawMgpObject(&memory, edge.impl, edge.impl.FromWithDeleted(), - edge.impl.ToWithDeleted(), edge.from.graph); - }, - [&](memgraph::query::SubgraphDbAccessor *db_impl) { - return NewRawMgpObject( - &memory, edge.impl, - memgraph::query::SubgraphVertexAccessor(edge.impl.FromWithDeleted(), db_impl->getGraph()), - memgraph::query::SubgraphVertexAccessor(edge.impl.ToWithDeleted(), db_impl->getGraph()), - edge.to.graph); - }}, - edge.to.graph->impl); + return std::visit( + memgraph::utils::Overloaded{ + [&](memgraph::query::DbAccessor *) { + return NewRawMgpObject(&memory, edge.impl, edge.impl.DeletedEdgeFromVertex(), + edge.impl.DeletedEdgeToVertex(), edge.from.graph); + }, + [&](memgraph::query::SubgraphDbAccessor *db_impl) { + return NewRawMgpObject( + &memory, edge.impl, + memgraph::query::SubgraphVertexAccessor(edge.impl.DeletedEdgeFromVertex(), db_impl->getGraph()), + memgraph::query::SubgraphVertexAccessor(edge.impl.DeletedEdgeToVertex(), db_impl->getGraph()), + edge.to.graph); + }}, + edge.to.graph->impl); } mgp_error mgp_value_copy(mgp_value *val, mgp_memory *memory, mgp_value **result) { diff --git a/src/storage/v2/edge_accessor.cpp b/src/storage/v2/edge_accessor.cpp index a2851bdd2..f2277245d 100644 --- a/src/storage/v2/edge_accessor.cpp +++ b/src/storage/v2/edge_accessor.cpp @@ -105,12 +105,12 @@ VertexAccessor EdgeAccessor::ToVertex() const { return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_}; } -VertexAccessor EdgeAccessor::FromVertexWithDeleted() const { +VertexAccessor EdgeAccessor::DeletedEdgeFromVertex() const { return VertexAccessor{from_vertex_, transaction_, indices_, constraints_, config_, for_deleted_ && from_vertex_->deleted}; } -VertexAccessor EdgeAccessor::ToVertexWithDeleted() const { +VertexAccessor EdgeAccessor::DeletedEdgeToVertex() const { return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_, for_deleted_ && to_vertex_->deleted}; } diff --git a/src/storage/v2/edge_accessor.hpp b/src/storage/v2/edge_accessor.hpp index 8e6bb2e19..f4076965c 100644 --- a/src/storage/v2/edge_accessor.hpp +++ b/src/storage/v2/edge_accessor.hpp @@ -52,9 +52,13 @@ class EdgeAccessor final { VertexAccessor ToVertex() const; - VertexAccessor FromVertexWithDeleted() const; + /// When edge is deleted and you are accessing To vertex + /// for_deleted_ flag will in this case be updated properly + VertexAccessor DeletedEdgeFromVertex() const; - VertexAccessor ToVertexWithDeleted() const; + /// When edge is deleted and you are accessing To vertex + /// for_deleted_ flag will in this case be updated properly + VertexAccessor DeletedEdgeToVertex() const; EdgeTypeId EdgeType() const { return edge_type_; }