2016-08-10 03:29:03 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-08-09 23:44:39 +08:00
|
|
|
#include "mvcc/version_list.hpp"
|
|
|
|
#include "storage/edge.hpp"
|
|
|
|
|
2016-08-25 22:29:45 +08:00
|
|
|
class VertexRecord;
|
|
|
|
|
2016-08-10 03:29:03 +08:00
|
|
|
class EdgeRecord : public mvcc::VersionList<Edge>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EdgeRecord(Id id, VertexRecord *from, VertexRecord *to)
|
|
|
|
: from_v(from), to_v(to), VersionList(id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
EdgeRecord(const VersionList &) = delete;
|
|
|
|
|
|
|
|
/* @brief Move constructs the version list
|
|
|
|
* Note: use only at the beginning of the "other's" lifecycle since this
|
|
|
|
* constructor doesn't move the RecordLock, but only the head pointer
|
|
|
|
*/
|
|
|
|
EdgeRecord(EdgeRecord &&other)
|
|
|
|
: from_v(other.from_v), to_v(other.to_v), VersionList(std::move(other))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-11 03:02:54 +08:00
|
|
|
VertexRecord *&get_key() { return this->from_v; }
|
2016-08-10 03:29:03 +08:00
|
|
|
|
|
|
|
auto from() const { return this->from_v; }
|
|
|
|
|
|
|
|
auto to() const { return this->to_v; }
|
|
|
|
|
2016-08-15 07:09:58 +08:00
|
|
|
protected:
|
2016-08-10 03:29:03 +08:00
|
|
|
VertexRecord *from_v;
|
|
|
|
VertexRecord *to_v;
|
|
|
|
};
|