Ring Daemon 16.0.0
|
#include <swarm_manager.h>
Public Member Functions | |
void | addChannel (const std::shared_ptr< dhtnet::ChannelSocketInterface > &channel) |
Add channel to routing table. | |
void | changeMobility (const NodeId &nodeId, bool isMobile) |
Change mobility of specific node. | |
void | deleteNode (std::vector< NodeId > nodes) |
Delete nodes from the different tables in bucket. | |
void | display () |
Display swarm manager info. | |
std::vector< NodeId > | getAllNodes () const |
get all nodes from the different tables in bucket | |
std::list< Bucket > & | getBuckets () |
Get buckets of routing table. | |
const NodeId & | getId () const |
Get swarm manager id. | |
RoutingTable & | getRoutingTable () |
Get routing table. | |
bool | isConnectedWith (const NodeId &deviceId) |
Check if we're connected with a specific device. | |
bool | isMobile () const |
Get mobility of swarm manager. | |
bool | isShutdown () |
Check if swarm manager is shutdown. | |
void | maintainBuckets (const std::set< NodeId > &toConnect={}) |
Maintain/Update buckets. | |
void | onConnectionChanged (OnConnectionChanged cb) |
void | removeNode (const NodeId &nodeId) |
Remove channel from routing table. | |
void | restart () |
Restart the swarm manager. | |
bool | setKnownNodes (const std::vector< NodeId > &known_nodes) |
Set list of nodes to the routing table known_nodes. | |
void | setMobileNodes (const std::vector< NodeId > &mobile_nodes) |
Set list of nodes to the routing table mobile_nodes. | |
void | setMobility (bool isMobile) |
Set mobility of swarm manager. | |
void | shutdown () |
Shutdown swarm manager. | |
SwarmManager (const NodeId &, const std::mt19937_64 &rand, ToConnectCb &&toConnectCb) | |
std::weak_ptr< SwarmManager > | weak () |
~SwarmManager () | |
Public Attributes | |
NeedSocketCb | needSocketCb_ |
Definition at line 29 of file swarm_manager.h.
|
explicit |
Definition at line 26 of file swarm_manager.cpp.
References jami::RoutingTable::setId().
jami::SwarmManager::~SwarmManager | ( | ) |
Definition at line 34 of file swarm_manager.cpp.
References shutdown().
void jami::SwarmManager::addChannel | ( | const std::shared_ptr< dhtnet::ChannelSocketInterface > & | channel | ) |
Add channel to routing table.
channel |
Definition at line 85 of file swarm_manager.cpp.
References jami::RoutingTable::addNode(), jami::emitSignal(), jami::RoutingTable::findBucket(), getId(), and JAMI_DEBUG.
Change mobility of specific node.
nodeId | |
isMobile |
Definition at line 120 of file swarm_manager.cpp.
References jami::emitSignal(), jami::RoutingTable::findBucket(), and isMobile().
Delete nodes from the different tables in bucket.
Definition at line 381 of file swarm_manager.cpp.
References jami::RoutingTable::deleteNode(), and maintainBuckets().
|
inline |
Display swarm manager info.
Definition at line 122 of file swarm_manager.h.
References jami::emitSignal(), jami::RoutingTable::getBuckets(), getId(), jami::RoutingTable::getRoutingTableNodeCount(), and JAMI_DEBUG.
std::vector< NodeId > jami::SwarmManager::getAllNodes | ( | ) | const |
get all nodes from the different tables in bucket
Definition at line 374 of file swarm_manager.cpp.
References jami::RoutingTable::getAllNodes().
|
inline |
Get buckets of routing table.
Definition at line 104 of file swarm_manager.h.
References jami::RoutingTable::getBuckets().
Get swarm manager id.
Definition at line 48 of file swarm_manager.h.
Referenced by addChannel(), and display().
|
inline |
Check if we're connected with a specific device.
deviceId |
Definition at line 128 of file swarm_manager.cpp.
References jami::RoutingTable::hasNode().
Referenced by removeNode().
|
inline |
Get mobility of swarm manager.
Definition at line 152 of file swarm_manager.h.
Referenced by changeMobility(), and setMobility().
|
inline |
Check if swarm manager is shutdown.
Definition at line 171 of file swarm_manager.h.
Maintain/Update buckets.
toConnect | Nodes to connect |
Definition at line 165 of file swarm_manager.cpp.
References jami::RoutingTable::addConnectingNode(), jami::Bucket::BUCKET_MAX_SIZE, jami::RoutingTable::contains(), jami::emitSignal(), and jami::RoutingTable::getBuckets().
Referenced by deleteNode(), and removeNode().
|
inline |
Definition at line 140 of file swarm_manager.h.
References jami::emitSignal().
Remove channel from routing table.
channel |
Definition at line 109 of file swarm_manager.cpp.
References jami::emitSignal(), isConnectedWith(), and maintainBuckets().
void jami::SwarmManager::restart | ( | ) |
Restart the swarm manager.
This function must be called in situations where we want to use a swarm manager that was previously shut down.
Definition at line 145 of file swarm_manager.cpp.
Set list of nodes to the routing table known_nodes.
known_nodes |
Definition at line 41 of file swarm_manager.cpp.
References jami::emitSignal(), and weak().
Set list of nodes to the routing table mobile_nodes.
mobile_nodes |
Definition at line 75 of file swarm_manager.cpp.
Set mobility of swarm manager.
isMobile |
Definition at line 146 of file swarm_manager.h.
References isMobile().
void jami::SwarmManager::shutdown | ( | ) |
Shutdown swarm manager.
Definition at line 134 of file swarm_manager.cpp.
References jami::RoutingTable::shutdownAllNodes().
Referenced by ~SwarmManager().
|
inline |
Definition at line 42 of file swarm_manager.h.
References jami::emitSignal().
Referenced by setKnownNodes().
NeedSocketCb jami::SwarmManager::needSocketCb_ |
Definition at line 40 of file swarm_manager.h.