|
static std::vector< MessageType > | getSupportedMessageTypes () |
|
◆ getAdjacentLeftFromVector()
Calculating the adjacent left of the considered node, by looking which node is closest to its left, by using the tree mapper.
Typical usage:
auto adj_left = this->routing_info_.getAdjacentLeftFromVector(considered_node,
considered_node_neighbors);
- Parameters
-
considered_node | of whom we want to calculate the adjacent left |
neighbors | we know of the considered node |
- Returns
- NodeInfo object which should be the adjacent left
node is actually on the left side
◆ getAdjacentRightFromVector()
Calculating the adjacent right of the considered node, by looking which node is closest to its right, by using the tree mapper.
Typical usage:
auto adj_right = this->routing_info_.getAdjacentRightFromVector(considered_node,
considered_node_neighbors);
- Parameters
-
considered_node | of whom we want to calculate the adjacent right |
neighbors | we know of the considered node |
- Returns
- NodeInfo object which should be the adjacent right
node is actually on the right side
◆ initiateSelfDeparture()
void minhton::LeaveAlgorithmGeneral::initiateSelfDeparture |
( |
| ) |
|
|
overridepure virtual |
◆ performLeaveWithoutReplacement()
void minhton::LeaveAlgorithmGeneral::performLeaveWithoutReplacement |
( |
| ) |
|
|
protected |
We know that we can leave the network without making the tree unbalanced.
For this we only have to send RemoveNeighbor messages to each neighbor who knows us and update our adjacents.
We can update the adjacents by linking our adjacent left and adjacent right together.
◆ performLeaveWithReplacement()
void minhton::LeaveAlgorithmGeneral::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 |
|
) |
| |
|
protected |
Performing the update of every PhysicalNodeInfo in a leave with replacement while we are the node replacing the leaving node.
Sending RemoveNeighbor messages to nodes who only know the removed position, and ReplacementUpdate messages to nodes who know the replaced (and removed) position. If we do not have the network information about the nodes, we send via SearchExact.
We also must update the adjacents of the removed position
- Parameters
-
leaving_node | The node leaving the network and position we will replace |
neighbors_of_leaving_node | All neighbors the leaving node knows |
◆ prepareLeavingAsSuccessor()
void minhton::LeaveAlgorithmGeneral::prepareLeavingAsSuccessor |
( |
const minhton::NodeInfo & |
node_to_replace | ) |
|
|
protected |
Helper method to prepare leaving the network in order to replace another node. This calls signOffFromParent
- Parameters
-
node_to_replace | The node leaving the network |
◆ process()
void minhton::LeaveAlgorithmGeneral::process |
( |
const MessageVariant & |
msg | ) |
|
|
overridevirtual |
◆ processFindReplacement()
This method will be called when we receive a FIND_REPLACEMENT message.
Typical Usage:
virtual void processFindReplacement(const minhton::MessageFindReplacement &message)=0
- Parameters
-
message | the message we received and want to process |
Implemented in minhton::MinhtonLeaveAlgorithm.
◆ processLockNeighborRequest()
This method will be called when we receive a LOCK_NEIGHBOR_REQUEST message.
We are the left or right neighbor of the parent of a successor node. We try to lock ourselves for the leave procedure and respond with a MessageLockNeighborResponse, indicating success or failure of locking ourselves.
Typical Usage:
void processLockNeighborRequest(const minhton::MessageLockNeighborRequest &message)
Definition leave_algorithm_general.cpp:442
- Parameters
-
message | the message we received and want to process |
◆ processLockNeighborResponse()
This method will be called when we receive a LOCK_NEIGHBOR_RESPONSE message.
We are the parent of a successor node. When the message indicates a failure, we inform the successor about it and abort the leave. If the response comes from the right neighbor, we continue by sending a MessageLockNeighborRequest to our left neighbor. If the response comes from the left neighbor, we send a MessageRemoveNeighbor to our level neighbors and wait for all acknowledgements.
Typical Usage:
void processLockNeighborResponse(const minhton::MessageLockNeighborResponse &message)
Definition leave_algorithm_general.cpp:458
- Parameters
-
message | the message we received and want to process |
◆ processReceiveReplacementUpdateAck()
void minhton::LeaveAlgorithmGeneral::processReceiveReplacementUpdateAck |
( |
| ) |
|
|
protected |
This method is called after we received all acknowledgements for each MessageReplacementUpdate we sent to our neighbors.
We are the successor which is now at the position of the left node and we can unlock our parent.
◆ processReceiveSignoffNeighborAdjacentsAck()
void minhton::LeaveAlgorithmGeneral::processReceiveSignoffNeighborAdjacentsAck |
( |
| ) |
|
|
protected |
This method is called after we received all acknowledgements from our neighbors and adjacents where we updated their routing information.
We are the sucessor for a leave procedure and continue by sending a replacement offer to the node we want to replace. But if we can leave without a replacement, we are the leaving node and can leave directly, finishing our part of the leave by going into idle and unlocking our parent.
◆ processRemoveNeighborAck()
void minhton::LeaveAlgorithmGeneral::processRemoveNeighborAck |
( |
| ) |
|
|
protected |
This method will be called after we received all expected REMOVE_NEIGHBOR_ACK messages.
We are the parent of a successor node and inform the successor about the successful updates of all our level neighbors with a MessageSignoffParentAnswer.
◆ processReplacementAck()
This method will be called when we receive a REPLACEMENT_ACK message.
We are the node which is replacing the leaving node. We can now initialize the whole replacement procedure.
Typical Usage:
void processReplacementAck(const minhton::MessageReplacementAck &message)
Definition leave_algorithm_general.cpp:173
- Parameters
-
message | the message we received and want to process |
◆ processReplacementOffer()
This method will be called when we receive a REPLACEMENT_OFFER message.
We are the node which wants to leave the network. A node which can replace our position gave us an offer. If we send back a ReplacementAck we can just leave the network.
Typical Usage:
void processReplacementOffer(const minhton::MessageReplacementOffer &message)
Definition leave_algorithm_general.cpp:99
- Parameters
-
message | the message we received and want to process |
◆ processReplacementUpdate()
This method will be called when we receive a REPLACEMENT_UPDATE message.
Removing the node of the removed position from our routing information if we have it.
Replacing the PhysicalNodeInfo from the neighbor at the replaced position with those from the removed position. (Exchanging PhysicalNodeInfo of the leaving node with that of the replacing node.)
Typical Usage:
void processReplacementUpdate(const minhton::MessageReplacementUpdate &message)
Definition leave_algorithm_general.cpp:129
- Parameters
-
message | the message we received and want to process |
◆ processSignOffParentAnswer()
This method will be called when we receive a SIGN_OFF_PARENT_ANSWER message.
We are the selected successor node for a leave procedure. If the message informs us of a failure, we abort the leave. Otherwise, we continue by calling the method signOffFromNeighborsAndAdjacents. Then we wait for all acknowledgements for the routing information updates of the nodes we sent messages to. We continue by calling the method processReceiveSignoffNeighborAdjacentsAck.
Typical Usage:
void processSignOffParentAnswer(const minhton::MessageSignoffParentAnswer &message)
Definition leave_algorithm_general.cpp:547
- Parameters
-
message | the message we received and want to process |
◆ processSignOffParentRequest()
This method will be called when we receive a SIGN_OFF_PARENT_REQUEST message.
We are the parent of a selected successor node for a leave procedure. We might respond with a MessageSignoffParentAnswer in case we are already involved in another leave procedure. Otherwise, we continue the leave by locking our right neighbor with a MessageLockNeighborRequest. If we and the successor are the only nodes in the network, we skip the locking of our neighbors and send a MessageLockNeighborResponse to ourselves to continue.
Typical Usage:
void processSignOffParentRequest(const minhton::MessageSignoffParentRequest &message)
Definition leave_algorithm_general.cpp:393
- Parameters
-
message | the message we received and want to process |
◆ processUnlockNeighbor()
This method will be called when we receive a UNLOCK_NEIGHBOR message.
We are either the parent of a successor of the left/right neighbor of the parent of a successor and are now allowed to unlock ourselves. In case we are the parent, we need to forward this message to our left and right neighbor.
Typical Usage:
void processUnlockNeighbor(const MessageUnlockNeighbor &msg)
Definition leave_algorithm_general.cpp:47
- Parameters
-
message | the message we received and want to process |
◆ processUpdateForwardAck()
void minhton::LeaveAlgorithmGeneral::processUpdateForwardAck |
( |
| ) |
|
|
protected |
◆ replaceMyself()
Replacing our own self_node_info and routing_info with the information that we got from the node to replace positions with.
But we keep our current PhysicalNodeInfo!
We have to iterate through the given neighbor information and determine if the neighbor is a parent, child, adjacent, routing table neighbor etc.
- Parameters
-
node_to_replace | the node position we want to replace |
neighbors_of_node_to_replace | every neighbor the node to replace knew of |
TODO sts
Determining what role each neighbor has: parent, child, routing table neighor, routing table neighbor child
Updating our Adjacent Information separately
◆ sendNackToReplacement()
void minhton::LeaveAlgorithmGeneral::sendNackToReplacement |
( |
uint64_t |
ref_event_id | ) |
|
|
protected |
This method sends a MessageReplacementNack to the successor, if we need to abort the leave procedure.
- Parameters
-
ref_event_id | ref event id of the relevant leave procedure |
◆ sendReplacementOffer()
void minhton::LeaveAlgorithmGeneral::sendReplacementOffer |
( |
| ) |
|
|
protected |
Helper method to send the replacement offer message to the node who wants to leave the network.
Also setting the correct event id for the message and setting the replacement ack timeout.
◆ signOffFromNeighborsAndAdjacents()
uint32_t minhton::LeaveAlgorithmGeneral::signOffFromNeighborsAndAdjacents |
( |
| ) |
|
|
protected |
This method is called from the processSignOffParentAnswer method.
We are a successor for a leave procedure and are now updating our neighbors. Our level neighbors receive a MessageRemoveNeighbor, which they have to acknowledge. Next, we update our adjacents by sending the left one a MessageRemoveAndUpdateNeighbors (if it is also our left neighbor) or MessageUpdateNeighbors. We send the right adjacent MessageUpdateNeighbors. The adjacents have to acknowledge their routing information update as well.
- Returns
- uint32_t number of nodes we expect an acknowledgement from
◆ signOffFromParent()
void minhton::LeaveAlgorithmGeneral::signOffFromParent |
( |
| ) |
|
|
protected |
Send a MessageSignoffParentRequest to own parent. This helper method can be called from the successor or the leaving node itself if it doesn't need a successor.
The documentation for this class was generated from the following files:
- minhton/include/minhton/algorithms/leave/leave_algorithm_general.h
- minhton/src/algorithms/leave/leave_algorithm_general.cpp
- minhton/src/algorithms/leave/leave_algorithm_general_helper.cpp