2019-07-08 21:10:05 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <limits>
|
2019-07-18 18:35:15 +08:00
|
|
|
#include <map>
|
2019-07-08 21:10:05 +08:00
|
|
|
|
|
|
|
#include "utils/spin_lock.hpp"
|
|
|
|
|
|
|
|
#include "storage/v2/delta.hpp"
|
|
|
|
#include "storage/v2/gid.hpp"
|
|
|
|
|
|
|
|
namespace storage {
|
|
|
|
|
|
|
|
struct Vertex;
|
|
|
|
|
|
|
|
struct Edge {
|
|
|
|
Edge(Gid gid, Delta *delta) : gid(gid), deleted(false), delta(delta) {
|
|
|
|
CHECK(delta->action == Delta::Action::DELETE_OBJECT)
|
|
|
|
<< "Edge must be created with an initial DELETE_OBJECT delta!";
|
|
|
|
}
|
|
|
|
|
|
|
|
Gid gid;
|
|
|
|
|
2019-07-18 18:35:15 +08:00
|
|
|
std::map<uint64_t, storage::PropertyValue> properties;
|
2019-07-08 21:10:05 +08:00
|
|
|
|
|
|
|
utils::SpinLock lock;
|
|
|
|
bool deleted;
|
|
|
|
// uint8_t PAD;
|
|
|
|
// uint16_t PAD;
|
|
|
|
|
|
|
|
Delta *delta;
|
|
|
|
};
|
|
|
|
|
2019-07-09 19:09:24 +08:00
|
|
|
static_assert(alignof(Edge) >= 8, "The Edge should be aligned to at least 8!");
|
|
|
|
|
2019-07-08 21:10:05 +08:00
|
|
|
inline bool operator==(const Edge &first, const Edge &second) {
|
|
|
|
return first.gid == second.gid;
|
|
|
|
}
|
|
|
|
inline bool operator<(const Edge &first, const Edge &second) {
|
|
|
|
return first.gid < second.gid;
|
|
|
|
}
|
|
|
|
inline bool operator==(const Edge &first, const Gid &second) {
|
|
|
|
return first.gid == second;
|
|
|
|
}
|
|
|
|
inline bool operator<(const Edge &first, const Gid &second) {
|
|
|
|
return first.gid < second;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace storage
|