libcaf  0.15.3
Public Types | Public Member Functions | Static Public Attributes | Related Functions | List of all members
caf::node_id Class Reference

A node ID consists of a host ID and process ID. More...

#include <node_id.hpp>

Public Types

using host_id_type = std::array< uint8_t, host_id_size >
 Represents a 160 bit hash.
 

Public Member Functions

 node_id (const node_id &)=default
 
 node_id (const none_t &)
 
node_idoperator= (const node_id &)=default
 
node_idoperator= (const none_t &)
 
 node_id (uint32_t procid, const std::string &hash)
 Creates a node ID from process_id and hash. More...
 
 node_id (uint32_t procid, const host_id_type &hid)
 Creates a node ID from process_id and hash. More...
 
uint32_t process_id () const
 Identifies the running process. More...
 
const host_id_typehost_id () const
 Identifies the host system. More...
 
 operator bool () const
 Queries whether this node is not default-constructed.
 
void swap (node_id &)
 

Static Public Attributes

static constexpr size_t host_id_size = 20
 A 160 bit hash (20 bytes).
 
static constexpr size_t serialized_size = host_id_size + sizeof(uint32_t)
 The size of a node_id in serialized form.
 

Related Functions

(Note that these are not member functions.)

bool operator== (const node_id &x, none_t)
 
bool operator== (none_t, const node_id &x)
 
bool operator!= (const node_id &x, none_t)
 
bool operator!= (none_t, const node_id &x)
 
std::string to_string (const node_id &x)
 Converts x into a human-readable string representation.
 
void append_to_string (std::string &x, const node_id &y)
 Appends y in human-readable string representation to x.
 

Detailed Description

A node ID consists of a host ID and process ID.

The host ID identifies the physical machine in the network, whereas the process ID identifies the running system-level process on that machine.

Constructor & Destructor Documentation

caf::node_id::node_id ( uint32_t  procid,
const std::string &  hash 
)

Creates a node ID from process_id and hash.

Parameters
procidSystem-wide unique process identifier.
hashUnique node id as hexadecimal string representation.
caf::node_id::node_id ( uint32_t  procid,
const host_id_type hid 
)

Creates a node ID from process_id and hash.

Parameters
procidSystem-wide unique process identifier.
hidUnique node id.

Member Function Documentation

const host_id_type& caf::node_id::host_id ( ) const

Identifies the host system.

Returns
A hash build from the MAC address of the first network device and the UUID of the root partition (mounted in "/" or "C:").
uint32_t caf::node_id::process_id ( ) const

Identifies the running process.

Returns
A system-wide unique process identifier.

Friends And Related Function Documentation

bool operator!= ( const node_id x,
none_t   
)
related
bool operator!= ( none_t  ,
const node_id x 
)
related
bool operator== ( const node_id x,
none_t   
)
related
bool operator== ( none_t  ,
const node_id x 
)
related

The documentation for this class was generated from the following file: