From b995dac62315edba80f31f8c39a6446c3b84ca33 Mon Sep 17 00:00:00 2001 From: Teon Banek Date: Wed, 21 Nov 2018 13:06:24 +0100 Subject: [PATCH] Serialize Endpoint via SLK Reviewers: mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1751 --- src/io/network/endpoint.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/io/network/endpoint.hpp b/src/io/network/endpoint.hpp index 5e5b4f970..decfb9054 100644 --- a/src/io/network/endpoint.hpp +++ b/src/io/network/endpoint.hpp @@ -5,6 +5,8 @@ #include #include +// 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