]> granicus.if.org Git - icinga2/commitdiff
Rename CommentCache/DowntimeCache to CommentsCache/DowntimesCache
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 13 Feb 2013 21:36:24 +0000 (22:36 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 13 Feb 2013 21:44:25 +0000 (22:44 +0100)
Fixes #3677

lib/icinga/service-comment.cpp
lib/icinga/service-downtime.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 1b1619fb0a7a514cbb510201495a496ede822ee4..dfeed2388770cf95026bd9d0ce7e87e9f5b1d6de 100644 (file)
 using namespace icinga;
 
 int Service::m_NextCommentID = 1;
-map<int, String> Service::m_LegacyCommentCache;
-map<String, Service::WeakPtr> Service::m_CommentCache;
-bool Service::m_CommentCacheValid;
-Timer::Ptr Service::m_CommentExpireTimer;
+map<int, String> Service::m_LegacyCommentsCache;
+map<String, Service::WeakPtr> Service::m_CommentsCache;
+bool Service::m_CommentsCacheValid;
+Timer::Ptr Service::m_CommentsExpireTimer;
 
 int Service::GetNextCommentID(void)
 {
@@ -34,7 +34,7 @@ int Service::GetNextCommentID(void)
 
 Dictionary::Ptr Service::GetComments(void) const
 {
-       Service::ValidateCommentCache();
+       Service::ValidateCommentsCache();
 
        return Get("comments");
 }
@@ -84,9 +84,9 @@ void Service::RemoveComment(const String& id)
 
 String Service::GetCommentIDFromLegacyID(int id)
 {
-       map<int, String>::iterator it = m_LegacyCommentCache.find(id);
+       map<int, String>::iterator it = m_LegacyCommentsCache.find(id);
 
-       if (it == m_LegacyCommentCache.end())
+       if (it == m_LegacyCommentsCache.end())
                return Empty;
 
        return it->second;
@@ -94,9 +94,9 @@ String Service::GetCommentIDFromLegacyID(int id)
 
 Service::Ptr Service::GetOwnerByCommentID(const String& id)
 {
-       ValidateCommentCache();
+       ValidateCommentsCache();
 
-       return m_CommentCache[id].lock();
+       return m_CommentsCache[id].lock();
 }
 
 Dictionary::Ptr Service::GetCommentByID(const String& id)
@@ -123,11 +123,11 @@ bool Service::IsCommentExpired(const Dictionary::Ptr& comment)
        return (expire_time != 0 && expire_time < Utility::GetTime());
 }
 
-void Service::InvalidateCommentCache(void)
+void Service::InvalidateCommentsCache(void)
 {
-       m_CommentCacheValid = false;
-       m_CommentCache.clear();
-       m_LegacyCommentCache.clear();
+       m_CommentsCacheValid = false;
+       m_CommentsCache.clear();
+       m_LegacyCommentsCache.clear();
 }
 
 void Service::AddCommentsToCache(void)
@@ -145,7 +145,7 @@ void Service::AddCommentsToCache(void)
                if (legacy_id >= m_NextCommentID)
                        m_NextCommentID = legacy_id + 1;
 
-               if (m_LegacyCommentCache.find(legacy_id) != m_LegacyCommentCache.end()) {
+               if (m_LegacyCommentsCache.find(legacy_id) != m_LegacyCommentsCache.end()) {
                        /* The legacy_id is already in use by another comment;
                         * this shouldn't usually happen - assign it a new ID */
 
@@ -154,18 +154,18 @@ void Service::AddCommentsToCache(void)
                        Touch("comments");
                }
 
-               m_LegacyCommentCache[legacy_id] = id;
-               m_CommentCache[id] = GetSelf();
+               m_LegacyCommentsCache[legacy_id] = id;
+               m_CommentsCache[id] = GetSelf();
        }
 }
 
-void Service::ValidateCommentCache(void)
+void Service::ValidateCommentsCache(void)
 {
-       if (m_CommentCacheValid)
+       if (m_CommentsCacheValid)
                return;
 
-       m_CommentCache.clear();
-       m_LegacyCommentCache.clear();
+       m_CommentsCache.clear();
+       m_LegacyCommentsCache.clear();
 
        DynamicObject::Ptr object;
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicType::GetByName("Service")->GetObjects()) {
@@ -173,13 +173,13 @@ void Service::ValidateCommentCache(void)
                service->AddCommentsToCache();
        }
 
-       m_CommentCacheValid = true;
+       m_CommentsCacheValid = true;
 
-       if (!m_CommentExpireTimer) {
-               m_CommentExpireTimer = boost::make_shared<Timer>();
-               m_CommentExpireTimer->SetInterval(300);
-               m_CommentExpireTimer->OnTimerExpired.connect(boost::bind(&Service::CommentExpireTimerHandler));
-               m_CommentExpireTimer->Start();
+       if (!m_CommentsExpireTimer) {
+               m_CommentsExpireTimer = boost::make_shared<Timer>();
+               m_CommentsExpireTimer->SetInterval(300);
+               m_CommentsExpireTimer->OnTimerExpired.connect(boost::bind(&Service::CommentsExpireTimerHandler));
+               m_CommentsExpireTimer->Start();
        }
 }
 
@@ -208,7 +208,7 @@ void Service::RemoveExpiredComments(void)
        }
 }
 
