df0bf6fa5f
DbAccessor: -Guarantees that access to Vertex and Edge is possible only through Vertex::Accessor and Edge::Accessor. -Guarantees that changing Vertex and Edge is possible only using Vertex::Accessor returned by vertex_insert() method and Edge::Accessor returned by edge_insert() method. -Offers CRUD for Vertex and Edge except iterating over all edges. Squashed commit messages: First step in database accessor refactoring done. It's compiling. All tests with exception of integration_querys pass Tests now initialize logging facilities. Refactored accessors. RecordAccessor now has 3 states. From,To,Out,In in there respecive Accessors return unfilled RecordAccessor. Added iterator classes into utils/itearator/.
33 lines
932 B
C++
33 lines
932 B
C++
#pragma once
|
|
|
|
#include "data_structures/concurrent/concurrent_map.hpp"
|
|
#include "database/db_transaction.hpp"
|
|
#include "storage/common.hpp"
|
|
#include "storage/indexes/index.hpp"
|
|
#include "storage/indexes/index_record_collection.hpp"
|
|
#include "storage/vertex_accessor.hpp"
|
|
#include "utils/option.hpp"
|
|
|
|
class Vertices
|
|
{
|
|
public:
|
|
using vertices_t = ConcurrentMap<uint64_t, VertexRecord>;
|
|
|
|
vertices_t::Accessor access();
|
|
|
|
Option<const Vertex::Accessor> find(DbTransaction &t, const Id &id);
|
|
|
|
// Creates new Vertex and returns filled Vertex::Accessor.
|
|
Vertex::Accessor insert(DbTransaction &t);
|
|
|
|
void update_label_index(const Label &label,
|
|
VertexIndexRecord &&index_record);
|
|
|
|
VertexIndexRecordCollection &find_label_index(const Label &label);
|
|
|
|
private:
|
|
vertices_t vertices;
|
|
Index<label_ref_t, VertexIndexRecordCollection> label_index;
|
|
AtomicCounter<uint64_t> counter;
|
|
};
|