policy.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. //
  3. // Copyright (c) 2019-2022 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
  4. //
  5. // Distributed under the MIT Software License
  6. //
  7. namespace rotor {
  8. /** \brief how to behave on child actor initialization failures */
  9. enum class supervisor_policy_t {
  10. /** \brief shutdown supervisor (and all its actors) if a child-actor
  11. * fails during supervisor initialization phase
  12. */
  13. shutdown_self = 1,
  14. /** \brief shutdown a failed child and continue initialization */
  15. shutdown_failed,
  16. };
  17. /** \brief spawner's actor restart policy */
  18. enum class restart_policy_t {
  19. /** \brief always restart actor */
  20. always,
  21. /** \brief never restart actor */
  22. never,
  23. /** \brief ask terminated actor whether a new instance should be spawned
  24. * `should_restart()` method is used
  25. */
  26. ask_actor,
  27. /** \brief restart actor only when it terminated normally (without error) */
  28. normal_only,
  29. /** \brief restart actor only when it terminated abnormally (with error) */
  30. fail_only,
  31. };
  32. } // namespace rotor