/*************************************************************************** Process »óÅ Á¤º¸ ÀúÀå ¹× console Ãâ·Â ó¸® class ----------------------------------------- begin : 2010/03/05 copyright : (C) 2005 Solbox Inc. author : storage dev team email : storage.sd@solbox.com version : 3.3 CopyRight(C) 2005 Solbox Inc. All Rights reserved. Redistribution and use in source and binary forms, with or with out modification, are not permitted in outside of Solbox Inc. ***************************************************************************/ #ifndef __PROCESS_STATUS_H__ #define __PROCESS_STATUS_H__ #include #include "DataQueue.hpp" #include "ReplicationData.h" #include "CacheRequestData.h" #include "CacheJobList.h" // CProcessStatus class // - ÇÁ·Î¼¼½º ³»ºÎ¿¡¼­ »ç¿ë ÁßÀÎ Queue Á¤º¸¿Í // - Replcation ó¸® thread ¼ö, Hot Content ó¸® thread ¼ö¸¦ °ü¸®, // - ÇØ´ç Á¤º¸¸¦ console »ó¿¡ Ç¥½ÃÇÏ´Â ¿ªÈ°À» ¼öÇàÇÑ´Ù. // - 2016-06-18 ´Ù¸¥ ¸ðµâ°ú ¿¬µ¿½Ã ¹Ýȯ°ª ó¸® °ü·Ã ¹®Á¦°¡ ¸¹¾Æ // È®À强 Æ÷±âÇÏ°í ¾÷¹« Flow ¿¡ ¸Â°Ô ´Ü¼øÇÏ°Ô µ¿ÀÛÇϵµ·Ï ¼öÁ¤ ó¸®ÇÔ. // ƯÈ÷ ¹«Á¦ÇÑ ¼³Á¤ °ü·Ã ±â´ÉÀº ÀüºÎ Á¦°Å ó¸®ÇÔ. class CProcessStatus { private: // Replication ó¸® °ü·Ã µ¿½Ã ÃÖ´ë »ý¼º °¡´É Thread ¼ö. int m_nMaxReplicationThreadCount; // Hot Content cache ó¸® °ü·Ã µ¿½Ã ÃÖ´ë »ý¼º °¡´É Thread ¼ö int m_nMaxCacheThreadCount; // Lock ó¸® °ü·Ã pthread_mutex_t m_mxReplicateThreadCount; pthread_mutex_t m_mxCacheThreadCount; ////// ÇÁ·Î¼¼½º title ·Î ¸ð´ÏÅÍ ´ë»ó Á¤º¸ ///////////// // Replication ó¸® °ü·Ã ÇöÀç »ý¼ºµÈ Thread ¼ö. int m_nCurrentReplicationCount; // Hot Content cache ó¸® °ü·Ã ÇöÀç »ý¼ºµÈ Thread ¼ö int m_nCurrentCacheCount; // Replication content ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½. CDataQueue* m_pQueueSource; // Replication Àç½Ãµµ content ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½. CDataQueue* m_pQueueRetry; // Replication ¿Ï·á Á¤º¸ ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½. CDataQueue* m_pQueueCompleteReplication; // Hot Content cache ¿äû Á¤º¸ ÀúÀå °ü·Ã queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. CDataQueue* m_pQueueCacheRequest; // Hot Content cache ó¸® ¿Ï·á °ü·Ã queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. CDataQueue* m_pQueueCacheComplete; // Hot Content cache »ý¼º °ü¸® job °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. CCacheJobList* m_pCacheJob; ////////////////////////////////////////////////// // ÀÛ¾÷ÀÇ Á¾·ù¸¦ ±¸ºÐÇÏ´Â ¿­°ÅÇü º¯¼ö // Replication : 0, Cache : 1 enum Job { Replication, Cache }; // ¾²·¹µå ÇÚµé pthread_t m_threadHandle; public : // »ý¼ºÀÚ // @param [in] pQueueSource : Replication content ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // @param [in] pQueueRetry : Replication Àç½Ãµµ content ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // @param [in] pQueueCompleteReplication : Replication ¿Ï·á Á¤º¸ ÀúÀå queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // @param [in] pQueueContentInfo : ij½Ã ¿äû Á¤º¸ ÀúÀå °ü·Ã queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. // @param [in] pQueueCompleteCache : ij½Ã ó¸® ¿Ï·áµÈ queue ¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. // @param [in] pListJob : ij½Ã »ý¼º job °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. CProcessStatus( CDataQueue* const pQueueSource , CDataQueue* const pQueueRetry , CDataQueue* const pQueueCompleteReplication , CDataQueue* const pQueueCacheRequest , CDataQueue* const pQueueCacheComplete , CCacheJobList* const pCacheJob ); // ¼Ò¸êÀÚ ~CProcessStatus(); // °´Ã¼ ÃʱâÈ­ // @param [in] nMaxReplicationThreadCount Replication ó¸® °ü·Ã µ¿½Ã ÃÖ´ë »ý¼º °¡´É Thread ¼ö // @param [in] nMaxCacheThreadCount Hot Content cache ó¸® °ü·Ã µ¿½Ã ÃÖ´ë »ý¼º °¡´É Thread ¼ö // @return true ¼º°ø // false »ý¼ºÀÚ·Î Àü´ÞµÈ °´Ã¼ Æ÷ÀÎÅͰ¡ À¯È¿ÇÏÁö ¾ÊÀº °æ¿ì, // ÀÎÀÚ·Î Àü´ÞµÈ ÃÖ´ë Thread ¼ö°¡ ³Ê¹« Å« °æ¿ì.(MAX_THREAD_COUNT_LIMIT Ãʰú½Ã) bool Init(const unsigned int nMaxReplicationThreadCount, const unsigned int nMaxCacheThreadCount); // thread¸¦ »ý¼ºÇÏ¿© ÇÁ·Î¼¼½º Ãâ·Â »óÅ °»½Å ÀÛ¾÷À» ¼öÇà. bool Start(); // ÇöÀç ÇÁ·Î¼¼½º Ç¥½Ã Á¤º¸ ¾÷µ¥ÀÌÆ® void UpdateTitle( void ); // Replication °ü·Ã µ¿½Ã »ý¼º °¡´ÉÇÑ Thread ¼ö¸¦ ¹Ýȯ unsigned int GetValidReplicationCount( void ); // Hot Content Cache °ü·Ã µ¿½Ã »ý¼º °¡´ÉÇÑ Thread ¼ö¸¦ ¹Ýȯ unsigned int GetValidCacheCount( void ); // Replication °ü·Ã ÀÛ¾÷ Thread ¼ö¸¦ 1 Áõ°¡ ó¸® void AddReplicationCount(void); // Replication °ü·Ã ÀÛ¾÷ Thread ¼ö¸¦ 1 °¨¼Ò ó¸® void SubtractReplicationCount(void); // Hot content cache °ü·Ã ÀÛ¾÷ Thread ¼ö¸¦ 1 Áõ°¡ ó¸® void AddCacheCount(void); // Hot content cache °ü·Ã ÀÛ¾÷ Thread ¼ö¸¦ 1 °¨¼Ò ó¸® void SubtractCacheCount(void); private : // ½º·¹µå ÇÔ¼ö static void* threadFunc( void* arg ); // Àü´Þ¹ÞÀº ÀÛ¾÷ÀÇ Thread ¼ö¸¦ 1 Áõ°¡ ½ÃŲ´Ù. void AddCount(CProcessStatus::Job job); // Àü´Þ¹ÞÀº ÀÛ¾÷ÀÇ Thread ¼ö¸¦ 1 °¨¼Ò ½ÃŲ´Ù. void SubtractCount(CProcessStatus::Job job); }; #endif //__PROCESS_STATUS_H__