mirror of https://github.com/Icinga/icinga2.git
Update DB IDO on changed object version (create, update, delete)
refs #9927
This commit is contained in:
parent
b2715943c6
commit
a6d8cea5c2
|
@ -49,6 +49,9 @@ void DbObject::StaticInitialize(void)
|
||||||
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
|
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
|
||||||
ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1));
|
ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1));
|
||||||
CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1));
|
CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1));
|
||||||
|
|
||||||
|
/* triggered on create, update and delete objects */
|
||||||
|
ConfigObject::OnVersionChanged.connect(boost::bind(&DbObject::VersionChangedHandler, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbObject::SetObject(const ConfigObject::Ptr& object)
|
void DbObject::SetObject(const ConfigObject::Ptr& object)
|
||||||
|
@ -355,6 +358,16 @@ void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
|
||||||
dbobj->SendVarsStatusUpdate();
|
dbobj->SendVarsStatusUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbObject::VersionChangedHandler(const ConfigObject::Ptr& object)
|
||||||
|
{
|
||||||
|
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
|
||||||
|
|
||||||
|
if (dbobj) {
|
||||||
|
dbobj->SendConfigUpdate();
|
||||||
|
dbobj->SendStatusUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boost::mutex& DbObject::GetStaticMutex(void)
|
boost::mutex& DbObject::GetStaticMutex(void)
|
||||||
{
|
{
|
||||||
static boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
|
|
|
@ -106,6 +106,8 @@ private:
|
||||||
|
|
||||||
static void StateChangedHandler(const ConfigObject::Ptr& object);
|
static void StateChangedHandler(const ConfigObject::Ptr& object);
|
||||||
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
||||||
|
static void VersionChangedHandler(const ConfigObject::Ptr& object);
|
||||||
|
|
||||||
static boost::mutex& GetStaticMutex(void);
|
static boost::mutex& GetStaticMutex(void);
|
||||||
|
|
||||||
friend class DbType;
|
friend class DbType;
|
||||||
|
|
Loading…
Reference in New Issue