memgraph/include/storage/edges.hpp
Kruno Tomola Fabro b2ce3d58a4 Added cleaner.
Added multithreading to dbms.
Skiplist now supports emplace insert.
2016-08-30 00:45:07 +01:00

44 lines
1.2 KiB
C++

#pragma once
#include <string>
#include "data_structures/concurrent/concurrent_map.hpp"
#include "utils/counters/atomic_counter.hpp"
#include "utils/option.hpp"
#include "storage/edge_record.hpp"
#include "storage/model/properties/property_family.hpp"
class EdgeAccessor;
class DbTransaction;
using EdgePropertyFamily = PropertyFamily<TypeGroupEdge>;
template <class K>
using EdgeIndexBase = IndexBase<TypeGroupEdge, K>;
class Edges
{
using prop_familys_t = ConcurrentMap<std::string, EdgePropertyFamily *>;
using store_t = ConcurrentMap<uint64_t, EdgeRecord>;
public:
store_t::Accessor access();
Option<const EdgeAccessor> find(DbTransaction &t, const Id &id);
// Creates new Edge and returns filled EdgeAccessor.
EdgeAccessor insert(DbTransaction &t, VertexRecord *from, VertexRecord *to);
prop_familys_t::Accessor property_family_access();
EdgePropertyFamily &property_family_find_or_create(const std::string &name);
private:
store_t edges;
// TODO: Because familys wont be removed this could be done with more
// efficent
// data structure.
prop_familys_t prop_familys;
AtomicCounter<uint64_t> counter;
};