Migrate RPC to SLK

Summary:
Migrate all RPCs
Simplify Raft InstallSnapshot RPC
Add missing Load and Save for `char`

Reviewers: teon.banek, msantl

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2001
This commit is contained in:
Matej Ferencevic
2019-05-06 13:35:22 +02:00
parent 5833e6cc0f
commit d678e45c10
39 changed files with 543 additions and 553 deletions

View File

@@ -9,26 +9,33 @@
#include "communication/rpc/client_pool.hpp"
#include "communication/rpc/messages.hpp"
#include "communication/rpc/server.hpp"
#include "slk/serialization.hpp"
#include "utils/timer.hpp"
struct EchoMessage {
using Capnp = ::capnp::AnyPointer;
static const utils::TypeInfo kType;
EchoMessage() {} // Needed for serialization.
EchoMessage(const std::string &data) : data(data) {}
static void Load(EchoMessage *obj, slk::Reader *reader);
static void Save(const EchoMessage &obj, slk::Builder *builder);
std::string data;
};
void Save(const EchoMessage &echo, ::capnp::AnyPointer::Builder *builder) {
auto list_builder = builder->initAs<::capnp::List<::capnp::Text>>(1);
list_builder.set(0, echo.data);
namespace slk {
void Save(const EchoMessage &echo, Builder *builder) {
Save(echo.data, builder);
}
void Load(EchoMessage *echo, Reader *reader) { Load(&echo->data, reader); }
} // namespace slk
void Load(EchoMessage *echo, const ::capnp::AnyPointer::Reader &reader) {
auto list_reader = reader.getAs<::capnp::List<::capnp::Text>>();
echo->data = list_reader[0];
void EchoMessage::Load(EchoMessage *obj, slk::Reader *reader) {
slk::Load(obj, reader);
}
void EchoMessage::Save(const EchoMessage &obj, slk::Builder *builder) {
slk::Save(obj, builder);
}
const utils::TypeInfo EchoMessage::kType{2, "EchoMessage"};