memgraph/include/storage/vertices.hpp

33 lines
932 B
C++
Raw Normal View History

#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:
2016-08-08 16:32:34 +08:00
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:
2016-08-08 16:32:34 +08:00
vertices_t vertices;
Index<label_ref_t, VertexIndexRecordCollection> label_index;
AtomicCounter<uint64_t> counter;
};