Commit d098bcb5 authored by Dominik Charousset's avatar Dominik Charousset

process_information -> node_id

parent 645179ec
...@@ -167,13 +167,13 @@ set(LIBCPPA_SRC ...@@ -167,13 +167,13 @@ set(LIBCPPA_SRC
src/message_header.cpp src/message_header.cpp
src/middleman.cpp src/middleman.cpp
src/middleman_event_handler.cpp src/middleman_event_handler.cpp
src/node_id.cpp
src/object.cpp src/object.cpp
src/object_array.cpp src/object_array.cpp
src/on.cpp src/on.cpp
src/opt.cpp src/opt.cpp
src/partial_function.cpp src/partial_function.cpp
src/primitive_variant.cpp src/primitive_variant.cpp
src/process_information.cpp
src/ref_counted.cpp src/ref_counted.cpp
src/remote_actor_proxy.cpp src/remote_actor_proxy.cpp
src/response_handle.cpp src/response_handle.cpp
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#include <utility> #include <utility>
#include <functional> #include <functional>
#include "cppa/node_id.hpp"
#include "cppa/actor_proxy.hpp" #include "cppa/actor_proxy.hpp"
#include "cppa/process_information.hpp"
namespace cppa { namespace cppa {
...@@ -53,10 +53,10 @@ class actor_namespace { ...@@ -53,10 +53,10 @@ class actor_namespace {
public: public:
typedef std::function<actor_proxy_ptr(actor_id, process_information_ptr)> typedef std::function<actor_proxy_ptr(actor_id, node_id_ptr)>
factory_fun; factory_fun;
typedef std::function<void(actor_id, const process_information&)> typedef std::function<void(actor_id, const node_id&)>
new_element_callback; new_element_callback;
inline void set_proxy_factory(factory_fun fun); inline void set_proxy_factory(factory_fun fun);
...@@ -75,41 +75,41 @@ class actor_namespace { ...@@ -75,41 +75,41 @@ class actor_namespace {
/** /**
* @brief Returns the number of proxies for @p node. * @brief Returns the number of proxies for @p node.
*/ */
size_t count_proxies(const process_information& node); size_t count_proxies(const node_id& node);
/** /**
* @brief Returns the proxy instance identified by @p node and @p aid * @brief Returns the proxy instance identified by @p node and @p aid
* or @p nullptr if the actor is unknown. * or @p nullptr if the actor is unknown.
*/ */
actor_ptr get(const process_information& node, actor_id aid); actor_ptr get(const node_id& node, actor_id aid);
/** /**
* @brief Returns the proxy instance identified by @p node and @p aid * @brief Returns the proxy instance identified by @p node and @p aid
* or creates a new (default) proxy instance. * or creates a new (default) proxy instance.
*/ */
actor_ptr get_or_put(process_information_ptr node, actor_id aid); actor_ptr get_or_put(node_id_ptr node, actor_id aid);
/** /**
* @brief Stores @p proxy in the list of known actor proxies. * @brief Stores @p proxy in the list of known actor proxies.
*/ */
void put(const process_information& parent, void put(const node_id& parent,
actor_id aid, actor_id aid,
const actor_proxy_ptr& proxy); const actor_proxy_ptr& proxy);
/** /**
* @brief Returns the map of known actors for @p node. * @brief Returns the map of known actors for @p node.
*/ */
proxy_map& proxies(process_information& node); proxy_map& proxies(node_id& node);
/** /**
* @brief Deletes all proxies for @p node. * @brief Deletes all proxies for @p node.
*/ */
void erase(process_information& node); void erase(node_id& node);
/** /**
* @brief Deletes the proxy with id @p aid for @p node. * @brief Deletes the proxy with id @p aid for @p node.
*/ */
void erase(process_information& node, actor_id aid); void erase(node_id& node, actor_id aid);
private: private:
...@@ -117,9 +117,9 @@ class actor_namespace { ...@@ -117,9 +117,9 @@ class actor_namespace {
new_element_callback m_new_element_callback; new_element_callback m_new_element_callback;
process_information_ptr m_node; node_id_ptr m_node;
std::map<process_information, proxy_map> m_proxies; std::map<node_id, proxy_map> m_proxies;
}; };
......
...@@ -47,7 +47,7 @@ class message_header; ...@@ -47,7 +47,7 @@ class message_header;
class partial_function; class partial_function;
class uniform_type_info; class uniform_type_info;
class primitive_variant; class primitive_variant;
class process_information; class node_id;
// structs // structs
struct anything; struct anything;
...@@ -66,7 +66,7 @@ typedef intrusive_ptr<actor> actor_ptr; ...@@ -66,7 +66,7 @@ typedef intrusive_ptr<actor> actor_ptr;
typedef intrusive_ptr<group> group_ptr; typedef intrusive_ptr<group> group_ptr;
typedef intrusive_ptr<channel> channel_ptr; typedef intrusive_ptr<channel> channel_ptr;
typedef intrusive_ptr<actor_proxy> actor_proxy_ptr; typedef intrusive_ptr<actor_proxy> actor_proxy_ptr;
typedef intrusive_ptr<process_information> process_information_ptr; typedef intrusive_ptr<node_id> node_id_ptr;
// weak intrusive pointer typedefs // weak intrusive pointer typedefs
typedef weak_intrusive_ptr<actor_proxy> weak_actor_proxy_ptr; typedef weak_intrusive_ptr<actor_proxy> weak_actor_proxy_ptr;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "cppa/atom.hpp" #include "cppa/atom.hpp"
#include "cppa/unit.hpp" #include "cppa/unit.hpp"
#include "cppa/none.hpp" #include "cppa/none.hpp"
#include "cppa/process_information.hpp" #include "cppa/node_id.hpp"
#include "cppa/util/buffer.hpp" #include "cppa/util/buffer.hpp"
#include "cppa/util/duration.hpp" #include "cppa/util/duration.hpp"
...@@ -65,7 +65,7 @@ using mapped_type_list = util::type_list< ...@@ -65,7 +65,7 @@ using mapped_type_list = util::type_list<
actor_ptr, actor_ptr,
channel_ptr, channel_ptr,
group_ptr, group_ptr,
process_information_ptr, node_id_ptr,
io::accept_handle, io::accept_handle,
io::connection_handle, io::connection_handle,
message_header, message_header,
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include <memory> #include <memory>
#include <functional> #include <functional>
#include "cppa/node_id.hpp"
#include "cppa/cppa_fwd.hpp" #include "cppa/cppa_fwd.hpp"
#include "cppa/actor_namespace.hpp" #include "cppa/actor_namespace.hpp"
#include "cppa/process_information.hpp"
namespace cppa { namespace detail { class singleton_manager; } } namespace cppa { namespace detail { class singleton_manager; } }
...@@ -118,12 +118,12 @@ class middleman { ...@@ -118,12 +118,12 @@ class middleman {
/** /**
* @brief Registers a new peer, i.e., a new node in the network. * @brief Registers a new peer, i.e., a new node in the network.
*/ */
virtual void register_peer(const process_information& node, peer* ptr) = 0; virtual void register_peer(const node_id& node, peer* ptr) = 0;
/** /**
* @brief Returns the peer associated with given node id. * @brief Returns the peer associated with given node id.
*/ */
virtual peer* get_peer(const process_information& node) = 0; virtual peer* get_peer(const node_id& node) = 0;
/** /**
* @brief This callback is used by peer_acceptor implementations to * @brief This callback is used by peer_acceptor implementations to
...@@ -134,7 +134,7 @@ class middleman { ...@@ -134,7 +134,7 @@ class middleman {
/** /**
* @brief Delivers a message to given node. * @brief Delivers a message to given node.
*/ */
virtual void deliver(const process_information& node, virtual void deliver(const node_id& node,
const message_header& hdr, const message_header& hdr,
any_tuple msg ) = 0; any_tuple msg ) = 0;
...@@ -149,7 +149,7 @@ class middleman { ...@@ -149,7 +149,7 @@ class middleman {
*/ */
virtual void new_peer(const input_stream_ptr& in, virtual void new_peer(const input_stream_ptr& in,
const output_stream_ptr& out, const output_stream_ptr& out,
const process_information_ptr& node = nullptr) = 0; const node_id_ptr& node = nullptr) = 0;
/** /**
* @brief Adds a new acceptor for incoming connections to @p pa * @brief Adds a new acceptor for incoming connections to @p pa
...@@ -182,7 +182,7 @@ class middleman { ...@@ -182,7 +182,7 @@ class middleman {
actor_namespace m_namespace; actor_namespace m_namespace;
// the node id of this middleman // the node id of this middleman
process_information_ptr m_node; node_id_ptr m_node;
// //
std::unique_ptr<middleman_event_handler> m_handler; std::unique_ptr<middleman_event_handler> m_handler;
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
#include <cstdint> #include <cstdint>
#include "cppa/extend.hpp" #include "cppa/extend.hpp"
#include "cppa/node_id.hpp"
#include "cppa/actor_proxy.hpp" #include "cppa/actor_proxy.hpp"
#include "cppa/partial_function.hpp" #include "cppa/partial_function.hpp"
#include "cppa/type_lookup_table.hpp" #include "cppa/type_lookup_table.hpp"
#include "cppa/weak_intrusive_ptr.hpp" #include "cppa/weak_intrusive_ptr.hpp"
#include "cppa/process_information.hpp"
#include "cppa/util/buffer.hpp" #include "cppa/util/buffer.hpp"
...@@ -63,7 +63,7 @@ class peer : public extend<continuable>::with<buffered_writing> { ...@@ -63,7 +63,7 @@ class peer : public extend<continuable>::with<buffered_writing> {
peer(middleman* parent, peer(middleman* parent,
const input_stream_ptr& in, const input_stream_ptr& in,
const output_stream_ptr& out, const output_stream_ptr& out,
process_information_ptr peer_ptr = nullptr); node_id_ptr peer_ptr = nullptr);
continue_reading_result continue_reading() override; continue_reading_result continue_reading() override;
...@@ -79,7 +79,7 @@ class peer : public extend<continuable>::with<buffered_writing> { ...@@ -79,7 +79,7 @@ class peer : public extend<continuable>::with<buffered_writing> {
return m_erase_on_last_proxy_exited; return m_erase_on_last_proxy_exited;
} }
inline const process_information& node() const { inline const node_id& node() const {
return *m_node; return *m_node;
} }
...@@ -96,7 +96,7 @@ class peer : public extend<continuable>::with<buffered_writing> { ...@@ -96,7 +96,7 @@ class peer : public extend<continuable>::with<buffered_writing> {
input_stream_ptr m_in; input_stream_ptr m_in;
read_state m_state; read_state m_state;
process_information_ptr m_node; node_id_ptr m_node;
const uniform_type_info* m_meta_hdr; const uniform_type_info* m_meta_hdr;
const uniform_type_info* m_meta_msg; const uniform_type_info* m_meta_msg;
...@@ -123,9 +123,9 @@ class peer : public extend<continuable>::with<buffered_writing> { ...@@ -123,9 +123,9 @@ class peer : public extend<continuable>::with<buffered_writing> {
type_lookup_table m_incoming_types; type_lookup_table m_incoming_types;
type_lookup_table m_outgoing_types; type_lookup_table m_outgoing_types;
void monitor(const actor_ptr& sender, const process_information_ptr& node, actor_id aid); void monitor(const actor_ptr& sender, const node_id_ptr& node, actor_id aid);
void kill_proxy(const actor_ptr& sender, const process_information_ptr& node, actor_id aid, std::uint32_t reason); void kill_proxy(const actor_ptr& sender, const node_id_ptr& node, actor_id aid, std::uint32_t reason);
void link(const actor_ptr& sender, const actor_ptr& ptr); void link(const actor_ptr& sender, const actor_ptr& ptr);
......
...@@ -74,7 +74,7 @@ class remote_actor_proxy : public actor_proxy { ...@@ -74,7 +74,7 @@ class remote_actor_proxy : public actor_proxy {
public: public:
remote_actor_proxy(actor_id mid, remote_actor_proxy(actor_id mid,
const process_information_ptr& pinfo, const node_id_ptr& pinfo,
middleman* parent); middleman* parent);
void enqueue(const message_header& hdr, any_tuple msg) override; void enqueue(const message_header& hdr, any_tuple msg) override;
...@@ -93,7 +93,7 @@ class remote_actor_proxy : public actor_proxy { ...@@ -93,7 +93,7 @@ class remote_actor_proxy : public actor_proxy {
void deliver(const message_header& hdr, any_tuple msg) override; void deliver(const message_header& hdr, any_tuple msg) override;
inline const process_information_ptr& process_info() const { inline const node_id_ptr& process_info() const {
return m_pinf; return m_pinf;
} }
...@@ -106,7 +106,7 @@ class remote_actor_proxy : public actor_proxy { ...@@ -106,7 +106,7 @@ class remote_actor_proxy : public actor_proxy {
void forward_msg(const message_header& hdr, any_tuple msg); void forward_msg(const message_header& hdr, any_tuple msg);
middleman* m_parent; middleman* m_parent;
process_information_ptr m_pinf; node_id_ptr m_pinf;
intrusive::single_reader_queue<sync_request_info, detail::disposer> m_pending_requests; intrusive::single_reader_queue<sync_request_info, detail::disposer> m_pending_requests;
}; };
......
...@@ -46,8 +46,7 @@ class serializer; ...@@ -46,8 +46,7 @@ class serializer;
/** /**
* @brief Identifies a process. * @brief Identifies a process.
*/ */
class process_information : public ref_counted class node_id : public ref_counted, util::comparable<node_id> {
, util::comparable<process_information> {
typedef ref_counted super; typedef ref_counted super;
...@@ -56,31 +55,31 @@ class process_information : public ref_counted ...@@ -56,31 +55,31 @@ class process_information : public ref_counted
/** /**
* @brief @c libcppa uses 160 bit hashes (20 bytes). * @brief @c libcppa uses 160 bit hashes (20 bytes).
*/ */
static constexpr size_t node_id_size = 20; static constexpr size_t host_id_size = 20;
/** /**
* @brief Represents a 160 bit hash. * @brief Represents a 160 bit hash.
*/ */
typedef std::array<std::uint8_t, node_id_size> node_id_type; typedef std::array<std::uint8_t, host_id_size> host_id_type;
/** /**
* @brief Copy constructor. * @brief Copy constructor.
*/ */
process_information(const process_information&); node_id(const node_id&);
/** /**
* @brief Creates @c this from @p process_id and @p hash. * @brief Creates @c this from @p process_id and @p hash.
* @param process_id System-wide unique process identifier. * @param process_id System-wide unique process identifier.
* @param hash Unique node id as hexadecimal string representation. * @param hash Unique node id as hexadecimal string representation.
*/ */
process_information(std::uint32_t process_id, const std::string& hash); node_id(std::uint32_t process_id, const std::string& hash);
/** /**
* @brief Creates @c this from @p process_id and @p hash. * @brief Creates @c this from @p process_id and @p hash.
* @param process_id System-wide unique process identifier. * @param process_id System-wide unique process identifier.
* @param hash Unique node id. * @param hash Unique node id.
*/ */
process_information(std::uint32_t process_id, const node_id_type& node_id); node_id(std::uint32_t process_id, const host_id_type& node_id);
/** /**
* @brief Identifies the running process. * @brief Identifies the running process.
...@@ -93,18 +92,18 @@ class process_information : public ref_counted ...@@ -93,18 +92,18 @@ class process_information : public ref_counted
* @returns A hash build from the MAC address of the first network device * @returns A hash build from the MAC address of the first network device
* and the UUID of the root partition (mounted in "/" or "C:"). * and the UUID of the root partition (mounted in "/" or "C:").
*/ */
inline const node_id_type& node_id() const { return m_node_id; } inline const host_id_type& host_id() const { return m_host_id; }
/** /**
* @brief Returns the proccess_information for the running process. * @brief Returns the proccess_information for the running process.
* @returns A pointer to the singleton of this process. * @returns A pointer to the singleton of this process.
*/ */
static const intrusive_ptr<process_information>& get(); static const intrusive_ptr<node_id>& get();
/** @cond PRIVATE */ /** @cond PRIVATE */
// "inherited" from comparable<process_information> // "inherited" from comparable<node_id>
int compare(const process_information& other) const; int compare(const node_id& other) const;
static void serialize_invalid(serializer*); static void serialize_invalid(serializer*);
...@@ -113,46 +112,46 @@ class process_information : public ref_counted ...@@ -113,46 +112,46 @@ class process_information : public ref_counted
private: private:
std::uint32_t m_process_id; std::uint32_t m_process_id;
node_id_type m_node_id; host_id_type m_host_id;
}; };
void node_id_from_string(const std::string& hash, void host_id_from_string(const std::string& hash,
process_information::node_id_type& node_id); node_id::host_id_type& node_id);
bool equal(const std::string& hash, bool equal(const std::string& hash,
const process_information::node_id_type& node_id); const node_id::host_id_type& node_id);
inline bool equal(const process_information::node_id_type& node_id, inline bool equal(const node_id::host_id_type& node_id,
const std::string& hash) { const std::string& hash) {
return equal(hash, node_id); return equal(hash, node_id);
} }
/** /**
* @brief A smart pointer type that manages instances of * @brief A smart pointer type that manages instances of
* {@link process_information}. * {@link node_id}.
* @relates process_information * @relates node_id
*/ */
typedef intrusive_ptr<process_information> process_information_ptr; typedef intrusive_ptr<node_id> node_id_ptr;
/** /**
* @relates process_information * @relates node_id
*/ */
std::string to_string(const process_information& what); std::string to_string(const node_id& what);
/** /**
* @relates process_information * @relates node_id
*/ */
std::string to_string(const process_information_ptr& what); std::string to_string(const node_id_ptr& what);
/** /**
* @brief Converts a {@link process_information::node_id_type node_id} * @brief Converts a {@link node_id::host_id_type node_id}
* to a hexadecimal string. * to a hexadecimal string.
* @param node_id A unique node identifier. * @param node_id A unique node identifier.
* @returns A hexadecimal representation of @p node_id. * @returns A hexadecimal representation of @p node_id.
* @relates process_information * @relates node_id
*/ */
std::string to_string(const process_information::node_id_type& node_id); std::string to_string(const node_id::host_id_type& node_id);
} // namespace cppa } // namespace cppa
......
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
#include "cppa/group.hpp" #include "cppa/group.hpp"
#include "cppa/object.hpp" #include "cppa/object.hpp"
#include "cppa/channel.hpp" #include "cppa/channel.hpp"
#include "cppa/node_id.hpp"
#include "cppa/anything.hpp" #include "cppa/anything.hpp"
#include "cppa/any_tuple.hpp" #include "cppa/any_tuple.hpp"
#include "cppa/intrusive_ptr.hpp" #include "cppa/intrusive_ptr.hpp"
#include "cppa/uniform_type_info.hpp" #include "cppa/uniform_type_info.hpp"
#include "cppa/process_information.hpp"
#include "cppa/message_header.hpp" #include "cppa/message_header.hpp"
namespace std { class exception; } namespace std { class exception; }
...@@ -80,11 +80,11 @@ inline std::string to_string(const channel_ptr& what) { ...@@ -80,11 +80,11 @@ inline std::string to_string(const channel_ptr& what) {
return detail::to_string_impl(what); return detail::to_string_impl(what);
} }
// implemented in process_information.cpp // implemented in node_id.cpp
std::string to_string(const process_information& what); std::string to_string(const node_id& what);
// implemented in process_information.cpp // implemented in node_id.cpp
std::string to_string(const process_information_ptr& what); std::string to_string(const node_id_ptr& what);
inline std::string to_string(const object& what) { inline std::string to_string(const object& what) {
return detail::to_string_impl(what.value(), what.type()); return detail::to_string_impl(what.value(), what.type());
......
...@@ -45,9 +45,9 @@ namespace cppa { ...@@ -45,9 +45,9 @@ namespace cppa {
* *
* 1: {atom_value} * 1: {atom_value}
* 2: {atom_value, uint32_t} * 2: {atom_value, uint32_t}
* 3: {atom_value, process_information} * 3: {atom_value, node_id}
* 4: {atom_value, process_information, uint32_t} * 4: {atom_value, node_id, uint32_t}
* 5: {atom_value, process_information, uint32_t, uint32_t} * 5: {atom_value, node_id, uint32_t, uint32_t}
* 6: {atom_value, actor_ptr} * 6: {atom_value, actor_ptr}
* 7: {atom_value, uint32_t, string} * 7: {atom_value, uint32_t, string}
* *
......
...@@ -167,7 +167,7 @@ struct is_builtin { ...@@ -167,7 +167,7 @@ struct is_builtin {
actor_ptr, actor_ptr,
group_ptr, group_ptr,
channel_ptr, channel_ptr,
process_information_ptr node_id_ptr
>::value; >::value;
}; };
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
#include <utility> #include <utility>
#include "cppa/logging.hpp" #include "cppa/logging.hpp"
#include "cppa/node_id.hpp"
#include "cppa/serializer.hpp" #include "cppa/serializer.hpp"
#include "cppa/singletons.hpp" #include "cppa/singletons.hpp"
#include "cppa/deserializer.hpp" #include "cppa/deserializer.hpp"
#include "cppa/actor_namespace.hpp" #include "cppa/actor_namespace.hpp"
#include "cppa/process_information.hpp"
#include "cppa/io/middleman.hpp" #include "cppa/io/middleman.hpp"
#include "cppa/io/remote_actor_proxy.hpp" #include "cppa/io/remote_actor_proxy.hpp"
...@@ -49,14 +49,14 @@ void actor_namespace::write(serializer* sink, const actor_ptr& ptr) { ...@@ -49,14 +49,14 @@ void actor_namespace::write(serializer* sink, const actor_ptr& ptr) {
if (ptr == nullptr) { if (ptr == nullptr) {
CPPA_LOG_DEBUG("serialize nullptr"); CPPA_LOG_DEBUG("serialize nullptr");
sink->write_value(static_cast<actor_id>(0)); sink->write_value(static_cast<actor_id>(0));
process_information::serialize_invalid(sink); node_id::serialize_invalid(sink);
} }
else { else {
// local actor? // local actor?
if (!ptr->is_proxy()) { if (!ptr->is_proxy()) {
get_actor_registry()->put(ptr->id(), ptr); get_actor_registry()->put(ptr->id(), ptr);
} }
auto pinf = process_information::get(); auto pinf = node_id::get();
if (ptr->is_proxy()) { if (ptr->is_proxy()) {
auto dptr = ptr.downcast<io::remote_actor_proxy>(); auto dptr = ptr.downcast<io::remote_actor_proxy>();
if (dptr) pinf = dptr->process_info(); if (dptr) pinf = dptr->process_info();
...@@ -64,38 +64,38 @@ void actor_namespace::write(serializer* sink, const actor_ptr& ptr) { ...@@ -64,38 +64,38 @@ void actor_namespace::write(serializer* sink, const actor_ptr& ptr) {
} }
sink->write_value(ptr->id()); sink->write_value(ptr->id());
sink->write_value(pinf->process_id()); sink->write_value(pinf->process_id());
sink->write_raw(process_information::node_id_size, sink->write_raw(node_id::host_id_size,
pinf->node_id().data()); pinf->host_id().data());
} }
} }
actor_ptr actor_namespace::read(deserializer* source) { actor_ptr actor_namespace::read(deserializer* source) {
CPPA_REQUIRE(source != nullptr); CPPA_REQUIRE(source != nullptr);
process_information::node_id_type nid; node_id::host_id_type nid;
auto aid = source->read<uint32_t>(); auto aid = source->read<uint32_t>();
auto pid = source->read<uint32_t>(); auto pid = source->read<uint32_t>();
source->read_raw(process_information::node_id_size, nid.data()); source->read_raw(node_id::host_id_size, nid.data());
// local actor? // local actor?
auto pinf = process_information::get(); auto pinf = node_id::get();
if (aid == 0 && pid == 0) { if (aid == 0 && pid == 0) {
return nullptr; return nullptr;
} }
else if (pid == pinf->process_id() && nid == pinf->node_id()) { else if (pid == pinf->process_id() && nid == pinf->host_id()) {
return get_actor_registry()->get(aid); return get_actor_registry()->get(aid);
} }
else { else {
process_information_ptr tmp = new process_information{pid, nid}; node_id_ptr tmp = new node_id{pid, nid};
return get_or_put(tmp, aid); return get_or_put(tmp, aid);
} }
return nullptr; return nullptr;
} }
size_t actor_namespace::count_proxies(const process_information& node) { size_t actor_namespace::count_proxies(const node_id& node) {
auto i = m_proxies.find(node); auto i = m_proxies.find(node);
return (i != m_proxies.end()) ? i->second.size() : 0; return (i != m_proxies.end()) ? i->second.size() : 0;
} }
actor_ptr actor_namespace::get(const process_information& node, actor_id aid) { actor_ptr actor_namespace::get(const node_id& node, actor_id aid) {
auto& submap = m_proxies[node]; auto& submap = m_proxies[node];
auto i = submap.find(aid); auto i = submap.find(aid);
if (i != submap.end()) { if (i != submap.end()) {
...@@ -109,7 +109,7 @@ actor_ptr actor_namespace::get(const process_information& node, actor_id aid) { ...@@ -109,7 +109,7 @@ actor_ptr actor_namespace::get(const process_information& node, actor_id aid) {
return nullptr; return nullptr;
} }
actor_ptr actor_namespace::get_or_put(process_information_ptr node, actor_id aid) { actor_ptr actor_namespace::get_or_put(node_id_ptr node, actor_id aid) {
auto result = get(*node, aid); auto result = get(*node, aid);
if (result == nullptr && m_factory) { if (result == nullptr && m_factory) {
auto ptr = m_factory(aid, node); auto ptr = m_factory(aid, node);
...@@ -119,7 +119,7 @@ actor_ptr actor_namespace::get_or_put(process_information_ptr node, actor_id aid ...@@ -119,7 +119,7 @@ actor_ptr actor_namespace::get_or_put(process_information_ptr node, actor_id aid
return result; return result;
} }
void actor_namespace::put(const process_information& node, void actor_namespace::put(const node_id& node,
actor_id aid, actor_id aid,
const actor_proxy_ptr& proxy) { const actor_proxy_ptr& proxy) {
auto& submap = m_proxies[node]; auto& submap = m_proxies[node];
...@@ -131,7 +131,7 @@ void actor_namespace::put(const process_information& node, ...@@ -131,7 +131,7 @@ void actor_namespace::put(const process_information& node,
m_parent->enqueue(node, m_parent->enqueue(node,
{nullptr, nullptr}, {nullptr, nullptr},
make_any_tuple(atom("MONITOR"), make_any_tuple(atom("MONITOR"),
process_information::get(), node_id::get(),
aid)); aid));
}*/ }*/
} }
...@@ -141,16 +141,16 @@ void actor_namespace::put(const process_information& node, ...@@ -141,16 +141,16 @@ void actor_namespace::put(const process_information& node,
} }
} }
auto actor_namespace::proxies(process_information& node) -> proxy_map& { auto actor_namespace::proxies(node_id& node) -> proxy_map& {
return m_proxies[node]; return m_proxies[node];
} }
void actor_namespace::erase(process_information& inf) { void actor_namespace::erase(node_id& inf) {
CPPA_LOGMF(CPPA_TRACE, self, CPPA_TARG(inf, to_string)); CPPA_LOGMF(CPPA_TRACE, self, CPPA_TARG(inf, to_string));
m_proxies.erase(inf); m_proxies.erase(inf);
} }
void actor_namespace::erase(process_information& inf, actor_id aid) { void actor_namespace::erase(node_id& inf, actor_id aid) {
CPPA_LOGMF(CPPA_TRACE, self, CPPA_TARG(inf, to_string) << ", " << CPPA_ARG(aid)); CPPA_LOGMF(CPPA_TRACE, self, CPPA_TARG(inf, to_string) << ", " << CPPA_ARG(aid));
auto i = m_proxies.find(inf); auto i = m_proxies.find(inf);
if (i != m_proxies.end()) { if (i != m_proxies.end()) {
......
...@@ -278,7 +278,7 @@ class local_group_module : public group::module { ...@@ -278,7 +278,7 @@ class local_group_module : public group::module {
public: public:
local_group_module() local_group_module()
: super("local"), m_process(process_information::get()) : super("local"), m_process(node_id::get())
, m_actor_utype(uniform_typeid<actor_ptr>()){ } , m_actor_utype(uniform_typeid<actor_ptr>()){ }
group_ptr get(const string& identifier) { group_ptr get(const string& identifier) {
...@@ -333,13 +333,13 @@ class local_group_module : public group::module { ...@@ -333,13 +333,13 @@ class local_group_module : public group::module {
m_actor_utype->serialize(&ptr->broker(), sink); m_actor_utype->serialize(&ptr->broker(), sink);
} }
inline const process_information& process() const { inline const node_id& process() const {
return *m_process; return *m_process;
} }
private: private:
process_information_ptr m_process; node_id_ptr m_process;
const uniform_type_info* m_actor_utype; const uniform_type_info* m_actor_utype;
util::shared_spinlock m_instances_mtx; util::shared_spinlock m_instances_mtx;
map<string, local_group_ptr> m_instances; map<string, local_group_ptr> m_instances;
......
...@@ -41,13 +41,13 @@ ...@@ -41,13 +41,13 @@
#include "cppa/match.hpp" #include "cppa/match.hpp"
#include "cppa/config.hpp" #include "cppa/config.hpp"
#include "cppa/logging.hpp" #include "cppa/logging.hpp"
#include "cppa/node_id.hpp"
#include "cppa/to_string.hpp" #include "cppa/to_string.hpp"
#include "cppa/actor_proxy.hpp" #include "cppa/actor_proxy.hpp"
#include "cppa/binary_serializer.hpp" #include "cppa/binary_serializer.hpp"
#include "cppa/uniform_type_info.hpp" #include "cppa/uniform_type_info.hpp"
#include "cppa/thread_mapped_actor.hpp" #include "cppa/thread_mapped_actor.hpp"
#include "cppa/binary_deserializer.hpp" #include "cppa/binary_deserializer.hpp"
#include "cppa/process_information.hpp"
#include "cppa/util/buffer.hpp" #include "cppa/util/buffer.hpp"
...@@ -130,14 +130,14 @@ class middleman_impl : public middleman { ...@@ -130,14 +130,14 @@ class middleman_impl : public middleman {
middleman_impl() : m_done(false) { middleman_impl() : m_done(false) {
m_handler = middleman_event_handler::create(); m_handler = middleman_event_handler::create();
m_namespace.set_proxy_factory([=](actor_id aid, process_information_ptr ptr) { m_namespace.set_proxy_factory([=](actor_id aid, node_id_ptr ptr) {
return make_counted<remote_actor_proxy>(aid, std::move(ptr), this); return make_counted<remote_actor_proxy>(aid, std::move(ptr), this);
}); });
m_namespace.set_new_element_callback([=](actor_id aid, const process_information& node) { m_namespace.set_new_element_callback([=](actor_id aid, const node_id& node) {
deliver(node, deliver(node,
{nullptr, nullptr}, {nullptr, nullptr},
make_any_tuple(atom("MONITOR"), make_any_tuple(atom("MONITOR"),
process_information::get(), node_id::get(),
aid)); aid));
}); });
} }
...@@ -150,7 +150,7 @@ class middleman_impl : public middleman { ...@@ -150,7 +150,7 @@ class middleman_impl : public middleman {
static_cast<void>(::write(m_pipe_write, &dummy, sizeof(dummy))); static_cast<void>(::write(m_pipe_write, &dummy, sizeof(dummy)));
} }
void register_peer(const process_information& node, peer* ptr) override { void register_peer(const node_id& node, peer* ptr) override {
CPPA_LOG_TRACE("node = " << to_string(node) << ", ptr = " << ptr); CPPA_LOG_TRACE("node = " << to_string(node) << ", ptr = " << ptr);
auto& entry = m_peers[node]; auto& entry = m_peers[node];
if (entry.impl == nullptr) { if (entry.impl == nullptr) {
...@@ -169,7 +169,7 @@ class middleman_impl : public middleman { ...@@ -169,7 +169,7 @@ class middleman_impl : public middleman {
} }
} }
peer* get_peer(const process_information& node) override { peer* get_peer(const node_id& node) override {
CPPA_LOG_TRACE("n = " << to_string(n)); CPPA_LOG_TRACE("n = " << to_string(n));
auto i = m_peers.find(node); auto i = m_peers.find(node);
if (i != m_peers.end()) { if (i != m_peers.end()) {
...@@ -193,7 +193,7 @@ class middleman_impl : public middleman { ...@@ -193,7 +193,7 @@ class middleman_impl : public middleman {
} }
} }
void deliver(const process_information& node, void deliver(const node_id& node,
const message_header& hdr, const message_header& hdr,
any_tuple msg ) override { any_tuple msg ) override {
auto& entry = m_peers[node]; auto& entry = m_peers[node];
...@@ -230,7 +230,7 @@ class middleman_impl : public middleman { ...@@ -230,7 +230,7 @@ class middleman_impl : public middleman {
void new_peer(const input_stream_ptr& in, void new_peer(const input_stream_ptr& in,
const output_stream_ptr& out, const output_stream_ptr& out,
const process_information_ptr& node = nullptr) override { const node_id_ptr& node = nullptr) override {
CPPA_LOG_TRACE(""); CPPA_LOG_TRACE("");
auto ptr = new peer(this, in, out, node); auto ptr = new peer(this, in, out, node);
continue_reader(ptr); continue_reader(ptr);
...@@ -289,7 +289,7 @@ class middleman_impl : public middleman { ...@@ -289,7 +289,7 @@ class middleman_impl : public middleman {
}; };
std::map<actor_ptr, std::vector<peer_acceptor*>> m_acceptors; std::map<actor_ptr, std::vector<peer_acceptor*>> m_acceptors;
std::map<process_information, peer_entry> m_peers; std::map<node_id, peer_entry> m_peers;
}; };
...@@ -355,7 +355,7 @@ void middleman_loop(middleman_impl* impl) { ...@@ -355,7 +355,7 @@ void middleman_loop(middleman_impl* impl) {
middleman_event_handler* handler = impl->m_handler.get(); middleman_event_handler* handler = impl->m_handler.get();
CPPA_LOGF_TRACE("run middleman loop"); CPPA_LOGF_TRACE("run middleman loop");
CPPA_LOGF_INFO("middleman runs at " CPPA_LOGF_INFO("middleman runs at "
<< to_string(*process_information::get())); << to_string(*node_id::get()));
handler->init(); handler->init();
impl->continue_reader(new middleman_overseer(impl->m_pipe_read, impl->m_queue)); impl->continue_reader(new middleman_overseer(impl->m_pipe_read, impl->m_queue));
handler->update(); handler->update();
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include <sys/types.h> #include <sys/types.h>
#include "cppa/config.hpp" #include "cppa/config.hpp"
#include "cppa/node_id.hpp"
#include "cppa/serializer.hpp" #include "cppa/serializer.hpp"
#include "cppa/primitive_variant.hpp" #include "cppa/primitive_variant.hpp"
#include "cppa/process_information.hpp"
#include "cppa/util/algorithm.hpp" #include "cppa/util/algorithm.hpp"
#include "cppa/util/ripemd_160.hpp" #include "cppa/util/ripemd_160.hpp"
...@@ -47,17 +47,17 @@ ...@@ -47,17 +47,17 @@
namespace { namespace {
cppa::process_information* compute_proc_info() { cppa::node_id* compute_proc_info() {
using namespace cppa::util; using namespace cppa::util;
auto macs = get_mac_addresses(); auto macs = get_mac_addresses();
auto hd_serial_and_mac_addr = join(macs.begin(), macs.end()) auto hd_serial_and_mac_addr = join(macs.begin(), macs.end())
+ get_root_uuid(); + get_root_uuid();
cppa::process_information::node_id_type node_id; cppa::node_id::host_id_type node_id;
ripemd_160(node_id, hd_serial_and_mac_addr); ripemd_160(node_id, hd_serial_and_mac_addr);
return new cppa::process_information(getpid(), node_id); return new cppa::node_id(getpid(), node_id);
} }
cppa::process_information_ptr s_pinfo; cppa::node_id_ptr s_pinfo;
struct pinfo_manager { struct pinfo_manager {
pinfo_manager() { pinfo_manager() {
...@@ -87,8 +87,8 @@ std::uint8_t hex_char_value(char c) { ...@@ -87,8 +87,8 @@ std::uint8_t hex_char_value(char c) {
namespace cppa { namespace cppa {
void node_id_from_string(const std::string& hash, void host_id_from_string(const std::string& hash,
process_information::node_id_type& node_id) { node_id::host_id_type& node_id) {
if (hash.size() != (node_id.size() * 2)) { if (hash.size() != (node_id.size() * 2)) {
throw std::invalid_argument("string argument is not a node id hash"); throw std::invalid_argument("string argument is not a node id hash");
} }
...@@ -102,7 +102,7 @@ void node_id_from_string(const std::string& hash, ...@@ -102,7 +102,7 @@ void node_id_from_string(const std::string& hash,
} }
bool equal(const std::string& hash, bool equal(const std::string& hash,
const process_information::node_id_type& node_id) { const node_id::host_id_type& node_id) {
if (hash.size() != (node_id.size() * 2)) { if (hash.size() != (node_id.size() * 2)) {
return false; return false;
} }
...@@ -124,36 +124,36 @@ bool equal(const std::string& hash, ...@@ -124,36 +124,36 @@ bool equal(const std::string& hash,
return true; return true;
} }
process_information::process_information(const process_information& other) node_id::node_id(const node_id& other)
: super(), m_process_id(other.process_id()), m_node_id(other.node_id()) { } : super(), m_process_id(other.process_id()), m_host_id(other.host_id()) { }
process_information::process_information(std::uint32_t a, const std::string& b) node_id::node_id(std::uint32_t a, const std::string& b)
: m_process_id(a) { : m_process_id(a) {
node_id_from_string(b, m_node_id); host_id_from_string(b, m_host_id);
} }
process_information::process_information(std::uint32_t a, const node_id_type& b) node_id::node_id(std::uint32_t a, const host_id_type& b)
: m_process_id(a), m_node_id(b) { } : m_process_id(a), m_host_id(b) { }
std::string to_string(const process_information::node_id_type& node_id) { std::string to_string(const node_id::host_id_type& node_id) {
std::ostringstream oss; std::ostringstream oss;
oss << std::hex; oss << std::hex;
oss.fill('0'); oss.fill('0');
for (size_t i = 0; i < process_information::node_id_size; ++i) { for (size_t i = 0; i < node_id::host_id_size; ++i) {
oss.width(2); oss.width(2);
oss << static_cast<std::uint32_t>(node_id[i]); oss << static_cast<std::uint32_t>(node_id[i]);
} }
return oss.str(); return oss.str();
} }
const intrusive_ptr<process_information>& process_information::get() { const intrusive_ptr<node_id>& node_id::get() {
return s_pinfo; return s_pinfo;
} }
int process_information::compare(const process_information& other) const { int node_id::compare(const node_id& other) const {
int tmp = strncmp(reinterpret_cast<const char*>(node_id().data()), int tmp = strncmp(reinterpret_cast<const char*>(host_id().data()),
reinterpret_cast<const char*>(other.node_id().data()), reinterpret_cast<const char*>(other.host_id().data()),
node_id_size); host_id_size);
if (tmp == 0) { if (tmp == 0) {
if (m_process_id < other.process_id()) return -1; if (m_process_id < other.process_id()) return -1;
else if (m_process_id == other.process_id()) return 0; else if (m_process_id == other.process_id()) return 0;
...@@ -162,20 +162,20 @@ int process_information::compare(const process_information& other) const { ...@@ -162,20 +162,20 @@ int process_information::compare(const process_information& other) const {
return tmp; return tmp;
} }
void process_information::serialize_invalid(serializer* sink) { void node_id::serialize_invalid(serializer* sink) {
sink->write_value(static_cast<uint32_t>(0)); sink->write_value(static_cast<uint32_t>(0));
process_information::node_id_type zero; node_id::host_id_type zero;
std::fill(zero.begin(), zero.end(), 0); std::fill(zero.begin(), zero.end(), 0);
sink->write_raw(process_information::node_id_size, zero.data()); sink->write_raw(node_id::host_id_size, zero.data());
} }
std::string to_string(const process_information& what) { std::string to_string(const node_id& what) {
std::ostringstream oss; std::ostringstream oss;
oss << what.process_id() << "@" << to_string(what.node_id()); oss << what.process_id() << "@" << to_string(what.host_id());
return oss.str(); return oss.str();
} }
std::string to_string(const process_information_ptr& what) { std::string to_string(const node_id_ptr& what) {
std::ostringstream oss; std::ostringstream oss;
oss << "@process_info("; oss << "@process_info(";
if (!what) oss << "null"; if (!what) oss << "null";
......
...@@ -61,12 +61,12 @@ namespace cppa { namespace io { ...@@ -61,12 +61,12 @@ namespace cppa { namespace io {
peer::peer(middleman* parent, peer::peer(middleman* parent,
const input_stream_ptr& in, const input_stream_ptr& in,
const output_stream_ptr& out, const output_stream_ptr& out,
process_information_ptr peer_ptr) node_id_ptr peer_ptr)
: super(parent, out, in->read_handle(), out->write_handle()) : super(parent, out, in->read_handle(), out->write_handle())
, m_in(in), m_state((peer_ptr) ? wait_for_msg_size : wait_for_process_info) , m_in(in), m_state((peer_ptr) ? wait_for_msg_size : wait_for_process_info)
, m_node(peer_ptr) { , m_node(peer_ptr) {
m_rd_buf.final_size( m_state == wait_for_process_info m_rd_buf.final_size( m_state == wait_for_process_info
? sizeof(uint32_t) + process_information::node_id_size ? sizeof(uint32_t) + node_id::host_id_size
: sizeof(uint32_t)); : sizeof(uint32_t));
// state == wait_for_msg_size iff peer was created using remote_peer() // state == wait_for_msg_size iff peer was created using remote_peer()
// in this case, this peer must be erased if no proxy of it remains // in this case, this peer must be erased if no proxy of it remains
...@@ -105,12 +105,12 @@ continue_reading_result peer::continue_reading() { ...@@ -105,12 +105,12 @@ continue_reading_result peer::continue_reading() {
//DEBUG("peer_connection::continue_reading: " //DEBUG("peer_connection::continue_reading: "
// "wait_for_process_info"); // "wait_for_process_info");
uint32_t process_id; uint32_t process_id;
process_information::node_id_type node_id; node_id::host_id_type host_id;
memcpy(&process_id, m_rd_buf.data(), sizeof(uint32_t)); memcpy(&process_id, m_rd_buf.data(), sizeof(uint32_t));
memcpy(node_id.data(), m_rd_buf.offset_data(sizeof(uint32_t)), memcpy(host_id.data(), m_rd_buf.offset_data(sizeof(uint32_t)),
process_information::node_id_size); node_id::host_id_size);
m_node.reset(new process_information(process_id, node_id)); m_node.reset(new node_id(process_id, host_id));
if (*process_information::get() == *m_node) { if (*node_id::get() == *m_node) {
std::cerr << "*** middleman warning: " std::cerr << "*** middleman warning: "
"incoming connection from self" "incoming connection from self"
<< std::endl; << std::endl;
...@@ -154,10 +154,10 @@ continue_reading_result peer::continue_reading() { ...@@ -154,10 +154,10 @@ continue_reading_result peer::continue_reading() {
// monitor messages are sent automatically whenever // monitor messages are sent automatically whenever
// actor_proxy_cache creates a new proxy // actor_proxy_cache creates a new proxy
// note: aid is the *original* actor id // note: aid is the *original* actor id
on(atom("MONITOR"), arg_match) >> [&](const process_information_ptr& node, actor_id aid) { on(atom("MONITOR"), arg_match) >> [&](const node_id_ptr& node, actor_id aid) {
monitor(hdr.sender, node, aid); monitor(hdr.sender, node, aid);
}, },
on(atom("KILL_PROXY"), arg_match) >> [&](const process_information_ptr& node, actor_id aid, std::uint32_t reason) { on(atom("KILL_PROXY"), arg_match) >> [&](const node_id_ptr& node, actor_id aid, std::uint32_t reason) {
kill_proxy(hdr.sender, node, aid, reason); kill_proxy(hdr.sender, node, aid, reason);
}, },
on(atom("LINK"), arg_match) >> [&](const actor_ptr& ptr) { on(atom("LINK"), arg_match) >> [&](const actor_ptr& ptr) {
...@@ -189,7 +189,7 @@ continue_reading_result peer::continue_reading() { ...@@ -189,7 +189,7 @@ continue_reading_result peer::continue_reading() {
} }
void peer::monitor(const actor_ptr&, void peer::monitor(const actor_ptr&,
const process_information_ptr& node, const node_id_ptr& node,
actor_id aid) { actor_id aid) {
CPPA_LOG_TRACE(CPPA_MARG(node, get) << ", " << CPPA_ARG(aid)); CPPA_LOG_TRACE(CPPA_MARG(node, get) << ", " << CPPA_ARG(aid));
if (!node) { if (!node) {
...@@ -197,7 +197,7 @@ void peer::monitor(const actor_ptr&, ...@@ -197,7 +197,7 @@ void peer::monitor(const actor_ptr&,
return; return;
} }
auto entry = get_actor_registry()->get_entry(aid); auto entry = get_actor_registry()->get_entry(aid);
auto pself = process_information::get(); auto pself = node_id::get();
if (*node == *pself) { if (*node == *pself) {
CPPA_LOGMF(CPPA_ERROR, self, "received 'MONITOR' from pself"); CPPA_LOGMF(CPPA_ERROR, self, "received 'MONITOR' from pself");
...@@ -233,7 +233,7 @@ void peer::monitor(const actor_ptr&, ...@@ -233,7 +233,7 @@ void peer::monitor(const actor_ptr&,
} }
void peer::kill_proxy(const actor_ptr& sender, void peer::kill_proxy(const actor_ptr& sender,
const process_information_ptr& node, const node_id_ptr& node,
actor_id aid, actor_id aid,
std::uint32_t reason) { std::uint32_t reason) {
CPPA_LOG_TRACE(CPPA_TARG(sender, to_string) CPPA_LOG_TRACE(CPPA_TARG(sender, to_string)
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <exception> #include <exception>
#include "cppa/logging.hpp" #include "cppa/logging.hpp"
#include "cppa/node_id.hpp"
#include "cppa/to_string.hpp" #include "cppa/to_string.hpp"
#include "cppa/process_information.hpp"
#include "cppa/io/peer.hpp" #include "cppa/io/peer.hpp"
#include "cppa/io/peer_acceptor.hpp" #include "cppa/io/peer_acceptor.hpp"
...@@ -61,14 +61,14 @@ continue_reading_result peer_acceptor::continue_reading() { ...@@ -61,14 +61,14 @@ continue_reading_result peer_acceptor::continue_reading() {
} }
if (opt) { if (opt) {
auto& pair = *opt; auto& pair = *opt;
auto& pself = process_information::get(); auto& pself = node_id::get();
uint32_t process_id = pself->process_id(); uint32_t process_id = pself->process_id();
try { try {
actor_id aid = published_actor()->id(); actor_id aid = published_actor()->id();
pair.second->write(&aid, sizeof(actor_id)); pair.second->write(&aid, sizeof(actor_id));
pair.second->write(&process_id, sizeof(uint32_t)); pair.second->write(&process_id, sizeof(uint32_t));
pair.second->write(pself->node_id().data(), pair.second->write(pself->host_id().data(),
pself->node_id().size()); pself->host_id().size());
m_parent->new_peer(pair.first, pair.second); m_parent->new_peer(pair.first, pair.second);
} }
catch (exception& e) { catch (exception& e) {
......
...@@ -52,7 +52,7 @@ sync_request_info::sync_request_info(actor_ptr sptr, message_id id) ...@@ -52,7 +52,7 @@ sync_request_info::sync_request_info(actor_ptr sptr, message_id id)
: next(nullptr), sender(std::move(sptr)), mid(id) { } : next(nullptr), sender(std::move(sptr)), mid(id) { }
remote_actor_proxy::remote_actor_proxy(actor_id mid, remote_actor_proxy::remote_actor_proxy(actor_id mid,
const process_information_ptr& pinfo, const node_id_ptr& pinfo,
middleman* parent) middleman* parent)
: super(mid), m_parent(parent), m_pinf(pinfo) { : super(mid), m_parent(parent), m_pinf(pinfo) {
CPPA_REQUIRE(parent != nullptr); CPPA_REQUIRE(parent != nullptr);
......
...@@ -80,18 +80,18 @@ void publish(actor_ptr whom, std::uint16_t port, const char* addr) { ...@@ -80,18 +80,18 @@ void publish(actor_ptr whom, std::uint16_t port, const char* addr) {
actor_ptr remote_actor(stream_ptr_pair io) { actor_ptr remote_actor(stream_ptr_pair io) {
CPPA_LOG_TRACE("io{" << io.first.get() << ", " << io.second.get() << "}"); CPPA_LOG_TRACE("io{" << io.first.get() << ", " << io.second.get() << "}");
auto pinf = process_information::get(); auto pinf = node_id::get();
std::uint32_t process_id = pinf->process_id(); std::uint32_t process_id = pinf->process_id();
// throws on error // throws on error
io.second->write(&process_id, sizeof(std::uint32_t)); io.second->write(&process_id, sizeof(std::uint32_t));
io.second->write(pinf->node_id().data(), pinf->node_id().size()); io.second->write(pinf->host_id().data(), pinf->host_id().size());
actor_id remote_aid; actor_id remote_aid;
std::uint32_t peer_pid; std::uint32_t peer_pid;
process_information::node_id_type peer_node_id; node_id::host_id_type peer_node_id;
io.first->read(&remote_aid, sizeof(actor_id)); io.first->read(&remote_aid, sizeof(actor_id));
io.first->read(&peer_pid, sizeof(std::uint32_t)); io.first->read(&peer_pid, sizeof(std::uint32_t));
io.first->read(peer_node_id.data(), peer_node_id.size()); io.first->read(peer_node_id.data(), peer_node_id.size());
auto pinfptr = make_counted<process_information>(peer_pid, peer_node_id); auto pinfptr = make_counted<node_id>(peer_pid, peer_node_id);
if (*pinf == *pinfptr) { if (*pinf == *pinfptr) {
// this is a local actor, not a remote actor // this is a local actor, not a remote actor
CPPA_LOGF_WARNING("remote_actor() called to access a local actor"); CPPA_LOGF_WARNING("remote_actor() called to access a local actor");
......
...@@ -63,7 +63,7 @@ namespace cppa { namespace detail { ...@@ -63,7 +63,7 @@ namespace cppa { namespace detail {
{ "cppa::intrusive_ptr<cppa::actor>", "@actor" }, { "cppa::intrusive_ptr<cppa::actor>", "@actor" },
{ "cppa::intrusive_ptr<cppa::channel>", "@channel" }, { "cppa::intrusive_ptr<cppa::channel>", "@channel" },
{ "cppa::intrusive_ptr<cppa::group>", "@group" }, { "cppa::intrusive_ptr<cppa::group>", "@group" },
{ "cppa::intrusive_ptr<cppa::process_information>", "@proc"}, { "cppa::intrusive_ptr<cppa::node_id>", "@proc"},
{ "cppa::io::accept_handle", "@ac_hdl" }, { "cppa::io::accept_handle", "@ac_hdl" },
{ "cppa::io::connection_handle", "@cn_hdl" }, { "cppa::io::connection_handle", "@cn_hdl" },
{ "cppa::message_header", "@header" }, { "cppa::message_header", "@header" },
...@@ -292,26 +292,26 @@ void deserialize_impl(message_header& hdr, deserializer* source) { ...@@ -292,26 +292,26 @@ void deserialize_impl(message_header& hdr, deserializer* source) {
hdr.id = message_id::from_integer_value(source->read<std::uint64_t>()); hdr.id = message_id::from_integer_value(source->read<std::uint64_t>());
} }
void serialize_impl(const process_information_ptr& ptr, serializer* sink) { void serialize_impl(const node_id_ptr& ptr, serializer* sink) {
if (ptr == nullptr) { if (ptr == nullptr) {
process_information::serialize_invalid(sink); node_id::serialize_invalid(sink);
} }
else { else {
sink->write_value(ptr->process_id()); sink->write_value(ptr->process_id());
sink->write_raw(ptr->node_id().size(), ptr->node_id().data()); sink->write_raw(ptr->host_id().size(), ptr->host_id().data());
} }
} }
void deserialize_impl(process_information_ptr& ptr, deserializer* source) { void deserialize_impl(node_id_ptr& ptr, deserializer* source) {
process_information::node_id_type nid; node_id::host_id_type nid;
auto pid = source->read<uint32_t>(); auto pid = source->read<uint32_t>();
source->read_raw(process_information::node_id_size, nid.data()); source->read_raw(node_id::host_id_size, nid.data());
auto is_zero = [](uint8_t value) { return value == 0; }; auto is_zero = [](uint8_t value) { return value == 0; };
if (pid == 0 && std::all_of(nid.begin(), nid.end(), is_zero)) { if (pid == 0 && std::all_of(nid.begin(), nid.end(), is_zero)) {
// invalid process information (nullptr) // invalid process information (nullptr)
ptr.reset(); ptr.reset();
} }
else ptr.reset(new process_information{pid, nid}); else ptr.reset(new node_id{pid, nid});
} }
inline void serialize_impl(const atom_value& val, serializer* sink) { inline void serialize_impl(const atom_value& val, serializer* sink) {
...@@ -753,9 +753,9 @@ class utim_impl : public uniform_type_info_map { ...@@ -753,9 +753,9 @@ class utim_impl : public uniform_type_info_map {
// insert default hints // insert default hints
push_hint<atom_value>(this); push_hint<atom_value>(this);
push_hint<atom_value, std::uint32_t>(this); push_hint<atom_value, std::uint32_t>(this);
push_hint<atom_value, process_information_ptr>(this); push_hint<atom_value, node_id_ptr>(this);
push_hint<atom_value, actor_ptr>(this); push_hint<atom_value, actor_ptr>(this);
push_hint<atom_value, process_information_ptr, std::uint32_t, std::uint32_t>(this); push_hint<atom_value, node_id_ptr, std::uint32_t, std::uint32_t>(this);
push_hint<atom_value, std::uint32_t, std::string>(this); push_hint<atom_value, std::uint32_t, std::string>(this);
} }
...@@ -819,7 +819,7 @@ class utim_impl : public uniform_type_info_map { ...@@ -819,7 +819,7 @@ class utim_impl : public uniform_type_info_map {
typedef std::map<std::string, std::string> strmap; typedef std::map<std::string, std::string> strmap;
uti_impl<process_information_ptr> m_type_proc; uti_impl<node_id_ptr> m_type_proc;
uti_impl<io::accept_handle> m_ac_hdl; uti_impl<io::accept_handle> m_ac_hdl;
uti_impl<io::connection_handle> m_cn_hdl; uti_impl<io::connection_handle> m_cn_hdl;
uti_impl<channel_ptr> m_type_channel; uti_impl<channel_ptr> m_type_channel;
......
...@@ -170,7 +170,7 @@ int main() { ...@@ -170,7 +170,7 @@ int main() {
actor_namespace addressing; actor_namespace addressing;
cout << "process id: " << to_string(process_information::get()) << endl; cout << "process id: " << to_string(node_id::get()) << endl;
auto oarr = new detail::object_array; auto oarr = new detail::object_array;
oarr->push_back(object::from(static_cast<uint32_t>(42))); oarr->push_back(object::from(static_cast<uint32_t>(42)));
......
...@@ -89,14 +89,14 @@ int main() { ...@@ -89,14 +89,14 @@ int main() {
"@actor", // actor_ptr "@actor", // actor_ptr
"@group", // group_ptr "@group", // group_ptr
"@channel", // channel_ptr "@channel", // channel_ptr
"@proc", // intrusive_ptr<process_information> "@proc", // intrusive_ptr<node_id>
"@duration", // util::duration "@duration", // util::duration
"@buffer", // util::buffer "@buffer", // util::buffer
// default announced cpap tuples // default announced cpap tuples
"@<>+@atom", // {atom_value} "@<>+@atom", // {atom_value}
"@<>+@atom+@actor", // {atom_value, actor_ptr} "@<>+@atom+@actor", // {atom_value, actor_ptr}
"@<>+@atom+@proc", // {atom_value, process_information} "@<>+@atom+@proc", // {atom_value, node_id}
"@<>+@atom+@proc+@u32+@u32", // {atom_value, process_information, uint32_t, uint32_t} "@<>+@atom+@proc+@u32+@u32", // {atom_value, node_id, uint32_t, uint32_t}
"@<>+@atom+@u32", // {atom_value, uint32_t} "@<>+@atom+@u32", // {atom_value, uint32_t}
"@<>+@atom+@u32+@str" // {atom_value, uint32_t, std::string} "@<>+@atom+@u32+@str" // {atom_value, uint32_t, std::string}
}; };
...@@ -135,7 +135,7 @@ int main() { ...@@ -135,7 +135,7 @@ int main() {
float, double, float, double,
atom_value, any_tuple, message_header, atom_value, any_tuple, message_header,
actor_ptr, group_ptr, actor_ptr, group_ptr,
channel_ptr, process_information_ptr channel_ptr, node_id_ptr
>::arr; >::arr;
CPPA_CHECK(sarr.is_pure()); CPPA_CHECK(sarr.is_pure());
...@@ -160,7 +160,7 @@ int main() { ...@@ -160,7 +160,7 @@ int main() {
uniform_typeid<actor_ptr>(), uniform_typeid<actor_ptr>(),
uniform_typeid<group_ptr>(), uniform_typeid<group_ptr>(),
uniform_typeid<channel_ptr>(), uniform_typeid<channel_ptr>(),
uniform_typeid<process_information_ptr>() uniform_typeid<node_id_ptr>()
}; };
for (size_t i = 0; i < sarr.size; ++i) { for (size_t i = 0; i < sarr.size; ++i) {
......
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