Update DB IDO on changed object version (create, update, delete)

refs #9927
This commit is contained in:
Michael Friedrich 2015-09-15 11:59:09 +02:00
parent b2715943c6
commit a6d8cea5c2
2 changed files with 15 additions and 0 deletions

View File

@ -49,6 +49,9 @@ void DbObject::StaticInitialize(void)
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _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)
@ -355,6 +358,16 @@ void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
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)
{
static boost::mutex mutex;

View File

@ -106,6 +106,8 @@ private:
static void StateChangedHandler(const ConfigObject::Ptr& object);
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
static void VersionChangedHandler(const ConfigObject::Ptr& object);
static boost::mutex& GetStaticMutex(void);
friend class DbType;