SOLA
Loading...
Searching...
No Matches
join_algorithm_general.h
1// Copyright The SOLA Contributors
2//
3// Licensed under the MIT License.
4// For details on the licensing terms, see the LICENSE file.
5// SPDX-License-Identifier: MIT
6
7#ifndef MINHTON_ALGORITHMS_JOIN_ALGORITHM_GENERAL_H_
8#define MINHTON_ALGORITHMS_JOIN_ALGORITHM_GENERAL_H_
9
10#include <memory>
11
12#include "minhton/algorithms/join/interface_join_algorithm.h"
13#include "minhton/message/types_all.h"
14
15namespace minhton {
16
18public:
19 explicit JoinAlgorithmGeneral(std::shared_ptr<AccessContainer> access)
20 : JoinAlgorithmInterface(access){};
21
22 ~JoinAlgorithmGeneral() override = default;
23
24 void process(const MessageVariant &msg) override;
25
30 void initiateJoin(NodeInfo &node_info) override;
31
36 void initiateJoin(const PhysicalNodeInfo &p_node_info) override;
37
38protected:
55 virtual void processJoin(const MessageJoin &msg) = 0;
56
74 void processJoinAccept(const MessageJoinAccept &msg);
75
91
108 void performAcceptChild(minhton::NodeInfo entering_node, bool use_complete_balancing = false);
109
126 false) override;
127
140 void performSendJoinAccept(const minhton::NodeInfo &entering_node,
141 const minhton::NodeInfo &entering_node_adj_left,
142 const minhton::NodeInfo &entering_node_adj_right);
143
159 minhton::NodeInfo entering_node) = 0;
160
179 std::vector<minhton::NodeInfo> getRoutingTableNeighborsForNewChild(
180 const minhton::NodeInfo &new_child) const;
181
197 minhton::NodeInfo calcNewChildPosition(bool use_complete_balancing = false) const;
198
213
228
244 const minhton::NodeInfo &entering_node_adj_right) const;
245
261 const minhton::NodeInfo &entering_node_adj_left) const;
262
275 bool mustSendUpdateLeft(const minhton::NodeInfo &entering_node_adj_right) const;
276
288 bool mustSendUpdateRight(const minhton::NodeInfo &entering_node_adj_left) const;
289
322 const minhton::NodeInfo &alleged_adjacent) const;
323
324 void allUpdatesAcknowledged();
325
326 PhysicalNodeInfo last_join_info_;
327};
328
329} // namespace minhton
330
331#endif
Definition join_algorithm_general.h:17
virtual void processJoin(const MessageJoin &msg)=0
minhton::NodeInfo getCloserAdjacent(const minhton::NodeInfo &entering_node, const minhton::NodeInfo &alleged_adjacent) const
Definition join_algorithm_general_helper.cpp:231
std::vector< minhton::NodeInfo > getRoutingTableNeighborsForNewChild(const minhton::NodeInfo &new_child) const
Definition join_algorithm_general_helper.cpp:194
minhton::NodeInfo calcAdjacentLeftOfNewChild(const minhton::NodeInfo &entering_node) const
Definition join_algorithm_general_helper.cpp:70
virtual uint32_t performSendUpdateNeighborMessagesAboutEnteringNode(minhton::NodeInfo entering_node)=0
void performSendJoinAccept(const minhton::NodeInfo &entering_node, const minhton::NodeInfo &entering_node_adj_left, const minhton::NodeInfo &entering_node_adj_right)
Definition join_algorithm_general.cpp:181
void processJoinAcceptAck(const MessageJoinAcceptAck &msg)
Definition join_algorithm_general.cpp:253
void processJoinAccept(const MessageJoinAccept &msg)
Definition join_algorithm_general.cpp:207
minhton::NodeInfo calcOurNewAdjacentLeft(const minhton::NodeInfo &entering_node, const minhton::NodeInfo &entering_node_adj_right) const
Definition join_algorithm_general_helper.cpp:163
bool mustSendUpdateLeft(const minhton::NodeInfo &entering_node_adj_right) const
Definition join_algorithm_general_helper.cpp:133
void continueAcceptChildProcedure(const minhton::MessageInformAboutNeighbors &message) noexcept(false) override
Definition join_algorithm_general.cpp:140
void performAcceptChild(minhton::NodeInfo entering_node, bool use_complete_balancing=false)
Definition join_algorithm_general.cpp:51
bool mustSendUpdateRight(const minhton::NodeInfo &entering_node_adj_left) const
Definition join_algorithm_general_helper.cpp:148
minhton::NodeInfo calcAdjacentRightOfNewChild(const minhton::NodeInfo &entering_node) const
Definition join_algorithm_general_helper.cpp:101
minhton::NodeInfo calcOurNewAdjacentRight(const minhton::NodeInfo &entering_node, const minhton::NodeInfo &entering_node_adj_left) const
Definition join_algorithm_general_helper.cpp:177
minhton::NodeInfo calcNewChildPosition(bool use_complete_balancing=false) const
Definition join_algorithm_general_helper.cpp:26
void initiateJoin(NodeInfo &node_info) override
Definition join_algorithm_general.cpp:29
Definition interface_join_algorithm.h:18
Usage: This message is an answer to a MessageGetNeighbors. It contains the node information about the...
Definition inform_about_neighbors.h:18
Usage: After receiving a MessageJoinAccept, the new child must send a MessageJoinAcceptAck back to th...
Definition join_accept_ack.h:19
Usage: A fitting join position has been found by forwarding the MessageJoin appropriately....
Definition join_accept.h:19
Usage: When a node wants to join the network, it sends a MessageJoin to one node in the network....
Definition join.h:19
Definition node_info.h:24
Definition physical_node_info.h:23
Definition minhton_watchdog_ns3.cpp:24