#include <dataContext.hpp>
Public Member Functions | |
| DataContext (Config &config, bool with_publisher=true, bool with_oldb=true) | |
| virtual | ~DataContext () |
| void | ReloadConfig () |
| void | UpdateDb () |
| Config & | GetConfig () |
| State::StateEnum | GetState () |
| Get server actual state. | |
| void | SetState (const State::StateEnum state) |
| Set server actual state. | |
| void | SetState (const std::string &state) |
| Set server actual state. | |
| State::SubstateEnum | GetSubstate () |
| Get server actual substate. | |
| void | SetSubstate (const State::SubstateEnum state) |
| Set server actual substate. | |
| void | SetSubstate (const std::string &state) |
| Set server actual substate. | |
| State::StateEnum | GetEstimatedState () |
| Get actual estimated state. | |
| std::string | GetEstimatedStateStr () |
| Set actual estimated state as string. | |
| void | SetEstimatedState (const State::StateEnum state) |
| Set actual estimated state. | |
| std::string | GetEstimatedSubstateStr () |
| Get actual estimated substate as string. | |
| State::SubstateEnum | GetEstimatedSubstate () |
| Get actual estimated substate. | |
| void | SetEstimatedSubstate (const State::SubstateEnum state) |
| Set actual estimated substate. | |
| void | UpdateObMode (const std::string &mode) |
| void | UpdateSubsysStates (const std::string &name, const std::string &state, const std::string &substate) |
| void | PublishStates () |
| Publish actual states. | |
| std::string | GetObsMode () const |
This class provide access to the application run-time data including the in-memory DB. This class also takes care of publishing the status information
This class write the supervisor configuration and runtime data into the OLDB. The DB structure used is the following:
<prefix>/<server_id>: | |–cfg | – server_id – ... |–states | |– state |– substate |–subsystems | – subsys1 | | – states | |– state |– substate
The publishing of the status is the estimated state/substate of the supervisor and it follows the following convention.
<endpoint>/std/status
The topic is used is the one defined in the standard interface which is a string with the following format: <state>;<substate>
| ifw::sup::syssup::common::DataContext::DataContext | ( | Config & | config, |
| bool | with_publisher = true, | ||
| bool | with_oldb = true ) |
This constructor uses the application configuration to initialize the adapter object to the in-memory DB. The DB adapter is then used to initialize the DB interface object that can be used to access the DB key-value pairs.
| [in] | config | Reference to the application configuration. |
| [in] | with_publisher | Flag to enable/disable the publishing used in unit tests. |
| [in] | with_oldb | Flag to enable/disable the DB writes used in unit tests. |
|
virtual |
Destructor
| Config & ifw::sup::syssup::common::DataContext::GetConfig | ( | ) |
| State::StateEnum ifw::sup::syssup::common::DataContext::GetEstimatedState | ( | ) |
Get actual estimated state.
| std::string ifw::sup::syssup::common::DataContext::GetEstimatedStateStr | ( | ) |
Set actual estimated state as string.
| State::SubstateEnum ifw::sup::syssup::common::DataContext::GetEstimatedSubstate | ( | ) |
Get actual estimated substate.
| std::string ifw::sup::syssup::common::DataContext::GetEstimatedSubstateStr | ( | ) |
Get actual estimated substate as string.
|
inline |
| State::StateEnum ifw::sup::syssup::common::DataContext::GetState | ( | ) |
Get server actual state.
| State::SubstateEnum ifw::sup::syssup::common::DataContext::GetSubstate | ( | ) |
Get server actual substate.
| void ifw::sup::syssup::common::DataContext::PublishStates | ( | ) |
Publish actual states.
It updates the OLDB and publish status via CII pub/sub.
| void ifw::sup::syssup::common::DataContext::ReloadConfig | ( | ) |
Reload the configuration from file and reconnect to the in-memory DB.
| void ifw::sup::syssup::common::DataContext::SetEstimatedState | ( | const State::StateEnum | state | ) |
Set actual estimated state.
| state | new state as string |
| void ifw::sup::syssup::common::DataContext::SetEstimatedSubstate | ( | const State::SubstateEnum | state | ) |
Set actual estimated substate.
| state | new substate as string |
| void ifw::sup::syssup::common::DataContext::SetState | ( | const State::StateEnum | state | ) |
Set server actual state.
| state | new state as enumeration |
| void ifw::sup::syssup::common::DataContext::SetState | ( | const std::string & | state | ) |
Set server actual state.
| state | new state as string |
| void ifw::sup::syssup::common::DataContext::SetSubstate | ( | const State::SubstateEnum | state | ) |
Set server actual substate.
| state | new substate as enumeration |
| void ifw::sup::syssup::common::DataContext::SetSubstate | ( | const std::string & | state | ) |
Set server actual substate.
| state | new substate as string |
| void ifw::sup::syssup::common::DataContext::UpdateDb | ( | ) |
Try to connect to the DB and update the application configuration.
| void ifw::sup::syssup::common::DataContext::UpdateObMode | ( | const std::string & | mode | ) |
| void ifw::sup::syssup::common::DataContext::UpdateSubsysStates | ( | const std::string & | name, |
| const std::string & | state, | ||
| const std::string & | substate ) |