SOLA
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
minhton::MinhtonLeaveAlgorithm Class Reference
Inheritance diagram for minhton::MinhtonLeaveAlgorithm:
minhton::LeaveAlgorithmGeneral minhton::LeaveAlgorithmInterface minhton::AlgorithmInterface MinhtonLeaveAlgorithmForTest

Public Member Functions

 MinhtonLeaveAlgorithm (std::shared_ptr< AccessContainer > access)
 
bool canLeaveWithoutReplacement () override
 
void initiateSelfDeparture () override
 
- Public Member Functions inherited from minhton::LeaveAlgorithmGeneral
 LeaveAlgorithmGeneral (std::shared_ptr< AccessContainer > access)
 
void process (const MessageVariant &msg) override
 
- Public Member Functions inherited from minhton::LeaveAlgorithmInterface
 LeaveAlgorithmInterface (std::shared_ptr< AccessContainer > access)
 
virtual void replaceMyself (const NodeInfo &node_to_replace, std::vector< NodeInfo > neighbors_of_node_to_replace)=0
 
- Public Member Functions inherited from minhton::AlgorithmInterface
 AlgorithmInterface (std::shared_ptr< AccessContainer > access)
 

Protected Member Functions

void processFindReplacement (const minhton::MessageFindReplacement &message) override
 
void performFindReplacement ()
 
void performFindReplacement (const MessageFindReplacement &msg)
 
- Protected Member Functions inherited from minhton::LeaveAlgorithmGeneral
void processReplacementOffer (const minhton::MessageReplacementOffer &message)
 
void processSignOffParentRequest (const minhton::MessageSignoffParentRequest &message)
 
void processSignOffParentAnswer (const minhton::MessageSignoffParentAnswer &message)
 
void processReplacementAck (const minhton::MessageReplacementAck &message)
 
void processLockNeighborRequest (const minhton::MessageLockNeighborRequest &message)
 
void processLockNeighborResponse (const minhton::MessageLockNeighborResponse &message)
 
void processRemoveNeighborAck ()
 
void processReplacementUpdate (const minhton::MessageReplacementUpdate &message)
 
void performLeaveWithoutReplacement ()
 
void performLeaveWithReplacement (minhton::NodeInfo leaving_node, std::vector< minhton::NodeInfo > neighbors_of_leaving_node, bool leaving_node_was_locked, bool leaving_node_locked_right, bool leaving_node_locked_left)
 
void prepareLeavingAsSuccessor (const minhton::NodeInfo &node_to_replace)
 
void signOffFromParent ()
 
uint32_t signOffFromNeighborsAndAdjacents ()
 
void processUpdateForwardAck ()
 
void sendReplacementOffer ()
 
void sendNackToReplacement (uint64_t ref_event_id)
 
void replaceMyself (const minhton::NodeInfo &node_to_replace, std::vector< minhton::NodeInfo > neighbors_of_node_to_replace) override
 
void processReceiveSignoffNeighborAdjacentsAck ()
 
void processReceiveReplacementUpdateAck ()
 
void processUnlockNeighbor (const MessageUnlockNeighbor &msg)
 
- Protected Member Functions inherited from minhton::AlgorithmInterface
void send (const MessageVariant &msg)
 
std::shared_ptr< RoutingInformationgetRoutingInfo () const
 
NodeInfo getSelfNodeInfo () const
 

Additional Inherited Members

- Static Public Member Functions inherited from minhton::LeaveAlgorithmInterface
static std::vector< MessageTypegetSupportedMessageTypes ()
 
- Static Protected Member Functions inherited from minhton::LeaveAlgorithmGeneral
static minhton::NodeInfo getAdjacentLeftFromVector (const minhton::NodeInfo &considered_node, std::vector< minhton::NodeInfo > neighbors)
 
static minhton::NodeInfo getAdjacentRightFromVector (const minhton::NodeInfo &considered_node, std::vector< minhton::NodeInfo > neighbors)
 
- Protected Attributes inherited from minhton::LeaveAlgorithmGeneral
minhton::NodeInfo replacing_node_
 
uint64_t leaving_event_id_ = 0
 
bool in_leave_progress_ = false
 
bool locked_right_neighbor_ = false
 
bool locked_left_neighbor_ = false
 
uint32_t remaining_lock_neighbor_response_ = 0
 
std::shared_ptr< minhton::MessageSignoffParentRequestcurrent_signoff_request_ = nullptr
 
std::shared_ptr< minhton::MessageReplacementUpdatelast_replacement_update_ = nullptr
 
NodeInfo old_parent_
 
- Protected Attributes inherited from minhton::AlgorithmInterface
std::shared_ptr< AccessContaineraccess_
 

Member Function Documentation

◆ canLeaveWithoutReplacement()

bool minhton::MinhtonLeaveAlgorithm::canLeaveWithoutReplacement ( )
overridevirtual

Helper method to quickly check if we will do a leave without replacement for the FSM. This must be done in accordance with the actual Leave implementation.

This method checks the routing tables to say whether the current node is the last one of the network or it (maybe) is not.

Only works for complete trees (nodes are added from left to right without gaps).

Returns
true when the current node is definitely the last one of the network, or false when it is not the last one or it cannot be determined yet

Implements minhton::LeaveAlgorithmInterface.

◆ initiateSelfDeparture()

void minhton::MinhtonLeaveAlgorithm::initiateSelfDeparture ( )
overridevirtual

We decide ourselves that we want to leave the network and initiate the leave procedure.

This method gets called when we receive a leave signal.

Typical Usage:

node->initiateSelfDeparture();

Implements minhton::LeaveAlgorithmGeneral.

◆ performFindReplacement() [1/2]

void minhton::MinhtonLeaveAlgorithm::performFindReplacement ( )
protected

Implementation of the FindReplacement algorithm.

This variant of the method is called only once from the node which wants to leave. The method initiates the main logic for the leave process by calling the methods responsible for redirecting the request of finding a replacement node.

In case the current node (that wants to leave) is also the parent of the last node in the network, we send a message to the last node in this method.

◆ performFindReplacement() [2/2]

void minhton::MinhtonLeaveAlgorithm::performFindReplacement ( const MessageFindReplacement msg)
protected

Implementation of the FindReplacement algorithm.

This variant of the method may be called multiple times during the redirection of the request for finding a replacement.

But it is only called once per reached node, since the logic in this method is responsible for calling other methods based on the SearchProgress of the msg. And those other methods redirect accordingly to another node, ideally coming closer to the last node of the network or gathering information to make it possible to find it.

Parameters
msgthe message we received and read to proceed with the initiated leave procedure

◆ processFindReplacement()

void minhton::MinhtonLeaveAlgorithm::processFindReplacement ( const minhton::MessageFindReplacement message)
overrideprotectedvirtual

This method will be called when we receive a FIND_REPLACEMENT message.

Typical Usage:

this->processFindReplacement(incoming_message);
void processFindReplacement(const minhton::MessageFindReplacement &message) override
Definition minhton_leave_algorithm.cpp:55
Parameters
messagethe message we received and want to process

Implements minhton::LeaveAlgorithmGeneral.


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