2019-06-26 22:01:51 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <limits>
|
2019-07-08 21:10:05 +08:00
|
|
|
#include <tuple>
|
2019-06-26 22:01:51 +08:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "utils/spin_lock.hpp"
|
|
|
|
|
|
|
|
#include "storage/v2/delta.hpp"
|
2019-09-24 22:48:36 +08:00
|
|
|
#include "storage/v2/edge_ref.hpp"
|
2019-07-22 19:35:36 +08:00
|
|
|
#include "storage/v2/id_types.hpp"
|
2020-05-20 22:44:41 +08:00
|
|
|
#include "storage/v2/property_store.hpp"
|
2019-06-26 22:01:51 +08:00
|
|
|
|
|
|
|
namespace storage {
|
|
|
|
|
|
|
|
struct Vertex {
|
2019-07-01 22:11:12 +08:00
|
|
|
Vertex(Gid gid, Delta *delta) : gid(gid), deleted(false), delta(delta) {
|
2019-10-01 19:42:27 +08:00
|
|
|
CHECK(delta == nullptr || delta->action == Delta::Action::DELETE_OBJECT)
|
2019-06-26 22:01:51 +08:00
|
|
|
<< "Vertex must be created with an initial DELETE_OBJECT delta!";
|
|
|
|
}
|
|
|
|
|
|
|
|
Gid gid;
|
2019-07-08 21:10:05 +08:00
|
|
|
|
2019-07-22 19:35:36 +08:00
|
|
|
std::vector<LabelId> labels;
|
2020-05-20 22:44:41 +08:00
|
|
|
PropertyStore properties;
|
2019-06-26 22:01:51 +08:00
|
|
|
|
2019-09-24 22:48:36 +08:00
|
|
|
std::vector<std::tuple<EdgeTypeId, Vertex *, EdgeRef>> in_edges;
|
|
|
|
std::vector<std::tuple<EdgeTypeId, Vertex *, EdgeRef>> out_edges;
|
2019-07-08 21:10:05 +08:00
|
|
|
|
2020-01-10 21:01:45 +08:00
|
|
|
mutable utils::SpinLock lock;
|
2019-07-01 22:11:12 +08:00
|
|
|
bool deleted;
|
|
|
|
// uint8_t PAD;
|
|
|
|
// uint16_t PAD;
|
2019-06-26 22:01:51 +08:00
|
|
|
|
|
|
|
Delta *delta;
|
|
|
|
};
|
|
|
|
|
2019-07-09 19:09:24 +08:00
|
|
|
static_assert(alignof(Vertex) >= 8,
|
|
|
|
"The Vertex should be aligned to at least 8!");
|
|
|
|
|
2019-06-26 22:01:51 +08:00
|
|
|
inline bool operator==(const Vertex &first, const Vertex &second) {
|
|
|
|
return first.gid == second.gid;
|
|
|
|
}
|
|
|
|
inline bool operator<(const Vertex &first, const Vertex &second) {
|
|
|
|
return first.gid < second.gid;
|
|
|
|
}
|
|
|
|
inline bool operator==(const Vertex &first, const Gid &second) {
|
|
|
|
return first.gid == second;
|
|
|
|
}
|
|
|
|
inline bool operator<(const Vertex &first, const Gid &second) {
|
|
|
|
return first.gid < second;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace storage
|