Commit 4d4ca4cd authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #65

Port message-rework changes to incubator
parents f5b0bf3e 2bc60f68
......@@ -125,8 +125,7 @@ public:
// nop
}
static expected<buffer_type> serialize(actor_system& sys,
const type_erased_tuple& x);
static expected<buffer_type> serialize(actor_system& sys, const message& x);
// -- utility functions ------------------------------------------------------
......
......@@ -48,8 +48,7 @@ public:
using maybe_buffer = expected<std::vector<byte>>;
/// A function type for serializing message payloads.
using serialize_fun_type = maybe_buffer (*)(actor_system&,
const type_erased_tuple&);
using serialize_fun_type = maybe_buffer (*)(actor_system&, const message&);
// -- constructors, destructors, and assignment operators --------------------
......
......@@ -39,7 +39,6 @@
#include "caf/sec.hpp"
#include "caf/send.hpp"
#include "caf/string_algorithms.hpp"
#include "caf/type_erased_tuple.hpp"
namespace caf::net::basp {
......@@ -120,10 +119,10 @@ void application::local_actor_down(packet_writer& writer, actor_id id,
}
expected<std::vector<byte>> application::serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
std::vector<byte> result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......
......@@ -22,7 +22,6 @@
#include "caf/detail/net_syscall.hpp"
#include "caf/detail/socket_sys_includes.hpp"
#include "caf/error.hpp"
#include "caf/make_message.hpp"
#include "caf/message.hpp"
#include "caf/net/socket.hpp"
#include "caf/none.hpp"
......
......@@ -25,10 +25,12 @@
#include "caf/error.hpp"
#include "caf/expected.hpp"
#include "caf/logger.hpp"
#include "caf/make_counted.hpp"
#include "caf/net/operation.hpp"
#include "caf/net/pollset_updater.hpp"
#include "caf/net/socket_manager.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
#include "caf/variant.hpp"
#ifndef CAF_WINDOWS
......
......@@ -26,10 +26,10 @@
#include "caf/detail/socket_sys_aliases.hpp"
#include "caf/detail/socket_sys_includes.hpp"
#include "caf/expected.hpp"
#include "caf/make_message.hpp"
#include "caf/message.hpp"
#include "caf/net/stream_socket.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
#include "caf/variant.hpp"
namespace caf::net {
......
......@@ -27,6 +27,7 @@
#include "caf/ip_endpoint.hpp"
#include "caf/logger.hpp"
#include "caf/net/socket_guard.hpp"
#include "caf/span.hpp"
namespace caf::net {
......
......@@ -166,11 +166,10 @@ public:
CAF_FAIL("handle_error called: " << to_string(sec));
}
static expected<buffer_type> serialize(actor_system& sys,
const type_erased_tuple& x) {
static expected<buffer_type> serialize(actor_system& sys, const message& x) {
buffer_type result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......
......@@ -61,10 +61,10 @@ struct fixture : test_coordinator_fixture<>, host_fixture {
class dummy_application {
public:
static expected<std::vector<byte>> serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
std::vector<byte> result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......@@ -117,7 +117,7 @@ public:
using application_type = dummy_application;
static expected<std::vector<byte>> serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
return dummy_application::serialize(sys, x);
}
......
......@@ -31,6 +31,7 @@
#include "caf/net/make_endpoint_manager.hpp"
#include "caf/net/multiplexer.hpp"
#include "caf/net/stream_socket.hpp"
#include "caf/node_id.hpp"
#include "caf/span.hpp"
using namespace caf;
......@@ -62,10 +63,10 @@ struct fixture : test_coordinator_fixture<>, host_fixture {
class dummy_application {
public:
static expected<std::vector<byte>> serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
std::vector<byte> result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......@@ -124,7 +125,7 @@ public:
template <class Manager>
void resolve(Manager& mgr, const uri& locator, const actor& listener) {
actor_id aid = 42;
auto hid = "0011223344556677889900112233445566778899";
auto hid = string_view("0011223344556677889900112233445566778899");
auto nid = unbox(make_node_id(42, hid));
actor_config cfg;
auto p = make_actor<actor_proxy_impl, strong_actor_ptr>(aid, nid,
......
......@@ -106,7 +106,7 @@ public:
template <class Parent>
void resolve(Parent& parent, string_view path, const actor& listener) {
actor_id aid = 42;
auto hid = "0011223344556677889900112233445566778899";
auto hid = string_view("0011223344556677889900112233445566778899");
auto nid = unbox(make_node_id(42, hid));
actor_config cfg;
endpoint_manager_ptr ptr{&parent.manager()};
......@@ -137,11 +137,10 @@ public:
// nop
}
static expected<buffer_type> serialize(actor_system& sys,
const type_erased_tuple& x) {
static expected<buffer_type> serialize(actor_system& sys, const message& x) {
buffer_type result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......
......@@ -113,10 +113,10 @@ public:
}
static expected<std::vector<byte>> serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
std::vector<byte> result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......@@ -168,7 +168,7 @@ public:
template <class Parent>
void resolve(Parent& parent, string_view path, actor listener) {
actor_id aid = 42;
auto hid = "0011223344556677889900112233445566778899";
auto hid = string_view("0011223344556677889900112233445566778899");
auto nid = unbox(make_node_id(aid, hid));
actor_config cfg;
auto sys = &parent.system();
......
......@@ -103,10 +103,10 @@ public:
}
static expected<std::vector<byte>> serialize(actor_system& sys,
const type_erased_tuple& x) {
const message& x) {
std::vector<byte> result;
binary_serializer sink{sys, result};
if (auto err = message::save(sink, x))
if (auto err = x.save(sink))
return err.value();
return result;
}
......
......@@ -92,8 +92,7 @@ public:
rec_buf_->push_back(static_cast<byte>(id_));
}
static expected<buffer_type> serialize(actor_system&,
const type_erased_tuple&) {
static expected<buffer_type> serialize(actor_system&, const message&) {
return buffer_type{};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment