/*************************************************************************** Replicate Control class ----------------------------------------- begin : 2010/03/31 copyright : (C) 2010 Solbox Inc. author : storage dev team email : storage.sd@solbox.com version : 3.3 CopyRight(C) 2010 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 __REPLICATE_CONTROL_H__ #define __REPLICATE_CONTROL_H__ #include #include "ProperFhs.h" #include "ProcessStatus.h" #include "DataQueue.hpp" #include "ReplicationData.h" #include "ReportLog.h" #include "ReplicateQueueControl.h" // CReplicateControl // Replication °ü·Ã °¢ Thread ¹× Queue ¸¦ Á¦¾îÇÏ¿©... // ÀüüÀûÀ¸·Î Replication »ý¼º ¾÷¹« Flow ¸¦ Á¦¾îÇÑ´Ù. // ³»ºÎÀûÀ¸·Î Thread¸¦ »ç¿ë class CReplicateControl { public: // »ý¼ºÀÚ CReplicateControl( CProperFhs * pProperFhs , CProcessStatus * pProcessStatus , CDataQueue * pQueueSource , CDataQueue * pQueueRetry , CDataQueue * pQueueComplete ); // ¼Ò¸êÀÚ ~CReplicateControl(); // °´Ã¼ ÃʱâÈ­ ¼öÇà bool Init(); // thread¸¦ »ý¼ºÇÏ¿© ¾÷¹« flow ¸¦ ½ÃÀÛ. bool Start(); private: // Proper FHS Á¤º¸¸¦ °ü¸®ÇÏ´Â CProperFhs °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ. // - »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½. CProperFhs * m_pProperFhs; // ÇÁ·Î¼¼½º »óÀÇ Queue, Thread »óŸ¦ °ü¸®ÇÏ´Â CProcessStatus °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // - »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½ CProcessStatus * m_pProcessStatus; // º¹Á¦´ë»ó Content Á¤º¸¸¦ °ü¸®ÇÏ´Â Queue °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // - »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½ CDataQueue * m_pSourceQueue; // º¹Á¦ ó¸® °ü·Ã Àç½Ãµµ Content Á¤º¸¸¦ °ü¸®ÇÏ´Â Queue °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // - »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½ CDataQueue * m_pRetryQueue; // º¹Á¦ ¿Ï·áµÈ Content Á¤º¸¸¦ °ü¸®ÇÏ´Â Queue °´Ã¼¿¡ ´ëÇÑ Æ÷ÀÎÅÍ // - »ý¼ºÀÚ¸¦ ÅëÇØ Àü´Þ¹ÞÀ½ CDataQueue * m_pCompleteQueue; // ½º·¹µå ÇÚµé pthread_t m_threadHandle; // Report log ó¸® °ü·Ã °´Ã¼ CReportLog m_reportLog; // Thread Loop ¸¶´Ù Sleep Time Á¤º¸¸¦ ÀúÀåÇϱâ À§ÇÑ º¯¼ö unsigned int m_uSleep; // conf ¿¡ ¼³Á¤µÈ Replication Retry count Á¤º¸¸¦ ÀúÀåÇϱâ À§ÇÑ ¸â¹ö º¯¼ö unsigned int m_uRetryCount; // Queue Pop 󸮸¦ ´ã´çÇÒ ¸â¹ö °´Ã¼ CReplicateQueueControl m_controlQueuePop; private: // ½º·¹µå ÇÔ¼ö static void* threadFunc( void* arg ); // ½º·¹µå ³»¿¡¼­ °¢ loop ´ÜÀ§ ó¸® È£Ãâ ÇÔ¼ö. void Execute(); // Replication »ý¼º 󸮸¦ ¼öÇàÇϱâ À§ÇÑ ÇÔ¼ö. bool MakeReplication(); }; #endif //__REPLICATE_CONTROL_H__