Create storage level call-chain
This commit is contained in:
parent
619b01f3f8
commit
a58f2887b3
@ -439,6 +439,12 @@ class DbAccessor final {
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> FindEdge(storage::Gid gid, storage::View view) {
|
||||||
|
auto maybe_edge = accessor_->FindEdge(gid, view);
|
||||||
|
if (maybe_edge) return EdgeAccessor(*maybe_edge);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
void FinalizeTransaction() { accessor_->FinalizeTransaction(); }
|
void FinalizeTransaction() { accessor_->FinalizeTransaction(); }
|
||||||
|
|
||||||
void TrackCurrentThreadAllocations() {
|
void TrackCurrentThreadAllocations() {
|
||||||
@ -789,6 +795,8 @@ class SubgraphDbAccessor final {
|
|||||||
|
|
||||||
std::optional<VertexAccessor> FindVertex(storage::Gid gid, storage::View view);
|
std::optional<VertexAccessor> FindVertex(storage::Gid gid, storage::View view);
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> FindEdge(storage::Gid gid, storage::View view);
|
||||||
|
|
||||||
Graph *getGraph();
|
Graph *getGraph();
|
||||||
|
|
||||||
storage::StorageMode GetStorageMode() const noexcept;
|
storage::StorageMode GetStorageMode() const noexcept;
|
||||||
|
@ -913,6 +913,10 @@ std::optional<VertexAccessor> DiskStorage::DiskAccessor::FindVertex(storage::Gid
|
|||||||
return disk_storage->FindVertex(gid, &transaction_, view);
|
return disk_storage->FindVertex(gid, &transaction_, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> DiskStorage::DiskAccessor::FindEdge(storage::Gid gid, View view) {
|
||||||
|
throw utils::NotYetImplemented("Id based lookup for on-disk storage mode is not yet implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
Result<std::optional<std::pair<std::vector<VertexAccessor>, std::vector<EdgeAccessor>>>>
|
Result<std::optional<std::pair<std::vector<VertexAccessor>, std::vector<EdgeAccessor>>>>
|
||||||
DiskStorage::DiskAccessor::DetachDelete(std::vector<VertexAccessor *> nodes, std::vector<EdgeAccessor *> edges,
|
DiskStorage::DiskAccessor::DetachDelete(std::vector<VertexAccessor *> nodes, std::vector<EdgeAccessor *> edges,
|
||||||
bool detach) {
|
bool detach) {
|
||||||
|
@ -72,6 +72,8 @@ class DiskStorage final : public Storage {
|
|||||||
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
||||||
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) override;
|
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) override;
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> FindEdge(Gid gid, View view) override;
|
||||||
|
|
||||||
EdgesIterable Edges(EdgeTypeId edge_type, View view) override;
|
EdgesIterable Edges(EdgeTypeId edge_type, View view) override;
|
||||||
|
|
||||||
uint64_t ApproximateVertexCount() const override;
|
uint64_t ApproximateVertexCount() const override;
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
#include "utils/memory_tracker.hpp"
|
#include "utils/memory_tracker.hpp"
|
||||||
|
|
||||||
namespace memgraph::storage {
|
namespace memgraph::storage {
|
||||||
|
std::optional<EdgeAccessor> EdgeAccessor::Create(EdgeRef edge, EdgeTypeId edge_type, Vertex *from_vertex,
|
||||||
|
Vertex *to_vertex, Storage *storage, Transaction *transaction,
|
||||||
|
bool for_deleted) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
bool EdgeAccessor::IsDeleted() const {
|
bool EdgeAccessor::IsDeleted() const {
|
||||||
if (!storage_->config_.salient.items.properties_on_edges) {
|
if (!storage_->config_.salient.items.properties_on_edges) {
|
||||||
|
@ -44,6 +44,9 @@ class EdgeAccessor final {
|
|||||||
transaction_(transaction),
|
transaction_(transaction),
|
||||||
for_deleted_(for_deleted) {}
|
for_deleted_(for_deleted) {}
|
||||||
|
|
||||||
|
static std::optional<EdgeAccessor> Create(EdgeRef edge, EdgeTypeId edge_type, Vertex *from_vertex, Vertex *to_vertex,
|
||||||
|
Storage *storage, Transaction *transaction, bool for_deleted = false);
|
||||||
|
|
||||||
bool IsDeleted() const;
|
bool IsDeleted() const;
|
||||||
|
|
||||||
/// @return true if the object is visible from the current transaction
|
/// @return true if the object is visible from the current transaction
|
||||||
|
@ -1426,6 +1426,15 @@ EdgesIterable InMemoryStorage::InMemoryAccessor::Edges(EdgeTypeId edge_type, Vie
|
|||||||
return EdgesIterable(mem_edge_type_index->Edges(edge_type, view, storage_, &transaction_));
|
return EdgesIterable(mem_edge_type_index->Edges(edge_type, view, storage_, &transaction_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> InMemoryStorage::InMemoryAccessor::FindEdge(Gid gid, View view) {
|
||||||
|
auto *mem_storage = static_cast<InMemoryStorage *>(storage_);
|
||||||
|
auto acc = mem_storage->edges_.access();
|
||||||
|
auto it = acc.find(gid);
|
||||||
|
if (it == acc.end()) return std::nullopt;
|
||||||
|
// Create EdgeAccessor!
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
Transaction InMemoryStorage::CreateTransaction(
|
Transaction InMemoryStorage::CreateTransaction(
|
||||||
IsolationLevel isolation_level, StorageMode storage_mode,
|
IsolationLevel isolation_level, StorageMode storage_mode,
|
||||||
memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
||||||
|
@ -109,6 +109,8 @@ class InMemoryStorage final : public Storage {
|
|||||||
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
||||||
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) override;
|
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) override;
|
||||||
|
|
||||||
|
std::optional<EdgeAccessor> FindEdge(Gid gid, View view) override;
|
||||||
|
|
||||||
EdgesIterable Edges(EdgeTypeId edge_type, View view) override;
|
EdgesIterable Edges(EdgeTypeId edge_type, View view) override;
|
||||||
|
|
||||||
/// Return approximate number of all vertices in the database.
|
/// Return approximate number of all vertices in the database.
|
||||||
|
@ -174,6 +174,8 @@ class Storage {
|
|||||||
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
const std::optional<utils::Bound<PropertyValue>> &lower_bound,
|
||||||
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) = 0;
|
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view) = 0;
|
||||||
|
|
||||||
|
virtual std::optional<EdgeAccessor> FindEdge(Gid gid, View view) = 0;
|
||||||
|
|
||||||
virtual EdgesIterable Edges(EdgeTypeId edge_type, View view) = 0;
|
virtual EdgesIterable Edges(EdgeTypeId edge_type, View view) = 0;
|
||||||
|
|
||||||
virtual Result<std::optional<VertexAccessor>> DeleteVertex(VertexAccessor *vertex);
|
virtual Result<std::optional<VertexAccessor>> DeleteVertex(VertexAccessor *vertex);
|
||||||
|
Loading…
Reference in New Issue
Block a user