36 void setupIndexQueues();
37 void setupRequestingNodes();
38 void setupRootBehavior();
40 void executeOneJoinByPosition(uint32_t level, uint32_t number);
41 void executeOneJoinByIndex(uint16_t index);
42 void executeOneJoinOnRoot();
43 void executeOneRandomJoin();
44 void executeOneJoinDiscover();
46 void executeOneLeaveByPosition(uint32_t level, uint32_t number);
47 void executeOneLeaveByIndex(uint16_t index);
48 void executeOneLeaveOnRoot();
49 void executeOneRandomLeave();
51 void executeOneFailByPosition(uint32_t level, uint32_t number);
52 void executeOneFailByIndex(uint16_t index);
53 void executeOneRandomFail();
55 void initiateJoinNow(uint32_t node_to_join_to_index, uint32_t entering_node_index);
56 void initiateJoinNowDiscover(uint32_t entering_node_index);
57 void initiateLeaveNow(uint64_t node_to_leave_to_index);
58 void initiateFailureNow(uint64_t node_to_fail_to_index);
60 void scheduleSearchExactAll(ns3::Time delay);
61 void scheduleSearchExactMany(ns3::Time delay, uint32_t number);
62 void executeOneSearchExact(ns3::Ptr<MinhtonApplication> src_app, uint32_t dest_level,
63 uint32_t dest_number);
64 void executeOneRandomSearchExact();
66 void executeStaticNetworkBuild(uint32_t number);
68 void scheduleMixedExecution(uint64_t join_num, uint64_t leave_num, uint64_t search_num,
69 ns3::Time current_time, ns3::Time delay);
70 void scheduleValidateLeave(ns3::Time delay);
72 uint64_t getRootIndex();
73 std::vector<uint64_t> getInitializedNodeIndexes();
74 std::tuple<std::vector<uint64_t>, std::vector<std::tuple<uint16_t, uint16_t>>>
75 getExistingPositions();
76 ns3::Ptr<MinhtonApplication> getApplicationAtPosition(uint32_t level, uint32_t number);
78 std::deque<uint64_t> uninit_index_deque_;
79 std::deque<uint64_t> init_index_deque_;
80 uint64_t latest_root_index_ = 0;
83 void schedule(
JoinOne step, ns3::Time ¤t_time);
84 void schedule(
JoinMany step, ns3::Time ¤t_time);
85 void schedule(
LeaveOne step, ns3::Time ¤t_time);
86 void schedule(
LeaveMany step, ns3::Time ¤t_time);
87 void schedule(
SearchMany step, ns3::Time ¤t_time);
88 void schedule(
SearchAll step, ns3::Time ¤t_time);
89 void schedule(
FailOne step, ns3::Time ¤t_time);
90 void schedule(
FailMany step, ns3::Time ¤t_time);
93 void schedule(
FindQuery step, ns3::Time ¤t_time);
95 void schedule(
Time step, ns3::Time ¤t_time);
96 void schedule(
StaticBuild step, ns3::Time ¤t_time);
98 void parseNodeAttributes();
100 void setRequestNodeSetup(
Absolute absolute);
101 void setRequestFrequencySetup(
Gaussian gaussian);
102 void setRequestFrequencySetup(
StaticTime static_time);
103 void setRequestDepthSetup(
Uniform uniform);
104 void setRequestDepthSetup(
Static static_val);
109 struct NodeAttribute {
112 minhton::NodeData::ValueType value_type;
114 float presence_percentage;
119 ns3::Ptr<ns3::RandomVariableStream> content_distribution;
122 bool content_is_numerical;
126 std::unordered_map<uint8_t, minhton::NodeData::Value> empirical_value_mapping;
128 minhton::NodeData::Value getRandomContent() {
129 minhton::NodeData::Value value;
131 if (content_is_numerical) {
132 value = (float)content_distribution->GetValue();
134 uint8_t num_val = content_distribution->GetInteger();
135 value = empirical_value_mapping[num_val];
141 void parseRequests();
142 void setAttributeContentBehavior(
Choice choice, Scheduler::NodeAttribute &node_attribute);
143 void setAttributeContentBehavior(
Constant constant, Scheduler::NodeAttribute &node_attribute);
144 void setAttributeContentBehavior(
Gaussian gaussian, Scheduler::NodeAttribute &node_attribute);
145 void setAttributeContentBehavior(
Uniform uniform, Scheduler::NodeAttribute &node_attribute);
146 void setAttributeUpdateBehavior(
ConstantTime constant, NodeAttribute &node_attribute);
147 void setAttributeUpdateBehavior(
Gaussian gaussian, NodeAttribute &node_attribute);
148 void setAttributeUpdateBehavior(
Uniform uniform, NodeAttribute &node_attribute);
149 void setAttributeUpdateBehavior(
StaticUpdate static_update, NodeAttribute &node_attribute);
151 std::vector<NodeAttribute> node_content_attributes_;
152 std::vector<std::string> attribute_names_;
159 std::optional<float> random_nodes_percentage;
160 std::optional<int> absolute_nodes_number;
162 bool query_inquire_outdated =
false;
163 bool query_inquire_unknown =
false;
167 void initiatePeerDiscoverEnvironmentAfterStaticBuild(ns3::Ptr<MinhtonApplication> app,
169 void initiatePeerDiscoverEnvironmentAfterJoin(ns3::Ptr<MinhtonApplication> app);
170 void initiatePeerDiscoverEnvironment(ns3::Ptr<MinhtonApplication> app,
171 uint64_t init_content_delay, uint64_t init_request_delay);
173 void initiateNodeContent(ns3::Ptr<MinhtonApplication> app);
174 void updateNodeAttribute(ns3::Ptr<MinhtonApplication> app, minhton::NodeData::Key key);
176 void initiateRequestsOnAllNodes();
177 void makeRequest(ns3::Ptr<MinhtonApplication> app);
179 std::shared_ptr<minhton::BooleanExpression> createBooleanExpression(uint8_t depth);
180 std::shared_ptr<minhton::BooleanExpression> createBooleanExpressionRecursive(
181 std::vector<minhton::NodeData::Key> open_keys);
182 std::shared_ptr<minhton::BooleanExpression> createBooleanExpressionForKey(
183 minhton::NodeData::Key key);
184 void activateRequestCountdown(uint16_t limit);
186 std::uniform_real_distribution<double> uniform_zero_one_distribution_ =
187 std::uniform_real_distribution<double>(0.0, 1.0);
189 bool attributes_off_ =
false;
190 bool requests_off_ =
false;
192 uint16_t requests_counter_ = 0;
193 uint16_t requests_limit_ = 0;
194 bool requests_limit_on_ =
false;
196 std::vector<std::string> requesting_nodes_ips_;