Kagome
Polkadot Runtime Engine in C++17
|
#include <app_state_manager_impl.hpp>
Public Member Functions | |
AppStateManagerImpl () | |
AppStateManagerImpl (const AppStateManagerImpl &)=delete | |
AppStateManagerImpl (AppStateManagerImpl &&) noexcept=delete | |
~AppStateManagerImpl () override | |
AppStateManagerImpl & | operator= (AppStateManagerImpl const &)=delete |
AppStateManagerImpl & | operator= (AppStateManagerImpl &&) noexcept=delete |
void | atPrepare (OnPrepare &&cb) override |
Execute. More... | |
void | atLaunch (OnLaunch &&cb) override |
Execute. More... | |
void | atShutdown (OnShutdown &&cb) override |
Execute. More... | |
void | run () override |
Start application life cycle. More... | |
void | shutdown () override |
Initiate shutting down (at any time) More... | |
State | state () const override |
Get current stage. More... | |
Public Member Functions inherited from kagome::application::AppStateManager | |
virtual | ~AppStateManager ()=default |
void | registerHandlers (OnPrepare &&prepare_cb, OnLaunch &&launch_cb, OnShutdown &&shutdown_cb) |
Registration of all stages' handlers at the same time. More... | |
template<typename Controlled > | |
void | takeControl (Controlled &entity) |
Registration special methods of object as handlers for stages of application life-cycle. More... | |
Protected Member Functions | |
void | reset () |
void | doPrepare () override |
void | doLaunch () override |
void | doShutdown () override |
Static Private Member Functions | |
static void | shuttingDownSignalsHandler (int) |
Private Attributes | |
log::Logger | logger_ |
std::atomic< State > | state_ = State::Init |
std::recursive_mutex | mutex_ |
std::mutex | cv_mutex_ |
std::condition_variable | cv_ |
std::queue< OnPrepare > | prepare_ |
std::queue< OnLaunch > | launch_ |
std::queue< OnShutdown > | shutdown_ |
std::atomic_bool | shutdown_requested_ {false} |
Static Private Attributes | |
static std::weak_ptr< AppStateManager > | wp_to_myself |
Additional Inherited Members | |
Public Types inherited from kagome::application::AppStateManager | |
enum | State { State::Init, State::Prepare, State::ReadyToStart, State::Starting, State::Works, State::ShuttingDown, State::ReadyToStop } |
using | OnPrepare = std::function< bool()> |
using | OnLaunch = std::function< bool()> |
using | OnShutdown = std::function< void()> |
Definition at line 20 of file app_state_manager_impl.hpp.
kagome::application::AppStateManagerImpl::AppStateManagerImpl | ( | ) |
Definition at line 21 of file app_state_manager_impl.cpp.
|
delete |
|
deletenoexcept |
|
override |
Definition at line 38 of file app_state_manager_impl.cpp.
|
overridevirtual |
Execute.
cb | immediately before start application |
cb |
Implements kagome::application::AppStateManager.
Definition at line 70 of file app_state_manager_impl.cpp.
|
overridevirtual |
Execute.
cb | at stage of prepare application |
cb |
Implements kagome::application::AppStateManager.
Definition at line 62 of file app_state_manager_impl.cpp.
|
overridevirtual |
Execute.
cb | at stage of shutting down application |
cb |
Implements kagome::application::AppStateManager.
Definition at line 78 of file app_state_manager_impl.cpp.
|
overrideprotectedvirtual |
Implements kagome::application::AppStateManager.
Definition at line 111 of file app_state_manager_impl.cpp.
|
overrideprotectedvirtual |
Implements kagome::application::AppStateManager.
Definition at line 86 of file app_state_manager_impl.cpp.
|
overrideprotectedvirtual |
Implements kagome::application::AppStateManager.
Definition at line 136 of file app_state_manager_impl.cpp.
|
delete |
|
deletenoexcept |
|
protected |
Definition at line 53 of file app_state_manager_impl.cpp.
|
overridevirtual |
Start application life cycle.
Implements kagome::application::AppStateManager.
Definition at line 157 of file app_state_manager_impl.cpp.
|
overridevirtual |
Initiate shutting down (at any time)
Implements kagome::application::AppStateManager.
Definition at line 176 of file app_state_manager_impl.cpp.
|
staticprivate |
Definition at line 15 of file app_state_manager_impl.cpp.
|
inlineoverridevirtual |
Get current stage.
Implements kagome::application::AppStateManager.
Definition at line 38 of file app_state_manager_impl.hpp.
|
private |
Definition at line 60 of file app_state_manager_impl.hpp.
|
private |
Definition at line 59 of file app_state_manager_impl.hpp.
|
private |
Definition at line 63 of file app_state_manager_impl.hpp.
|
private |
Definition at line 53 of file app_state_manager_impl.hpp.
|
private |
Definition at line 57 of file app_state_manager_impl.hpp.
|
private |
Definition at line 62 of file app_state_manager_impl.hpp.
|
private |
Definition at line 64 of file app_state_manager_impl.hpp.
|
private |
Definition at line 66 of file app_state_manager_impl.hpp.
|
private |
Definition at line 55 of file app_state_manager_impl.hpp.
|
staticprivate |
Definition at line 50 of file app_state_manager_impl.hpp.