Skip to content

Commit

Permalink
refactor(minhton): Use SolaNet SERIALIZE macro
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
ltoenning authored and janagoe committed Oct 12, 2023
1 parent 8007aa7 commit 4f13236
Show file tree
Hide file tree
Showing 44 changed files with 50 additions and 66 deletions.
6 changes: 3 additions & 3 deletions daisi/src/minhton-ns3/adapter/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ target_sources(minhton_algorithms_sim
${MINHTON_SOURCE_DIR}/src/algorithms/esearch/minhton_entity_search_algorithm_helper.cpp
)

target_include_directories(minhton_algorithms_sim
target_include_directories(minhton_algorithms_sim
PUBLIC
${MINHTON_SOURCE_DIR}/include
)
target_link_libraries(minhton_algorithms_sim
target_link_libraries(minhton_algorithms_sim
PUBLIC
minhton_core_physical_node_info
minhton_core_node_info_sim
minhton_core_routing_table_sim
minhton_message_serialize
solanet_serialize
minhton_message_sim
minhton_core_definitions
minhton_core_access_container_sim
Expand Down
4 changes: 2 additions & 2 deletions daisi/src/minhton-ns3/adapter/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ target_link_libraries(minhton_core_node_info_sim
PUBLIC
minhton_core_physical_node_info
minhton_core_logical_node_info_sim
minhton_message_serialize
solanet_serialize
)

# Logical node info
Expand All @@ -99,7 +99,7 @@ target_include_directories(minhton_core_logical_node_info_sim
)
target_link_libraries(minhton_core_logical_node_info_sim
PUBLIC
minhton_message_serialize
solanet_serialize
solanet_uuid
solanet_uuid_generator_sim
PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion daisi/src/minhton-ns3/adapter/message/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ target_link_libraries(minhton_message_sim
minhton_algorithms_sim # For esearch/NodeData/FindQuery
minhton_core_node_info_sim
minhton_core_constants
minhton_message_serialize
solanet_serialize
PRIVATE
minhton_exception_algorithm
minhton_core_routing_calculations
Expand Down
2 changes: 1 addition & 1 deletion docs/minhton/programmers/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ What needs to be done for adding a new message type:

- Create a new header file in `include/minhton/message` (Tip: Use join.h as a guideline)
- Make sure to use a unique name for the ifndef include guide
- Make sure to include `#include "minhton/message/message.h"` and `#include "minhton/message/serialize.h"`
- Make sure to include `#include "minhton/message/message.h"` and `#include "solanet/serializer/serialize.h"`
- Place a `SERIALIZE(...)` with required attributes under public visibility (Tip: Look at `include/minhton/algorithms/esearch/find_query.h` if the message type needs separate load and save functions)
- Apart from the constructor for general usage which should have all parameters to create a valid message, a default constructor is required for serialization purposes.
- Always required and the same are the `protected` fields that all message types must have.
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/algorithms/esearch/find_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "minhton/algorithms/esearch/local_data.h"
#include "minhton/algorithms/esearch/node_data.h"
#include "minhton/core/node_info.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
class FindQuery {
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/algorithms/esearch/node_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>

#include "minhton/core/node_info.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {

Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/core/logical_node_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <string>

#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"
#include "solanet/uuid.h"
#include "solanet/uuid_generator.h"

Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/core/node_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "minhton/core/logical_node_info.h"
#include "minhton/core/physical_node_info.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {

Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/core/physical_node_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>
#include <vector>

#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
#define PORT_MIN 1024
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/attribute_inquiry_answer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "minhton/algorithms/esearch/node_data.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The message that the node which received a MessageAttributeInquiryRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <vector>

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node that is not a DSN may receive a MessageAttributeInquiryRequest during
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/bootstrap_discover.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_BOOTSTRAP_DISCOVER_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node wants to join the network but does not have access to a node's
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/bootstrap_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_BOOTSTRAP_RESPONSE_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** After receiving a MessageBootstrapDiscover, the node receiving the message
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/empty.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_EMPTY_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A helper message type for the Search Exact Test. It has no functionality by
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/find_query_answer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "minhton/algorithms/esearch/node_data.h"
#include "minhton/core/node_info.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A DSN sends a MessageFindQueryAnswer back to the requesting node (that sent
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/find_query_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "minhton/algorithms/esearch/find_query.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node that wants to find data in the network can call the Entity Search
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/find_replacement.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/message/find_end.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node wants to leave the network, but cannot leave the position directly
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/get_neighbors.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_GET_NEIGHBORS_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** Currently only used in the join accept procedure in rare cases by the parent
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/inform_about_neighbors.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_INFORM_ABOUT_NEIGHBORS_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** This message is an answer to a MessageGetNeighbors. It contains the node
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/join.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/message/find_end.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** When a node wants to join the network, it sends a MessageJoin to one node in
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/join_accept.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_JOIN_ACCEPT_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A fitting join position has been found by forwarding the MessageJoin
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/join_accept_ack.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_JOIN_ACCEPT_ACK_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** After receiving a MessageJoinAccept, the new child must send a
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/lock_neighbor_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_LOCK_NEIGHBOR_REQUEST_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The parent of a successor node sends a Lock Neighbor Request to its right
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/lock_neighbor_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_LOCK_NEIGHBOR_RESPONSE_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The answer to a MessageLockNeighborRequest, received by the parent of a
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/message_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "minhton/core/constants.h"
#include "minhton/core/node_info.h"
#include "minhton/message/message_logging.h"
#include "minhton/message/serialize.h"
#include "minhton/message/types.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "minhton/message/message.h"
#include "minhton/message/remove_neighbor.h"
#include "minhton/message/serialize.h"
#include "minhton/message/update_neighbors.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** Used in the leave and response algorithms for updating the routing
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/remove_neighbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REMOVE_NEIGHBOR_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node is leaving the network. This is a notification to remove the given
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/remove_neighbor_ack.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REMOVE_NEIGHBOR_ACK_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** Is sent as a reply to either a MessageReplacementUpdate or
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/replacement_ack.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REPLACEMENT_ACK_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The node that wants to leave the network receives a MessageReplacementOffer
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/replacement_nack.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REPLACEMENT_NACK_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A MessageReplacementNack is sent back to the node to replace in case of a
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/replacement_offer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REPLACEMENT_OFFER_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A MessageFindReplacement reached a node that can replace the leaving node.
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/replacement_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_REPLACEMENT_UPDATE_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** During the replacement process, the neighbor nodes of the leaving node / the
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/search_exact.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/message/message.h"
#include "minhton/message/se_types.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node wants to send a message to another node in the network, but does not
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/search_exact_failure.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/message/message.h"
#include "minhton/message/se_types.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** If a node cannot further forward a MessageSearchExact, but is also not the
Expand Down
13 changes: 0 additions & 13 deletions minhton/include/minhton/message/serialize.h

This file was deleted.

2 changes: 1 addition & 1 deletion minhton/include/minhton/message/signoff_parent_answer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_SIGNOFF_PARENT_ANSWER_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The successor node waits for the MessageSignoffParentAnswer from its parent
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/signoff_parent_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_SIGNOFF_PARENT_REQUEST_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** The last node of the network, the chosen successor, sends a
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/subscription_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/algorithms/esearch/node_data.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** A node can send a MessageSubscriptionOrder to subscribe or unsubscribe
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/subscription_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "minhton/algorithms/esearch/node_data.h"
#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** If a node's local data is modified (inserted, updated or removed), it will
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/unlock_neighbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_UNLOCK_NEIGHBOR_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

namespace minhton {
/// @brief * **Usage:** Used for unlocking nodes after they were locked during a concurrent
Expand Down
2 changes: 1 addition & 1 deletion minhton/include/minhton/message/update_neighbors.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MINHTON_MESSAGE_UPDATE_NEIGHBORS_H_

#include "minhton/message/message.h"
#include "minhton/message/serialize.h"
#include "solanet/serializer/serialize.h"

using NeighborsAndRelationships =
std::vector<std::tuple<minhton::NodeInfo, minhton::NeighborRelationship>>;
Expand Down
Loading

0 comments on commit 4f13236

Please sign in to comment.