-void Service::CommentExpireTimerHandler(void)
+void Service::CommentsExpireTimerHandler(void)
 {
        DynamicObject::Ptr object;
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicType::GetByName("Service")->GetObjects()) {
index c9a18c9a79744d7d33725a2933ddea98c975ae5c..2c7df0cfe5c9e1464618d472b52fedd6b5f3a6ac 100644 (file)
 using namespace icinga;
 
 int Service::m_NextDowntimeID = 1;
-map<int, String> Service::m_LegacyDowntimeCache;
-map<String, Service::WeakPtr> Service::m_DowntimeCache;
-bool Service::m_DowntimeCacheValid;
-Timer::Ptr Service::m_DowntimeExpireTimer;
+map<int, String> Service::m_LegacyDowntimesCache;
+map<String, Service::WeakPtr> Service::m_DowntimesCache;
+bool Service::m_DowntimesCacheValid;
+Timer::Ptr Service::m_DowntimesExpireTimer;
 
 int Service::GetNextDowntimeID(void)
 {
@@ -34,7 +34,7 @@ int Service::GetNextDowntimeID(void)
 
 Dictionary::Ptr Service::GetDowntimes(void) const
 {
-       Service::ValidateDowntimeCache();
+       Service::ValidateDowntimesCache();
 
        return Get("downtimes");
 }
@@ -131,11 +131,11 @@ void Service::TriggerDowntime(const String& id)
 
 String Service::GetDowntimeIDFromLegacyID(int id)
 {
-       ValidateDowntimeCache();
+       ValidateDowntimesCache();
 
-       map<int, String>::iterator it = m_LegacyDowntimeCache.find(id);
+       map<int, String>::iterator it = m_LegacyDowntimesCache.find(id);
 
-       if (it == m_LegacyDowntimeCache.end())
+       if (it == m_LegacyDowntimesCache.end())
                return Empty;
 
        return it->second;
@@ -143,9 +143,9 @@ String Service::GetDowntimeIDFromLegacyID(int id)
 
 Service::Ptr Service::GetOwnerByDowntimeID(const String& id)
 {
-       ValidateDowntimeCache();
+       ValidateDowntimesCache();
 
-       return m_DowntimeCache[id].lock();
+       return m_DowntimesCache[id].lock();
 }
 
 Dictionary::Ptr Service::GetDowntimeByID(const String& id)
@@ -189,11 +189,11 @@ bool Service::IsDowntimeExpired(const Dictionary::Ptr& downtime)
        return (downtime->Get("end_time") < Utility::GetTime());
 }
 
-void Service::InvalidateDowntimeCache(void)
+void Service::InvalidateDowntimesCache(void)
 {
-       m_DowntimeCacheValid = false;
-       m_DowntimeCache.clear();
-       m_LegacyDowntimeCache.clear();
+       m_DowntimesCacheValid = false;
+       m_DowntimesCache.clear();
+       m_LegacyDowntimesCache.clear();
 }
 
 void Service::AddDowntimesToCache(void)
@@ -211,7 +211,7 @@ void Service::AddDowntimesToCache(void)
                if (legacy_id >= m_NextDowntimeID)
                        m_NextDowntimeID = legacy_id + 1;
 
-               if (m_LegacyDowntimeCache.find(legacy_id) != m_LegacyDowntimeCache.end()) {
+               if (m_LegacyDowntimesCache.find(legacy_id) != m_LegacyDowntimesCache.end()) {
                        /* The legacy_id is already in use by another downtime;
                         * this shouldn't usually happen - assign it a new ID. */
                        legacy_id = m_NextDowntimeID++;
@@ -219,18 +219,18 @@ void Service::AddDowntimesToCache(void)
                        Touch("downtimes");
                }
 
-               m_LegacyDowntimeCache[legacy_id] = id;
-               m_DowntimeCache[id] = GetSelf();
+               m_LegacyDowntimesCache[legacy_id] = id;
+               m_DowntimesCache[id] = GetSelf();
        }
 }
 
-void Service::ValidateDowntimeCache(void)
+void Service::ValidateDowntimesCache(void)
 {
-       if (m_DowntimeCacheValid)
+       if (m_DowntimesCacheValid)
                return;
 
-       m_DowntimeCache.clear();
-       m_LegacyDowntimeCache.clear();
+       m_DowntimesCache.clear();
+       m_LegacyDowntimesCache.clear();
 
        DynamicObject::Ptr object;
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicType::GetByName("Service")->GetObjects()) {
@@ -238,13 +238,13 @@ void Service::ValidateDowntimeCache(void)
                service->AddDowntimesToCache();
        }
 
-       m_DowntimeCacheValid = true;
+       m_DowntimesCacheValid = true;
 
-       if (!m_DowntimeExpireTimer) {
-               m_DowntimeExpireTimer = boost::make_shared<Timer>();
-               m_DowntimeExpireTimer->SetInterval(300);
-               m_DowntimeExpireTimer->OnTimerExpired.connect(boost::bind(&Service::DowntimeExpireTimerHandler));
-               m_DowntimeExpireTimer->Start();
+       if (!m_DowntimesExpireTimer) {
+               m_DowntimesExpireTimer = boost::make_shared<Timer>();
+               m_DowntimesExpireTimer->SetInterval(300);
+               m_DowntimesExpireTimer->OnTimerExpired.connect(boost::bind(&Service::DowntimesExpireTimerHandler));
+               m_DowntimesExpireTimer->Start();
        }
 }
 
@@ -273,7 +273,7 @@ void Service::RemoveExpiredDowntimes(void)
        }
 }
 
