Ring Daemon 16.0.0
|
#include <routing_table.h>
Public Member Functions | |
bool | addConnectingNode (const NodeId &nodeId) |
Add NodeId to connecting_nodes if it doesn't exist in nodes. | |
bool | addKnownNode (const NodeId &nodeId) |
Add NodeId to known_nodes if it doesn't exist in nodes. | |
bool | addMobileNode (const NodeId &nodeId) |
Add NodeId to mobile_nodes if it doesn't exist in nodes. | |
bool | addNode (const std::shared_ptr< dhtnet::ChannelSocketInterface > &socket) |
Add Node socket to bucket. | |
bool | addNode (NodeInfo &&info) |
Add NodeInfo to bucket. | |
Bucket ()=delete | |
Bucket (const Bucket &)=delete | |
Bucket (const NodeId &) | |
void | changeMobility (const NodeId &nodeId, bool isMobile) |
Change mobility of specific node, mobile or not. | |
const std::set< NodeId > & | getConnectingNodes () const |
Get NodeIds of connecting_nodes. | |
unsigned | getConnectingNodesSize () const |
Returns number of mobile_nodes in bucket. | |
NodeId | getKnownNode (unsigned index) const |
Returns NodeId from known_nodes at index. | |
const std::set< NodeId > & | getKnownNodes () const |
Get NodeIds from known_nodes. | |
std::set< NodeId > | getKnownNodesRandom (unsigned numberNodes, std::mt19937_64 &rd) const |
Returns random numberNodes NodeId from known_nodes. | |
unsigned | getKnownNodesSize () const |
Returns number of knwon_nodes in bucket. | |
NodeId | getLowerLimit () const |
Returns bucket lower limit. | |
const std::set< NodeId > & | getMobileNodes () const |
Get NodeIds from mobile_nodes. | |
std::set< NodeId > | getNodeIds () const |
Get NodeIds from bucket. | |
std::map< NodeId, NodeInfo > & | getNodes () |
Get connected nodes from bucket. | |
std::set< std::shared_ptr< dhtnet::ChannelSocketInterface > > | getNodeSockets () const |
Get sockets from bucket. | |
unsigned | getNodesSize () const |
Returns number of nodes in bucket. | |
asio::steady_timer & | getNodeTimer (const std::shared_ptr< dhtnet::ChannelSocketInterface > &socket) |
Returns socket's timer. | |
bool | hasConnectingNode (const NodeId &nodeId) const |
Test if NodeId exist in connecting_nodes. | |
bool | hasKnownNode (const NodeId &nodeId) const |
Test if NodeId exist in known_nodes. | |
bool | hasMobileNode (const NodeId &nodeId) |
Test if NodeId exist in mobile_nodes. | |
bool | hasNode (const NodeId &nodeId) const |
Test if socket exists in nodes. | |
bool | isEmpty () const |
bool | isFull () const |
Indicate if bucket is full. | |
void | printBucket (unsigned number) const |
Prints bucket and bucket's number. | |
NodeId | randomId (std::mt19937_64 &rd) const |
Returns random NodeId from known_nodes. | |
void | removeConnectingNode (const NodeId &nodeId) |
Remove NodeId from connecting_nodes. | |
void | removeKnownNode (const NodeId &nodeId) |
Remove NodeId from known_nodes. | |
void | removeMobileNode (const NodeId &nodeId) |
Remove NodeId from mobile_nodes. | |
bool | removeNode (const NodeId &nodeId) |
Remove NodeId socket from bucket and insert it in known_nodes or mobile_nodes depending on its type. | |
void | setLowerLimit (const NodeId &nodeId) |
Set bucket's lower limit. | |
void | shutdownAllNodes () |
Shutdowns all sockets in nodes through shutdownNode. | |
bool | shutdownNode (const NodeId &nodeId) |
Shutdowns socket and removes it from nodes. | |
Static Public Attributes | |
static constexpr int | BUCKET_MAX_SIZE = 2 |
Definition at line 56 of file routing_table.h.
|
delete |
Definition at line 37 of file routing_table.cpp.
Add NodeId to connecting_nodes if it doesn't exist in nodes.
nodeId | |
nodeInfo |
Definition at line 128 of file routing_table.cpp.
References hasNode().
Add NodeId to known_nodes if it doesn't exist in nodes.
nodeId |
Definition at line 93 of file routing_table.cpp.
References hasNode().
Referenced by removeNode().
Add NodeId to mobile_nodes if it doesn't exist in nodes.
nodeId |
Definition at line 116 of file routing_table.cpp.
References hasNode().
Referenced by removeNode().
Add Node socket to bucket.
socket |
Definition at line 42 of file routing_table.cpp.
References addNode().
Referenced by addNode().
Add NodeInfo to bucket.
nodeInfo |
Definition at line 48 of file routing_table.cpp.
Change mobility of specific node, mobile or not.
Definition at line 226 of file routing_table.cpp.
References jami::emitSignal().
Get NodeIds of connecting_nodes.
Definition at line 189 of file routing_table.h.
|
inline |
Returns number of mobile_nodes in bucket.
Definition at line 274 of file routing_table.h.
Returns NodeId from known_nodes at index.
index |
Definition at line 104 of file routing_table.cpp.
References jami::emitSignal().
Referenced by getKnownNodesRandom().
Get NodeIds from known_nodes.
Definition at line 124 of file routing_table.h.
Referenced by getKnownNodesRandom().
std::set< NodeId > jami::Bucket::getKnownNodesRandom | ( | unsigned | numberNodes, |
std::mt19937_64 & | rd | ||
) | const |
Returns random numberNodes NodeId from known_nodes.
numberNodes | |
rd |
Definition at line 141 of file routing_table.cpp.
References jami::emitSignal(), getKnownNode(), getKnownNodes(), and getKnownNodesSize().
Referenced by randomId().
|
inline |
Returns number of knwon_nodes in bucket.
Definition at line 268 of file routing_table.h.
Referenced by getKnownNodesRandom().
|
inline |
Returns bucket lower limit.
Definition at line 280 of file routing_table.h.
Get NodeIds from mobile_nodes.
Definition at line 170 of file routing_table.h.
std::set< NodeId > jami::Bucket::getNodeIds | ( | ) | const |
Get NodeIds from bucket.
Definition at line 78 of file routing_table.cpp.
References jami::emitSignal().
Get connected nodes from bucket.
Definition at line 92 of file routing_table.h.
std::set< std::shared_ptr< dhtnet::ChannelSocketInterface > > jami::Bucket::getNodeSockets | ( | ) | const |
Get sockets from bucket.
Definition at line 237 of file routing_table.cpp.
References jami::emitSignal().
|
inline |
Returns number of nodes in bucket.
Definition at line 262 of file routing_table.h.
asio::steady_timer & jami::Bucket::getNodeTimer | ( | const std::shared_ptr< dhtnet::ChannelSocketInterface > & | socket | ) |
Returns socket's timer.
socket |
Definition at line 158 of file routing_table.cpp.
Test if NodeId exist in connecting_nodes.
nodeId |
Definition at line 196 of file routing_table.h.
Test if NodeId exist in known_nodes.
nodeId |
Definition at line 138 of file routing_table.h.
Test if NodeId exist in mobile_nodes.
nodeId |
Definition at line 161 of file routing_table.h.
Test if socket exists in nodes.
nodeId |
Definition at line 87 of file routing_table.cpp.
Referenced by addConnectingNode(), addKnownNode(), and addMobileNode().
|
inline |
Definition at line 201 of file routing_table.h.
|
inline |
Indicate if bucket is full.
Definition at line 207 of file routing_table.h.
References BUCKET_MAX_SIZE.
Prints bucket and bucket's number.
Definition at line 195 of file routing_table.cpp.
References jami::emitSignal(), JAMI_DEBUG, and JAMI_ERROR.
|
inline |
Returns random NodeId from known_nodes.
rd |
Definition at line 222 of file routing_table.h.
References getKnownNodesRandom().
Remove NodeId from connecting_nodes.
nodeId |
Definition at line 184 of file routing_table.h.
Remove NodeId socket from bucket and insert it in known_nodes or mobile_nodes depending on its type.
nodeId |
Definition at line 61 of file routing_table.cpp.
References addKnownNode(), and addMobileNode().
Referenced by shutdownAllNodes(), and shutdownNode().
void jami::Bucket::shutdownAllNodes | ( | ) |
Shutdowns all sockets in nodes through shutdownNode.
Definition at line 183 of file routing_table.cpp.
References jami::emitSignal(), and removeNode().
Shutdowns socket and removes it from nodes.
The corresponding node is moved to known_nodes or mobile_nodes
socket |
Definition at line 168 of file routing_table.cpp.
References removeNode().
Definition at line 60 of file routing_table.h.
Referenced by isFull(), and jami::SwarmManager::maintainBuckets().