2015-12-06 23:37:42 +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/edge_model.hpp"
|
2016-11-29 11:08:08 +08:00
|
|
|
#include "utils/string_buffer.hpp"
|
|
|
|
#include "storage/model/properties/json_writer.hpp"
|
|
|
|
#include "utils/handle_write.hpp"
|
2015-07-07 22:18:26 +08:00
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
class Edge : public mvcc::Record<Edge>
|
2015-07-07 22:18:26 +08:00
|
|
|
{
|
2016-11-29 11:08:08 +08:00
|
|
|
using buffer_t = utils::StringBuffer;
|
|
|
|
using props_writer_t = JsonWriter<buffer_t>;
|
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
public:
|
2016-01-17 01:24:35 +08:00
|
|
|
class Accessor;
|
|
|
|
|
2015-12-06 23:37:42 +08:00
|
|
|
Edge() = default;
|
2016-08-25 22:29:45 +08:00
|
|
|
Edge(const EdgeModel &data) : data(data) {}
|
|
|
|
Edge(EdgeModel &&data) : data(std::move(data)) {}
|
2015-12-06 23:37:42 +08:00
|
|
|
|
2016-08-25 22:29:45 +08:00
|
|
|
Edge(const Edge &) = delete;
|
|
|
|
Edge(Edge &&) = delete;
|
2015-07-07 22:18:26 +08:00
|
|
|
|
2016-08-25 22:29:45 +08:00
|
|
|
Edge &operator=(const Edge &) = delete;
|
|
|
|
Edge &operator=(Edge &&) = delete;
|
2015-12-06 23:37:42 +08:00
|
|
|
|
|
|
|
EdgeModel data;
|
2016-11-29 11:08:08 +08:00
|
|
|
|
|
|
|
template <typename Stream>
|
|
|
|
void stream_repr(Stream &stream) const
|
|
|
|
{
|
|
|
|
auto props = handle_write<buffer_t, props_writer_t>(data.props);
|
|
|
|
|
|
|
|
stream << "Edge(cre = " << tx.cre() << ", "
|
|
|
|
<< "exp = " << tx.exp() << ", "
|
|
|
|
<< "props = " << props.str() << ")";
|
|
|
|
}
|
2015-12-06 23:37:42 +08:00
|
|
|
};
|