depot_deploy: status report
The idea is, that other components may know, when a valid init.config is available. Issue #3482
This commit is contained in:
parent
530144b040
commit
c0789a6c0e
|
@ -133,6 +133,14 @@ class Depot_deploy::Children
|
||||||
child.gen_installation_entry(xml); });
|
child.gen_installation_entry(xml); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t count() const
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
_children.for_each([&] (Child const &) {
|
||||||
|
++count; });
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
bool any_incomplete() const {
|
bool any_incomplete() const {
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <util/retry.h>
|
#include <util/retry.h>
|
||||||
|
#include <util/reconstructible.h>
|
||||||
#include <base/component.h>
|
#include <base/component.h>
|
||||||
#include <base/attached_rom_dataspace.h>
|
#include <base/attached_rom_dataspace.h>
|
||||||
#include <base/heap.h>
|
#include <base/heap.h>
|
||||||
|
@ -34,6 +35,8 @@ struct Depot_deploy::Main
|
||||||
Expanding_reporter _query_reporter { _env, "query" , "query"};
|
Expanding_reporter _query_reporter { _env, "query" , "query"};
|
||||||
Expanding_reporter _init_config_reporter { _env, "config", "init.config"};
|
Expanding_reporter _init_config_reporter { _env, "config", "init.config"};
|
||||||
|
|
||||||
|
Constructible<Expanding_reporter> _state_reporter { };
|
||||||
|
|
||||||
Heap _heap { _env.ram(), _env.rm() };
|
Heap _heap { _env.ram(), _env.rm() };
|
||||||
|
|
||||||
Children _children { _heap };
|
Children _children { _heap };
|
||||||
|
@ -48,6 +51,16 @@ struct Depot_deploy::Main
|
||||||
_config.update();
|
_config.update();
|
||||||
_blueprint.update();
|
_blueprint.update();
|
||||||
|
|
||||||
|
bool const report_state =
|
||||||
|
_config.xml().has_sub_node("report") &&
|
||||||
|
_config.xml().sub_node("report").attribute_value("state", false);
|
||||||
|
|
||||||
|
_state_reporter.conditional(report_state, _env, "state", "state");
|
||||||
|
|
||||||
|
if (_state_reporter.constructed())
|
||||||
|
_state_reporter->generate([&] (Xml_generator xml) {
|
||||||
|
xml.attribute("running", true); });
|
||||||
|
|
||||||
Xml_node const config = _config.xml();
|
Xml_node const config = _config.xml();
|
||||||
|
|
||||||
_children.apply_config(config);
|
_children.apply_config(config);
|
||||||
|
@ -76,6 +89,17 @@ struct Depot_deploy::Main
|
||||||
_children.gen_queries(xml);
|
_children.gen_queries(xml);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((_children.count() > 0UL)
|
||||||
|
&& !_children.any_incomplete()
|
||||||
|
&& !_children.any_blueprint_needed()
|
||||||
|
&& _state_reporter.constructed()) {
|
||||||
|
|
||||||
|
_state_reporter->generate([&] (Xml_generator xml) {
|
||||||
|
xml.attribute("running", false);
|
||||||
|
xml.attribute("count", _children.count());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Main(Env &env) : _env(env)
|
Main(Env &env) : _env(env)
|
||||||
|
@ -83,6 +107,7 @@ struct Depot_deploy::Main
|
||||||
_config .sigh(_config_handler);
|
_config .sigh(_config_handler);
|
||||||
_blueprint.sigh(_config_handler);
|
_blueprint.sigh(_config_handler);
|
||||||
|
|
||||||
|
|
||||||
_handle_config();
|
_handle_config();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue