2016-08-10 16:39:02 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-08-18 22:34:36 +08:00
|
|
|
#include <string>
|
2016-08-10 16:39:02 +08:00
|
|
|
#include "data_structures/concurrent/concurrent_map.hpp"
|
2016-08-11 22:32:58 +08:00
|
|
|
#include "mvcc/version_list.hpp"
|
2016-08-10 16:39:02 +08:00
|
|
|
#include "storage/common.hpp"
|
|
|
|
#include "storage/edge_accessor.hpp"
|
2016-08-18 22:34:36 +08:00
|
|
|
#include "storage/model/properties/property_family.hpp"
|
2016-08-15 07:09:58 +08:00
|
|
|
#include "utils/option.hpp"
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
class Edges
|
|
|
|
{
|
2016-08-18 22:34:36 +08:00
|
|
|
using prop_familys_t = ConcurrentMap<std::string, PropertyFamily *>;
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
public:
|
2016-08-15 07:09:58 +08:00
|
|
|
Option<const Edge::Accessor> find(DbTransaction &t, const Id &id);
|
|
|
|
|
|
|
|
// Creates new Edge and returns filled Edge::Accessor.
|
|
|
|
Edge::Accessor insert(DbTransaction &t, VertexRecord *from,
|
2016-08-11 22:32:58 +08:00
|
|
|
VertexRecord *to);
|
2016-08-10 16:39:02 +08:00
|
|
|
|
2016-08-18 22:34:36 +08:00
|
|
|
// auto property_family_access();
|
|
|
|
|
|
|
|
PropertyFamily &property_family_find_or_create(const std::string &name);
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
private:
|
|
|
|
ConcurrentMap<uint64_t, EdgeRecord> edges;
|
2016-08-18 22:34:36 +08:00
|
|
|
// TODO: Because familys wont be removed this could be done with more
|
|
|
|
// efficent
|
|
|
|
// data structure.
|
|
|
|
prop_familys_t prop_familys;
|
2016-08-10 16:39:02 +08:00
|
|
|
AtomicCounter<uint64_t> counter;
|
|
|
|
};
|