2015-11-22 02:16:19 +08:00
|
|
|
#pragma once
|
2015-07-07 22:18:26 +08:00
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
#include "mvcc/record.hpp"
|
2016-08-10 16:39:02 +08:00
|
|
|
#include "storage/model/vertex_model.hpp"
|
|
|
|
#include "storage/model/properties/traversers/jsonwriter.hpp"
|
2015-07-07 22:18:26 +08:00
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
class Vertex : public mvcc::Record<Vertex>
|
2015-07-07 22:18:26 +08:00
|
|
|
{
|
2015-12-06 23:37:42 +08:00
|
|
|
public:
|
2016-01-02 19:20:51 +08:00
|
|
|
class Accessor;
|
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
Vertex() = default;
|
|
|
|
Vertex(const VertexModel& data) : data(data) {}
|
|
|
|
Vertex(VertexModel&& data) : data(std::move(data)) {}
|
|
|
|
|
|
|
|
Vertex(const Vertex&) = delete;
|
|
|
|
Vertex(Vertex&&) = delete;
|
|
|
|
|
|
|
|
Vertex& operator=(const Vertex&) = delete;
|
|
|
|
Vertex& operator=(Vertex&&) = delete;
|
|
|
|
|
|
|
|
VertexModel data;
|
2015-07-07 22:18:26 +08:00
|
|
|
};
|
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
inline std::ostream& operator<<(std::ostream& stream, const Vertex& record)
|
2015-10-08 06:58:29 +08:00
|
|
|
{
|
2015-10-14 02:32:54 +08:00
|
|
|
StringBuffer buffer;
|
|
|
|
JsonWriter<StringBuffer> writer(buffer);
|
|
|
|
|
|
|
|
// dump properties in this buffer
|
2015-12-06 23:37:42 +08:00
|
|
|
record.data.props.accept(writer);
|
2015-10-14 02:44:14 +08:00
|
|
|
writer.finish();
|
2015-10-08 06:58:29 +08:00
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
return stream << "Vertex"
|
2015-12-08 01:45:44 +08:00
|
|
|
<< "(cre = " << record.tx.cre()
|
|
|
|
<< ", exp = " << record.tx.exp()
|
2015-10-14 02:32:54 +08:00
|
|
|
<< "): " << buffer.str();
|
2015-10-08 06:58:29 +08:00
|
|
|
}
|