CAF  0.17.3
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
caf::io::basp::routing_table Class Reference

Stores routing information for a single broker participating as BASP peer and provides both direct and indirect paths. More...

#include <routing_table.hpp>

Classes

struct  route
 Describes a routing path to a node. More...
 

Public Types

using node_id_set = std::unordered_set< node_id >
 

Public Member Functions

 routing_table (abstract_broker *parent)
 
optional< routelookup (const node_id &target)
 Returns a route to target or none on error.
 
node_id lookup_direct (const connection_handle &hdl) const
 Returns the ID of the peer connected via hdl or none if hdl is unknown.
 
optional< connection_handlelookup_direct (const node_id &nid) const
 Returns the handle offering a direct connection to nid or invalid_connection_handle if no direct connection to nid exists.
 
node_id lookup_indirect (const node_id &nid) const
 Returns the next hop that would be chosen for nid or none if there's no indirect route to nid.
 
void add_direct (const connection_handle &hdl, const node_id &nid)
 Adds a new direct route to the table. More...
 
bool add_indirect (const node_id &hop, const node_id &dest)
 Adds a new indirect route to the table.
 
node_id erase_direct (const connection_handle &hdl)
 Removes a direct connection and return the node ID that became unreachable as a result of this operation.
 
bool erase_indirect (const node_id &dest)
 Removes any entry for indirect connection to dest and returns true if dest had an indirect route, otherwise false.
 
abstract_brokerparent ()
 Returns the parent broker.
 

Public Attributes

abstract_brokerparent_
 
std::mutex mtx_
 
std::unordered_map< connection_handle, node_iddirect_by_hdl_
 
std::unordered_map< node_id, connection_handledirect_by_nid_
 
std::unordered_map< node_id, node_id_set > indirect_
 

Detailed Description

Stores routing information for a single broker participating as BASP peer and provides both direct and indirect paths.

Member Function Documentation

◆ add_direct()

void caf::io::basp::routing_table::add_direct ( const connection_handle hdl,
const node_id nid 
)

Adds a new direct route to the table.

Precondition
hdl != invalid_connection_handle && nid != none

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