1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #pragma once
- #include "forward.hpp"
- #include "policy.h"
- namespace rotor {
- namespace details {
- enum class request_state_t { NONE, SENT, CONFIRMED };
- }
- struct spawner_t {
- ~spawner_t();
-
- spawner_t &&restart_period(const pt::time_duration &) noexcept;
-
- spawner_t &&restart_policy(restart_policy_t) noexcept;
-
- spawner_t &&max_attempts(size_t) noexcept;
-
- spawner_t &&escalate_failure(bool = true) noexcept;
-
- void spawn() noexcept;
- private:
- spawner_t(factory_t factory, supervisor_t &supervisor) noexcept;
- factory_t factory;
- supervisor_t &supervisor;
- pt::time_duration period = pt::seconds{15};
- restart_policy_t policy = restart_policy_t::normal_only;
- size_t attempts = 0;
- bool done = false;
- bool escalate = false;
- friend struct supervisor_t;
- };
- }
|