-void Service::DowntimeExpireTimerHandler(void)
+void Service::DowntimesExpireTimerHandler(void)
 {
        DynamicObject::Ptr object;
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicType::GetByName("Service")->GetObjects()) {
index 3a88eb9b87b01c329b2bf1eb7f863bd65fab01a0..72a09e8c9c0dad8bef47ecf3aa9157a46142932e 100644 (file)
@@ -53,8 +53,8 @@ Service::~Service(void)
 {
        ServiceGroup::InvalidateMembersCache();
        Host::InvalidateServicesCache();
-       Service::InvalidateDowntimeCache();
-       Service::InvalidateCommentCache();
+       Service::InvalidateDowntimesCache();
+       Service::InvalidateCommentsCache();
 }
 
 String Service::GetDisplayName(void) const
@@ -222,9 +222,9 @@ void Service::OnAttributeChanged(const String& name, const Value& oldValue)
                Host::InvalidateServicesCache();
                UpdateSlaveNotifications();
        } else if (name == "downtimes")
-               Service::InvalidateDowntimeCache();
+               Service::InvalidateDowntimesCache();
        else if (name == "comments")
-               Service::InvalidateCommentCache();
+               Service::InvalidateCommentsCache();
        else if (name == "notifications")
                UpdateSlaveNotifications();
        else if (name == "check_interval") {
index 9d1c18f913a0a215a65e11ce2f7af8eccecf6dc1..ba76f6cc51e3639d49520a8fc97f2384b9dd2bd8 100644 (file)
@@ -204,8 +204,8 @@ public:
        static bool IsDowntimeActive(const Dictionary::Ptr& downtime);
        static bool IsDowntimeExpired(const Dictionary::Ptr& downtime);
 
-       static void InvalidateDowntimeCache(void);
-       static void ValidateDowntimeCache(void);
+       static void InvalidateDowntimesCache(void);
+       static void ValidateDowntimesCache(void);
 
        bool IsInDowntime(void) const;
        bool IsAcknowledged(void);
@@ -227,8 +227,8 @@ public:
 
        static bool IsCommentExpired(const Dictionary::Ptr& comment);
 
-       static void InvalidateCommentCache(void);
-       static void ValidateCommentCache(void);
+       static void InvalidateCommentsCache(void);
+       static void ValidateCommentsCache(void);
 
        /* Notifications */
        void RequestNotifications(NotificationType type) const;
@@ -257,12 +257,12 @@ private:
        /* Downtimes */
        static int m_NextDowntimeID;
 
-       static map<int, String> m_LegacyDowntimeCache;
-       static map<String, Service::WeakPtr> m_DowntimeCache;
-       static bool m_DowntimeCacheValid;
-       static Timer::Ptr m_DowntimeExpireTimer;
+       static map<int, String> m_LegacyDowntimesCache;
+       static map<String, Service::WeakPtr> m_DowntimesCache;
+       static bool m_DowntimesCacheValid;
+       static Timer::Ptr m_DowntimesExpireTimer;
 
-       static void DowntimeExpireTimerHandler(void);
+       static void DowntimesExpireTimerHandler(void);
 
        void AddDowntimesToCache(void);
        void RemoveExpiredDowntimes(void);
@@ -270,12 +270,12 @@ private:
        /* Comments */
        static int m_NextCommentID;
 
-       static map<int, String> m_LegacyCommentCache;
-       static map<String, Service::WeakPtr> m_CommentCache;
-       static bool m_CommentCacheValid;
-       static Timer::Ptr m_CommentExpireTimer;
+       static map<int, String> m_LegacyCommentsCache;
+       static map<String, Service::WeakPtr> m_CommentsCache;
+       static bool m_CommentsCacheValid;
+       static Timer::Ptr m_CommentsExpireTimer;
 
-       static void CommentExpireTimerHandler(void);
+       static void CommentsExpireTimerHandler(void);
 
        void AddCommentsToCache(void);
        void RemoveExpiredComments(void);