20#ifndef MADS_UP_SUPERVISOR_HPP
21#define MADS_UP_SUPERVISOR_HPP
39struct UpManagedProcess;
43 std::optional<std::chrono::milliseconds>
timeout;
44 std::chrono::milliseconds
grace{5000};
59 std::optional<ProbeCurveKeys>
curve;
120 std::vector<ProcessConfig> _processes;
122 std::vector<std::unique_ptr<UpManagedProcess>> _managed;
123 std::atomic<bool> _stop_requested{
false};
125 bool start_one(UpManagedProcess &mp);
126 bool wait_ready(UpManagedProcess &mp, std::chrono::milliseconds timeout);
127 void stop_one(UpManagedProcess &mp, std::chrono::milliseconds grace);
129 UpManagedProcess *find(
const std::string &name);
Starts, supervises and tears down the processes described by an expanded Mads::DirectorConfig....
UpSupervisor & operator=(const UpSupervisor &)=delete
RunResult run()
Starts every enabled process in order (waiting on each one's ready probe before moving on to whatever...
UpSupervisor(const UpSupervisor &)=delete
bool stop_requested() const
True once request_stop() was called or run() decided to stop on its own.
UpSupervisor(std::vector< ProcessConfig > processes, UpOptions options)
int start_count(const std::string &name) const
std::optional< std::chrono::milliseconds > timeout
std::optional< std::string > until_exit
std::chrono::milliseconds ready_timeout
std::optional< ProbeCurveKeys > curve
std::chrono::milliseconds grace