拓扑图

This commit is contained in:
2026-08-10 00:08:47 +08:00
parent 14ad97c7c8
commit 39966da920
10 changed files with 387 additions and 436 deletions
@@ -269,58 +269,10 @@ void Data_Source_Handler::handle_HULC(std::string_view packet) {
}
}
void Data_Source_Handler::refresh_data_feed_key_list() {
auto* global = Global::instance();
std::map<std::string, std::string> assignment;
const auto sources = global->mode_acs.data_source_config.map.list();
const auto feeds = global->mode_acs.data_feed_config.map.list();
const auto relations = global->mode_acs.source_feed_relation_config.map.list();
for (const auto& relation : relations) {
relation->settings.read([&](const auto& config) {
if (!config.enable || relation->type != "One_to_One_Relation")
return;
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
const auto feed = global->mode_acs.data_feed_config.map.get(config.feed_key);
if (source.has_value() && feed.has_value() && source.value()->enabled() && feed.value()->enabled() && !assignment.contains(config.feed_key))
assignment.emplace(config.feed_key, config.source_key);
});
}
for (const auto& relation : relations) {
relation->settings.read([&](const auto& config) {
if (!config.enable || relation->type != "Name_One_To_Many_Relation")
return;
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
if (!source.has_value() || !source.value()->enabled())
return;
const std::string& prefix = config.feed_name.empty() ? config.source_key : config.feed_name;
for (const auto& feed : feeds) {
if (!feed->enabled() || assignment.contains(feed->key) || !feed->key.starts_with(prefix))
continue;
assignment.emplace(feed->key, config.source_key);
}
});
}
bool use_default = false;
for (const auto& relation : relations) {
if (relation->type == "First_Source_To_All_Feed_Relation" && relation->settings.member<&Source_Feed_Relation_Data::enable>().read([](const auto& value) { return value; })) {
use_default = true;
break;
}
}
if (use_default) {
auto first = std::find_if(sources.begin(), sources.end(), [](const auto& source) {
return source->enabled();
});
if (first != sources.end()) {
for (const auto& feed : feeds) {
if (feed->enabled() && !assignment.contains(feed->key))
assignment.emplace(feed->key, (*first)->key);
}
}
}
std::vector<Cached_Source_Info> next;
for (const auto& [feed_key, source_key] : assignment) {
if (source_key == key)
next.push_back({feed_key});
for (const auto& feed : Global::instance()->mode_acs.data_feed_config.map.list()) {
if (feed->enabled() && feed->source_key == key)
next.push_back({feed->key});
}
std::lock_guard<std::mutex> lock(cdf_mtx);
for (auto& item : next) {