Serialize Endpoint via SLK

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1751
This commit is contained in:
Teon Banek 2018-11-21 13:06:24 +01:00
parent 22824fd83c
commit b995dac623

View File

@ -5,6 +5,8 @@
#include <iostream>
#include <string>
// TODO: SLK serialization should be its own thing
#include "communication/rpc/serialization.hpp"
#include "io/network/endpoint.capnp.h"
#include "utils/exceptions.hpp"
@ -38,3 +40,19 @@ void Save(const Endpoint &endpoint, capnp::Endpoint::Builder *builder);
void Load(Endpoint *endpoint, const capnp::Endpoint::Reader &reader);
} // namespace io::network
namespace slk {
inline void Save(const io::network::Endpoint &endpoint, slk::Builder *builder) {
slk::Save(endpoint.address_, builder);
slk::Save(endpoint.port_, builder);
slk::Save(endpoint.family_, builder);
}
inline void Load(io::network::Endpoint *endpoint, slk::Reader *reader) {
slk::Load(&endpoint->address_, reader);
slk::Load(&endpoint->port_, reader);
slk::Load(&endpoint->family_, reader);
}
} // namespace slk