SOLA
|
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 ×tamp_now) |
std::vector< NodeInfo > | getTrueNodes (FindQuery &query, const uint64_t ×tamp_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, LogicalNodeInfoHasher > | getCoverData () const |
void | notifyAboutQueryRequest (const FindQuery &query, uint64_t request_timestamp) |
std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHasher > | getNodesAndKeysToSubscribe (uint64_t const ×tamp_now) |
std::unordered_map< NodeInfo, std::vector< NodeData::Key >, NodeInfoHasher > | getNodesAndKeysToUnsubscribe (uint64_t const ×tamp_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) |
std::unordered_map< LogicalNodeInfo, DistributedData, LogicalNodeInfoHasher > minhton::DSNHandler::getCoverData | ( | ) | const |
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.
query | find query which we want to answer |
timestamp_nowcurrent | timestamp to decide which values are outdated |
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.
query | find query which we want to answer |
all_information_present | boolean whether we can assume that we received all information we need to know, or not yet |
timestamp_now | current timestamp to decide which values are outdated |
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.
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.
neighbor | the node that has been changed |
relationship | our relationship to the neighbor |
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.
inquired_node | the node about which we gain updated information |
attribute_values_and_types | map from attribute keys to its values and types |
update_timestamp | current timestamp |