SOLA
Loading...
Searching...
No Matches
Public Member Functions | List of all members
minhton::DSNHandler Class Reference

Public Member Functions

 DSNHandler (std::shared_ptr< RoutingInformation > routing_info, std::function< void(const NodeInfo &node)> request_attribute_inquiry_callback)
 
bool isActive ()
 
std::vector< std::tuple< NodeInfo, std::vector< NodeData::Key > > > getUndecidedNodesAndMissingKeys (FindQuery &query, bool all_information_present, const uint64_t &timestamp_now)
 
std::vector< NodeInfogetTrueNodes (FindQuery &query, const uint64_t &timestamp_now)
 
void onNeighborChangeNotification (const minhton::NodeInfo &neighbor, NeighborRelationship relationship)
 
void onNodeInfoChangeNotification (const minhton::NodeInfo &previous_node_info, const minhton::NodeInfo &new_node_info)
 
void requestAttributeInformation (LogicalNodeInfo peer, const DistributedData &distr_data)
 
void updateInquiredOrSubscribedAttributeValues (const NodeInfo &inquired_or_updated_node, std::unordered_map< NodeData::Key, NodeData::ValueAndType > attribute_values_and_types, uint64_t update_timestamp)
 
void updateRemovedAttributes (const NodeInfo &inquired_node, std::vector< NodeData::Key > removed_keys)
 
std::unordered_map< LogicalNodeInfo, DistributedData, LogicalNodeInfoHashergetCoverData () const
 
void notifyAboutQueryRequest (const FindQuery &query, uint64_t request_timestamp)
 
std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHashergetNodesAndKeysToSubscribe (uint64_t const &timestamp_now)
 
std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHashergetNodesAndKeysToUnsubscribe (uint64_t const &timestamp_now)
 
void setPlacedSubscriptionOrders (std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHasher > subscription_orders_map)
 
void setPlacedUnsubscriptionOrders (std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHasher > unsubscription_orders_map)
 
NodeData::Attributes getNodeAttributes (const NodeInfo &node)
 

Member Function Documentation

◆ getCoverData()

std::unordered_map< LogicalNodeInfo, DistributedData, LogicalNodeInfoHasher > minhton::DSNHandler::getCoverData ( ) const
Returns
current cover data

◆ getTrueNodes()

std::vector< NodeInfo > minhton::DSNHandler::getTrueNodes ( FindQuery query,
const uint64_t &  timestamp_now 
)

Determine which nodes are true for a given find query. For this we use our current cover area information.

Parameters
queryfind query which we want to answer
timestamp_nowcurrenttimestamp to decide which values are outdated
Returns
a vector of nodes which are definitely true

◆ getUndecidedNodesAndMissingKeys()

std::vector< std::tuple< NodeInfo, std::vector< NodeData::Key > > > minhton::DSNHandler::getUndecidedNodesAndMissingKeys ( FindQuery query,
bool  all_information_present,
const uint64_t &  timestamp_now 
)

When answering find queries we need to know which nodes are undecided and about which keys we need further information. For this we use our current cover area information.

Parameters
queryfind query which we want to answer
all_information_presentboolean whether we can assume that we received all information we need to know, or not yet
timestamp_nowcurrent timestamp to decide which values are outdated
Returns
a vector of nodes which are undecided, including a vector of their missing keys

◆ isActive()

bool minhton::DSNHandler::isActive ( )

TODO unit tests

This method tells us whether this node is an active DSN or not. If we are not at a DSN position, it returns false. If we are at a DSN position but then change to a non-DSN position, it will return false and our information gets reset by the checkPosition() method.

Returns
true if this node is an active DSN

◆ onNeighborChangeNotification()

void minhton::DSNHandler::onNeighborChangeNotification ( const minhton::NodeInfo neighbor,
NeighborRelationship  relationship 
)

If a neighbor in routing information is being changed, this method will be called. If this change happened within our cover area, we need to update our cover area information accordingly.

Parameters
neighborthe node that has been changed
relationshipour relationship to the neighbor

◆ updateInquiredOrSubscribedAttributeValues()

void minhton::DSNHandler::updateInquiredOrSubscribedAttributeValues ( const NodeInfo inquired_or_updated_node,
std::unordered_map< NodeData::Key, NodeData::ValueAndType >  attribute_values_and_types,
uint64_t  update_timestamp 
)

If we have subscribed or inquired an attributes value and get a response via a AttributeInquiryAnswer or SubscriptionUpdate message, this method will be called.

We update our stored information about the node accordingly.

Parameters
inquired_nodethe node about which we gain updated information
attribute_values_and_typesmap from attribute keys to its values and types
update_timestampcurrent timestamp

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