Commit f4dfa77f authored by Dominik Charousset's avatar Dominik Charousset

Adhere to coding conventions

parent 93f87bf4
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
#pragma once #pragma once
#include <mutex>
#include <utility>
#include <functional> #include <functional>
#include <mutex>
#include <unordered_map> #include <unordered_map>
#include <utility>
#include "caf/fwd.hpp"
#include "caf/node_id.hpp"
#include "caf/actor_addr.hpp" #include "caf/actor_addr.hpp"
#include "caf/actor_cast.hpp" #include "caf/actor_cast.hpp"
#include "caf/actor_proxy.hpp" #include "caf/actor_proxy.hpp"
#include "caf/exit_reason.hpp" #include "caf/exit_reason.hpp"
#include "caf/fwd.hpp"
#include "caf/node_id.hpp"
namespace caf { namespace caf {
......
...@@ -16,18 +16,18 @@ ...@@ -16,18 +16,18 @@
* http://www.boost.org/LICENSE_1_0.txt. * * http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/ ******************************************************************************/
#include <utility>
#include <algorithm> #include <algorithm>
#include <utility>
#include "caf/node_id.hpp"
#include "caf/actor_addr.hpp" #include "caf/actor_addr.hpp"
#include "caf/serializer.hpp"
#include "caf/actor_system.hpp" #include "caf/actor_system.hpp"
#include "caf/deserializer.hpp" #include "caf/deserializer.hpp"
#include "caf/node_id.hpp"
#include "caf/proxy_registry.hpp" #include "caf/proxy_registry.hpp"
#include "caf/serializer.hpp"
#include "caf/logger.hpp"
#include "caf/actor_registry.hpp" #include "caf/actor_registry.hpp"
#include "caf/logger.hpp"
namespace caf { namespace caf {
...@@ -36,8 +36,7 @@ proxy_registry::backend::~backend() { ...@@ -36,8 +36,7 @@ proxy_registry::backend::~backend() {
} }
proxy_registry::proxy_registry(actor_system& sys, backend& be) proxy_registry::proxy_registry(actor_system& sys, backend& be)
: system_(sys), : system_(sys), backend_(be) {
backend_(be) {
// nop // nop
} }
...@@ -46,7 +45,7 @@ proxy_registry::~proxy_registry() { ...@@ -46,7 +45,7 @@ proxy_registry::~proxy_registry() {
} }
size_t proxy_registry::count_proxies(const node_id& node) const { size_t proxy_registry::count_proxies(const node_id& node) const {
std::unique_lock<std::mutex> guard {mtx_}; std::unique_lock<std::mutex> guard{mtx_};
auto i = proxies_.find(node); auto i = proxies_.find(node);
return i != proxies_.end() ? i->second.size() : 0; return i != proxies_.end() ? i->second.size() : 0;
} }
...@@ -69,7 +68,7 @@ strong_actor_ptr proxy_registry::get_or_put(const node_id& nid, actor_id aid) { ...@@ -69,7 +68,7 @@ strong_actor_ptr proxy_registry::get_or_put(const node_id& nid, actor_id aid) {
return result; return result;
} }
std::vector<strong_actor_ptr> std::vector<strong_actor_ptr>
proxy_registry::get_all(const node_id& node) const { proxy_registry::get_all(const node_id& node) const {
// Reserve at least some memory outside of the critical section. // Reserve at least some memory outside of the critical section.
std::vector<strong_actor_ptr> result; std::vector<strong_actor_ptr> result;
......
This diff is collapsed.
...@@ -454,9 +454,10 @@ bool instance::handle(execution_unit* ctx, connection_handle hdl, header& hdr, ...@@ -454,9 +454,10 @@ bool instance::handle(execution_unit* ctx, connection_handle hdl, header& hdr,
if (dest_node == this_node_) { if (dest_node == this_node_) {
// Delay this message to make sure we don't skip in-flight messages. // Delay this message to make sure we don't skip in-flight messages.
auto msg_id = queue_.new_id(); auto msg_id = queue_.new_id();
auto ptr = make_mailbox_element( auto ptr = make_mailbox_element(nullptr, make_message_id(), {},
nullptr, make_message_id(), {}, delete_atom::value, source_node, delete_atom::value, source_node,
hdr.source_actor, std::move(fail_state)); hdr.source_actor,
std::move(fail_state));
queue_.push(callee_.current_execution_unit(), msg_id, queue_.push(callee_.current_execution_unit(), msg_id,
callee_.this_actor(), std::move(ptr)); callee_.this_actor(), std::move(ptr));
} else { } else {
......
...@@ -58,9 +58,7 @@ void message_queue::push(execution_unit* ctx, uint64_t id, ...@@ -58,9 +58,7 @@ void message_queue::push(execution_unit* ctx, uint64_t id,
return; return;
} }
// Get the insertion point. // Get the insertion point.
auto pred = [&](const actor_msg& x) { auto pred = [&](const actor_msg& x) { return x.id >= id; };
return x.id >= id;
};
pending.emplace(std::find_if(first, last, pred), pending.emplace(std::find_if(first, last, pred),
actor_msg{id, std::move(receiver), std::move(content)}); actor_msg{id, std::move(receiver), std::move(content)});
} }
......
...@@ -31,11 +31,11 @@ namespace basp { ...@@ -31,11 +31,11 @@ namespace basp {
// -- constructors, destructors, and assignment operators ---------------------- // -- constructors, destructors, and assignment operators ----------------------
worker::worker(worker_hub& hub, message_queue& queue, proxy_registry& proxies) worker::worker(worker_hub& hub, message_queue& queue, proxy_registry& proxies)
: next_(nullptr), : next_(nullptr),
hub_(&hub), hub_(&hub),
queue_(&queue), queue_(&queue),
proxies_(&proxies), proxies_(&proxies),
system_(&proxies.system()) { system_(&proxies.system()) {
CAF_IGNORE_UNUSED(pad_); CAF_IGNORE_UNUSED(pad_);
} }
......
...@@ -31,11 +31,9 @@ using namespace caf; ...@@ -31,11 +31,9 @@ using namespace caf;
namespace { namespace {
behavior testee_impl() { behavior testee_impl() {
return { return {[](ok_atom, int) {
[](ok_atom, int) { // nop
// nop }};
}
};
} }
struct fixture : test_coordinator_fixture<> { struct fixture : test_coordinator_fixture<> {
...@@ -59,8 +57,7 @@ struct fixture : test_coordinator_fixture<> { ...@@ -59,8 +57,7 @@ struct fixture : test_coordinator_fixture<> {
} }
}; };
} // namespace
} // namespace <anonymous>
CAF_TEST_FIXTURE_SCOPE(message_queue_tests, fixture) CAF_TEST_FIXTURE_SCOPE(message_queue_tests, fixture)
...@@ -77,7 +74,7 @@ CAF_TEST(ascending IDs) { ...@@ -77,7 +74,7 @@ CAF_TEST(ascending IDs) {
CAF_CHECK_EQUAL(queue.next_undelivered, 0u); CAF_CHECK_EQUAL(queue.next_undelivered, 0u);
} }
CAF_TEST(push order 0-1-2) { CAF_TEST(push order 0 - 1 - 2) {
acquire_ids(3); acquire_ids(3);
push(0); push(0);
expect((ok_atom, int), from(self).to(testee).with(_, 0)); expect((ok_atom, int), from(self).to(testee).with(_, 0));
...@@ -87,7 +84,7 @@ CAF_TEST(push order 0-1-2) { ...@@ -87,7 +84,7 @@ CAF_TEST(push order 0-1-2) {
expect((ok_atom, int), from(self).to(testee).with(_, 2)); expect((ok_atom, int), from(self).to(testee).with(_, 2));
} }
CAF_TEST(push order 0-2-1) { CAF_TEST(push order 0 - 2 - 1) {
acquire_ids(3); acquire_ids(3);
push(0); push(0);
expect((ok_atom, int), from(self).to(testee).with(_, 0)); expect((ok_atom, int), from(self).to(testee).with(_, 0));
...@@ -98,7 +95,7 @@ CAF_TEST(push order 0-2-1) { ...@@ -98,7 +95,7 @@ CAF_TEST(push order 0-2-1) {
expect((ok_atom, int), from(self).to(testee).with(_, 2)); expect((ok_atom, int), from(self).to(testee).with(_, 2));
} }
CAF_TEST(push order 1-0-2) { CAF_TEST(push order 1 - 0 - 2) {
acquire_ids(3); acquire_ids(3);
push(1); push(1);
disallow((ok_atom, int), from(self).to(testee)); disallow((ok_atom, int), from(self).to(testee));
...@@ -109,8 +106,7 @@ CAF_TEST(push order 1-0-2) { ...@@ -109,8 +106,7 @@ CAF_TEST(push order 1-0-2) {
expect((ok_atom, int), from(self).to(testee).with(_, 2)); expect((ok_atom, int), from(self).to(testee).with(_, 2));
} }
CAF_TEST(push order 1 - 2 - 0) {
CAF_TEST(push order 1-2-0) {
acquire_ids(3); acquire_ids(3);
push(1); push(1);
disallow((ok_atom, int), from(self).to(testee)); disallow((ok_atom, int), from(self).to(testee));
...@@ -122,7 +118,7 @@ CAF_TEST(push order 1-2-0) { ...@@ -122,7 +118,7 @@ CAF_TEST(push order 1-2-0) {
expect((ok_atom, int), from(self).to(testee).with(_, 2)); expect((ok_atom, int), from(self).to(testee).with(_, 2));
} }
CAF_TEST(push order 2-0-1) { CAF_TEST(push order 2 - 0 - 1) {
acquire_ids(3); acquire_ids(3);
push(2); push(2);
disallow((ok_atom, int), from(self).to(testee)); disallow((ok_atom, int), from(self).to(testee));
...@@ -133,7 +129,7 @@ CAF_TEST(push order 2-0-1) { ...@@ -133,7 +129,7 @@ CAF_TEST(push order 2-0-1) {
expect((ok_atom, int), from(self).to(testee).with(_, 2)); expect((ok_atom, int), from(self).to(testee).with(_, 2));
} }
CAF_TEST(push order 2-1-0) { CAF_TEST(push order 2 - 1 - 0) {
acquire_ids(3); acquire_ids(3);
push(2); push(2);
disallow((ok_atom, int), from(self).to(testee)); disallow((ok_atom, int), from(self).to(testee));
......
...@@ -36,11 +36,9 @@ using namespace caf; ...@@ -36,11 +36,9 @@ using namespace caf;
namespace { namespace {
behavior testee_impl() { behavior testee_impl() {
return { return {[](ok_atom) {
[](ok_atom) { // nop
// nop }};
}
};
} }
class mock_actor_proxy : public actor_proxy { class mock_actor_proxy : public actor_proxy {
...@@ -61,7 +59,7 @@ public: ...@@ -61,7 +59,7 @@ public:
class mock_proxy_registry_backend : public proxy_registry::backend { class mock_proxy_registry_backend : public proxy_registry::backend {
public: public:
mock_proxy_registry_backend(actor_system& sys) : sys_(sys) { mock_proxy_registry_backend(actor_system& sys) : sys_(sys) {
//nop // nop
} }
strong_actor_ptr make_proxy(node_id nid, actor_id aid) override { strong_actor_ptr make_proxy(node_id nid, actor_id aid) override {
...@@ -86,9 +84,9 @@ struct fixture : test_coordinator_fixture<> { ...@@ -86,9 +84,9 @@ struct fixture : test_coordinator_fixture<> {
actor testee; actor testee;
fixture() fixture()
: proxies_backend(sys), : proxies_backend(sys),
proxies(sys, proxies_backend), proxies(sys, proxies_backend),
last_hop(123, "0011223344556677889900112233445566778899") { last_hop(123, "0011223344556677889900112233445566778899") {
testee = sys.spawn<lazy_init>(testee_impl); testee = sys.spawn<lazy_init>(testee_impl);
sys.registry().put(testee.id(), testee); sys.registry().put(testee.id(), testee);
} }
...@@ -98,7 +96,7 @@ struct fixture : test_coordinator_fixture<> { ...@@ -98,7 +96,7 @@ struct fixture : test_coordinator_fixture<> {
} }
}; };
} // namespace <anonymous> } // namespace
CAF_TEST_FIXTURE_SCOPE(worker_tests, fixture) CAF_TEST_FIXTURE_SCOPE(worker_tests, fixture)
......
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