Final barrier commit.

This commit is contained in:
Kruno Tomola Fabro 2016-08-28 21:10:13 +01:00
parent e908d6588b
commit 6a4e2d8d64
6 changed files with 37 additions and 30 deletions

View File

@ -414,6 +414,7 @@ set(memgraph_src_files
${src_dir}/communication/bolt/v1/states/handshake.cpp
${src_dir}/communication/bolt/v1/transport/bolt_decoder.cpp
${src_dir}/communication/bolt/v1/transport/buffer.cpp
${src_dir}/communication/bolt/v1/serialization/bolt_serializer.cpp
${src_dir}/mvcc/id.cpp
${src_dir}/storage/vertices.cpp
${src_dir}/storage/edges.cpp

View File

@ -6,6 +6,7 @@
#include "database/db.hpp"
#include "database/db_accessor.hpp"
#include "storage/edge_type/edge_type.hpp"
#include "storage/edge_x_vertex.hpp"
#include "storage/label/label.hpp"
// **************************** HELPER DEFINES *******************************//

View File

@ -4,7 +4,6 @@
#include "communication/bolt/v1/transport/bolt_encoder.hpp"
#include "storage/edge_accessor.hpp"
#include "storage/edge_x_vertex.hpp"
#include "storage/vertex_accessor.hpp"
#include "storage/model/properties/all.hpp"
@ -73,31 +72,7 @@ public:
* }
*
*/
void write(const EdgeAccessor &edge)
{
// write signatures for the edge struct and edge data type
encoder.write_struct_header(5);
encoder.write(underlying_cast(pack::Relationship));
// write the identifier for the node
encoder.write_integer(edge.id());
encoder.write_integer(edge.from().id());
encoder.write_integer(edge.to().id());
// write the type of the edge
encoder.write_string(edge.edge_type());
// write the property map
auto props = edge.properties();
encoder.write_map_header(props.size());
for (auto &prop : props) {
write(prop.first.family_name());
write(*prop.second);
}
}
void write(const EdgeAccessor &edge);
void write(const Property &prop) { accept(prop, *this); }

View File

@ -23,7 +23,7 @@ public:
const EdgeType &edge_type() const;
const auto from() const;
auto from() const;
const auto to() const;
auto to() const;
};

View File

@ -5,12 +5,12 @@
#include "storage/edge_accessor.hpp"
#include "storage/vertex_accessor.hpp"
const auto EdgeAccessor::from() const
auto EdgeAccessor::from() const
{
return VertexAccessor(this->vlist->from(), this->db);
}
const auto EdgeAccessor::to() const
auto EdgeAccessor::to() const
{
return VertexAccessor(this->vlist->to(), this->db);
}

View File

@ -0,0 +1,30 @@
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
#include "storage/edge_x_vertex.hpp"
template <class Stream>
void bolt::BoltSerializer<Stream>::write(const EdgeAccessor &edge)
{
// write signatures for the edge struct and edge data type
encoder.write_struct_header(5);
encoder.write(underlying_cast(pack::Relationship));
// write the identifier for the node
encoder.write_integer(edge.id());
encoder.write_integer(edge.from().id());
encoder.write_integer(edge.to().id());
// write the type of the edge
encoder.write_string(edge.edge_type());
// write the property map
auto props = edge.properties();
encoder.write_map_header(props.size());
for (auto &prop : props) {
write(prop.first.family_name());
write(*prop.second);
}
}