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/properties/traversers/jsonwriter.hpp"
|
2016-08-15 07:09:58 +08:00
|
|
|
#include "storage/model/vertex_model.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;
|
2016-08-15 07:09:58 +08:00
|
|
|
Vertex(const VertexModel &data) : data(data) {}
|
|
|
|
Vertex(VertexModel &&data) : data(std::move(data)) {}
|
2015-12-06 23:37:42 +08:00
|
|
|
|
2016-08-15 07:09:58 +08:00
|
|
|
Vertex(const Vertex &) = delete;
|
|
|
|
Vertex(Vertex &&) = delete;
|
2015-12-06 23:37:42 +08:00
|
|
|
|
2016-08-15 07:09:58 +08:00
|
|
|
Vertex &operator=(const Vertex &) = delete;
|
|
|
|
Vertex &operator=(Vertex &&) = delete;
|
2015-12-06 23:37:42 +08:00
|
|
|
|
|
|
|
VertexModel data;
|
2015-07-07 22:18:26 +08:00
|
|
|
};
|
|
|
|
|
2016-08-15 07:09:58 +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
|
2016-09-13 19:14:16 +08:00
|
|
|
record.data.props.handle(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()
|
2016-08-15 07:09:58 +08:00
|
|
|
<< ", exp = " << record.tx.exp() << "): " << buffer.str();
|
2015-10-08 06:58:29 +08:00
|
|
|
}
|