Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::SwarmManager Class Reference

#include <swarm_manager.h>

Inheritance diagram for jami::SwarmManager:
Inheritance graph
Collaboration diagram for jami::SwarmManager:
Collaboration graph

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< NodeIdgetAllNodes () const
 get all nodes from the different tables in bucket
 
std::list< Bucket > & getBuckets ()
 Get buckets of routing table.
 
const NodeIdgetId () const
 Get swarm manager id.
 
RoutingTablegetRoutingTable ()
 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< SwarmManagerweak ()
 
 ~SwarmManager ()
 

Public Attributes

NeedSocketCb needSocketCb_
 

Detailed Description

Definition at line 29 of file swarm_manager.h.

Constructor & Destructor Documentation

◆ SwarmManager()

jami::SwarmManager::SwarmManager ( const NodeId id,
const std::mt19937_64 &  rand,
ToConnectCb &&  toConnectCb 
)
explicit

Definition at line 26 of file swarm_manager.cpp.

References jami::RoutingTable::setId().

Here is the call graph for this function:

◆ ~SwarmManager()

jami::SwarmManager::~SwarmManager ( )

Definition at line 34 of file swarm_manager.cpp.

References shutdown().

Here is the call graph for this function:

Member Function Documentation

◆ addChannel()

void jami::SwarmManager::addChannel ( const std::shared_ptr< dhtnet::ChannelSocketInterface > &  channel)

Add channel to routing table.

Parameters
channel

Definition at line 85 of file swarm_manager.cpp.

References jami::RoutingTable::addNode(), jami::emitSignal(), jami::RoutingTable::findBucket(), getId(), and JAMI_DEBUG.

Here is the call graph for this function:

◆ changeMobility()

void jami::SwarmManager::changeMobility ( const NodeId nodeId,
bool  isMobile 
)

Change mobility of specific node.

Parameters
nodeId
isMobile

Definition at line 120 of file swarm_manager.cpp.

References jami::emitSignal(), jami::RoutingTable::findBucket(), and isMobile().

Here is the call graph for this function:

◆ deleteNode()

void jami::SwarmManager::deleteNode ( std::vector< NodeId nodes)

Delete nodes from the different tables in bucket.

Definition at line 381 of file swarm_manager.cpp.

References jami::RoutingTable::deleteNode(), and maintainBuckets().

Here is the call graph for this function:

◆ display()

void jami::SwarmManager::display ( )
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.

Here is the call graph for this function:

◆ getAllNodes()

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().

Here is the call graph for this function:

◆ getBuckets()

std::list< Bucket > & jami::SwarmManager::getBuckets ( )
inline

Get buckets of routing table.

Returns
buckets list

Definition at line 104 of file swarm_manager.h.

References jami::RoutingTable::getBuckets().

Here is the call graph for this function:

◆ getId()

const NodeId & jami::SwarmManager::getId ( ) const
inline

Get swarm manager id.

Returns
NodeId

Definition at line 48 of file swarm_manager.h.

Referenced by addChannel(), and display().

◆ getRoutingTable()

RoutingTable & jami::SwarmManager::getRoutingTable ( )
inline

Get routing table.

Returns
RoutingTable

Definition at line 98 of file swarm_manager.h.

◆ isConnectedWith()

bool jami::SwarmManager::isConnectedWith ( const NodeId deviceId)

Check if we're connected with a specific device.

Parameters
deviceId
Returns
true if connected, false if not

Definition at line 128 of file swarm_manager.cpp.

References jami::RoutingTable::hasNode().

Referenced by removeNode().

Here is the call graph for this function:

◆ isMobile()

bool jami::SwarmManager::isMobile ( ) const
inline

Get mobility of swarm manager.

Returns
true if mobile, false if not

Definition at line 152 of file swarm_manager.h.

Referenced by changeMobility(), and setMobility().

◆ isShutdown()

bool jami::SwarmManager::isShutdown ( )
inline

Check if swarm manager is shutdown.

Returns
true if shutdown, false if not

Definition at line 171 of file swarm_manager.h.

◆ maintainBuckets()

void jami::SwarmManager::maintainBuckets ( const std::set< NodeId > &  toConnect = {})

Maintain/Update buckets.

Parameters
toConnectNodes 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().

Here is the call graph for this function:

◆ onConnectionChanged()

void jami::SwarmManager::onConnectionChanged ( OnConnectionChanged  cb)
inline

Definition at line 140 of file swarm_manager.h.

References jami::emitSignal().

Here is the call graph for this function:

◆ removeNode()

void jami::SwarmManager::removeNode ( const NodeId nodeId)

Remove channel from routing table.

Parameters
channel

Definition at line 109 of file swarm_manager.cpp.

References jami::emitSignal(), isConnectedWith(), and maintainBuckets().

Here is the call graph for this function:

◆ restart()

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.

◆ setKnownNodes()

bool jami::SwarmManager::setKnownNodes ( const std::vector< NodeId > &  known_nodes)

Set list of nodes to the routing table known_nodes.

Parameters
known_nodes
Returns
if some are new

Definition at line 41 of file swarm_manager.cpp.

References jami::emitSignal(), and weak().

Here is the call graph for this function:

◆ setMobileNodes()

void jami::SwarmManager::setMobileNodes ( const std::vector< NodeId > &  mobile_nodes)

Set list of nodes to the routing table mobile_nodes.

Parameters
mobile_nodes

Definition at line 75 of file swarm_manager.cpp.

◆ setMobility()

void jami::SwarmManager::setMobility ( bool  isMobile)
inline

Set mobility of swarm manager.

Parameters
isMobile

Definition at line 146 of file swarm_manager.h.

References isMobile().

Here is the call graph for this function:

◆ shutdown()

void jami::SwarmManager::shutdown ( )

Shutdown swarm manager.

Definition at line 134 of file swarm_manager.cpp.

References jami::RoutingTable::shutdownAllNodes().

Referenced by ~SwarmManager().

Here is the call graph for this function:

◆ weak()

std::weak_ptr< SwarmManager > jami::SwarmManager::weak ( )
inline

Definition at line 42 of file swarm_manager.h.

References jami::emitSignal().

Referenced by setKnownNodes().

Here is the call graph for this function:

Member Data Documentation

◆ needSocketCb_

NeedSocketCb jami::SwarmManager::needSocketCb_

Definition at line 40 of file swarm_manager.h.


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