From b4619055d6b321efb9ccfbc61bc17193a9bed025 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 1 Aug 2012 11:37:11 +0200 Subject: [PATCH] Added: #1440 File status cache for initial file status update --HG-- branch : build_pipeline_v3 --- .../service/module_pipeline_master_itf.h | 62 +++++++++---------- .../service/module_pipeline_slave.cpp | 19 +++++- .../service/module_pipeline_slave_itf.cpp | 49 ++++++++++++++- .../service/module_pipeline_slave_itf.h | 17 ++++- .../service/module_pipeline_slave_itf.xml | 27 +++++--- 5 files changed, 126 insertions(+), 48 deletions(-) diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h index 9e2ca9ccb..b2d5c9578 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h +++ b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h @@ -1,4 +1,4 @@ - + ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! ///////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ namespace PIPELINE { - + ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! @@ -59,7 +59,7 @@ namespace PIPELINE const TMessageHandlerMap &getMessageHandlers() const; - + void slaveFinishedBuildTask_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); void slaveAbortedBuildTask_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); @@ -88,23 +88,23 @@ namespace PIPELINE // WARNING : this is a generated file, don't change it ! ///////////////////////////////////////////////////////////////// - // + // virtual void slaveFinishedBuildTask(NLNET::IModuleProxy *sender, uint8 errorLevel, const std::string &errorMessage) =0; - // + // virtual void slaveAbortedBuildTask(NLNET::IModuleProxy *sender) =0; - // + // virtual void slaveRefusedBuildTask(NLNET::IModuleProxy *sender) =0; - // + // virtual void slaveReloadedSheets(NLNET::IModuleProxy *sender) =0; - // + // virtual void slaveBuildReadySuccess(NLNET::IModuleProxy *sender) =0; - // + // virtual void slaveBuildReadyFail(NLNET::IModuleProxy *sender) =0; - // + // virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str) =0; - // + // virtual void updateDatabaseStatusByVector(NLNET::IModuleProxy *sender) =0; - // + // virtual void setAvailablePlugins(NLNET::IModuleProxy *sender, const std::vector &pluginsAvailable) =0; @@ -155,57 +155,57 @@ namespace PIPELINE return _ModuleProxy; } - // + // void slaveFinishedBuildTask(NLNET::IModule *sender, uint8 errorLevel, const std::string &errorMessage); - // + // void slaveAbortedBuildTask(NLNET::IModule *sender); - // + // void slaveRefusedBuildTask(NLNET::IModule *sender); - // + // void slaveReloadedSheets(NLNET::IModule *sender); - // + // void slaveBuildReadySuccess(NLNET::IModule *sender); - // + // void slaveBuildReadyFail(NLNET::IModule *sender); - // + // void vectorPushString(NLNET::IModule *sender, const std::string &str); - // + // void updateDatabaseStatusByVector(NLNET::IModule *sender); - // + // void setAvailablePlugins(NLNET::IModule *sender, const std::vector &pluginsAvailable); // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveFinishedBuildTask(NLNET::CMessage &__message, uint8 errorLevel, const std::string &errorMessage); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveAbortedBuildTask(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveRefusedBuildTask(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveReloadedSheets(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveBuildReadySuccess(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_slaveBuildReadyFail(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_vectorPushString(NLNET::CMessage &__message, const std::string &str); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_updateDatabaseStatusByVector(NLNET::CMessage &__message); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_setAvailablePlugins(NLNET::CMessage &__message, const std::vector &pluginsAvailable); - + }; } - + #endif diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp index 0edc054b5..98bee6a5e 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp @@ -104,6 +104,8 @@ public: CProcessPluginInfo m_ActivePlugin; bool m_AbortRequested; + + std::map m_FileStatusCache; public: CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_ReloadSheetsState(REQUEST_NONE), m_BuildReadyState(false), m_SlaveTaskState(IDLE_WAIT_MASTER), m_TaskManager(NULL), m_StatusUpdateMasterDone("StatusUpdateMasterDone"), m_StatusUpdateSlaveDone("StatusUpdateSlaveDone"), m_ActiveProject(NULL), m_ActiveProcess(NULL), m_AbortRequested(false) @@ -284,7 +286,9 @@ public: CStatusUpdateSlaveTask(CModulePipelineSlave *slave) : m_Slave(slave) { } virtual void run() { - // TODO... + // ****************************************************************************** TODO... + // Read the last build results + // Update the database status of those files // Mark as done { @@ -343,7 +347,7 @@ public: /////////////////////////////////////////////////////////////////// - virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, const uint32 &pluginId) + virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, uint32 pluginId) { nlassert(m_Master->getModuleProxy() == sender); // sanity check nlassert(m_ActiveProject == NULL); @@ -372,6 +376,7 @@ public: { m_ActiveProject = NULL; m_ActiveProcess = NULL; + m_FileStatusCache.clear(); m_SlaveTaskState = IDLE_WAIT_MASTER; if (m_Master) // else was disconnect m_Master->slaveAbortedBuildTask(this); @@ -384,6 +389,7 @@ public: { m_ActiveProject = NULL; m_ActiveProcess = NULL; + m_FileStatusCache.clear(); m_SlaveTaskState = IDLE_WAIT_MASTER; if (m_Master) // else was disconnect m_Master->slaveFinishedBuildTask(this, (uint8)errorLevel, errorMessage); @@ -413,6 +419,15 @@ public: } } + virtual void addFileStatusToCache(NLNET::IModuleProxy *sender, const std::string ¯oPath, const CFileStatus &fileStatus) + { + nlassert(sender == NULL || m_Master->getModuleProxy() == sender); // sanity check + + std::string filePath = unMacroPath(macroPath); + nlassert(m_FileStatusCache.find(filePath) == m_FileStatusCache.end()); + m_FileStatusCache[filePath] = fileStatus; + } + virtual void masterUpdatedDatabaseStatus(NLNET::IModuleProxy *sender) { nlassert(sender == NULL || m_Master->getModuleProxy() == sender); // sanity check diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp index 7612489de..eec856534 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp @@ -34,6 +34,10 @@ namespace PIPELINE // if this assert, you have a doubly message name in your interface definition ! nlassert(res.second); + res = handlers.insert(std::make_pair(std::string("ADD_FS_CACHE"), &CModulePipelineSlaveSkel::addFileStatusToCache_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + res = handlers.insert(std::make_pair(std::string("RE_UPD_DB_ST"), &CModulePipelineSlaveSkel::masterUpdatedDatabaseStatus_skel)); // if this assert, you have a doubly message name in your interface definition ! nlassert(res.second); @@ -95,6 +99,16 @@ namespace PIPELINE abortBuildTask(sender); } + void CModulePipelineSlaveSkel::addFileStatusToCache_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CModulePipelineSlaveSkel_addFileStatusToCache_ADD_FS_CACHE); + std::string macroPath; + nlRead(__message, serial, macroPath); + CFileStatus fileStatus; + nlRead(__message, serial, fileStatus); + addFileStatusToCache(sender, macroPath, fileStatus); + } + void CModulePipelineSlaveSkel::masterUpdatedDatabaseStatus_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) { H_AUTO(CModulePipelineSlaveSkel_masterUpdatedDatabaseStatus_RE_UPD_DB_ST); @@ -137,7 +151,7 @@ namespace PIPELINE } } // - void CModulePipelineSlaveProxy::startBuildTask(NLNET::IModule *sender, const std::string &projectName, const uint32 &pluginId) + void CModulePipelineSlaveProxy::startBuildTask(NLNET::IModule *sender, const std::string &projectName, uint32 pluginId) { if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) { @@ -173,6 +187,24 @@ namespace PIPELINE } } // + void CModulePipelineSlaveProxy::addFileStatusToCache(NLNET::IModule *sender, const std::string ¯oPath, const CFileStatus &fileStatus) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->addFileStatusToCache(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), macroPath, fileStatus); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_addFileStatusToCache(__message, macroPath, fileStatus); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + // void CModulePipelineSlaveProxy::masterUpdatedDatabaseStatus(NLNET::IModule *sender) { if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) @@ -255,11 +287,11 @@ namespace PIPELINE } // Message serializer. Return the message received in reference for easier integration - const NLNET::CMessage &CModulePipelineSlaveProxy::buildMessageFor_startBuildTask(NLNET::CMessage &__message, const std::string &projectName, const uint32 &pluginId) + const NLNET::CMessage &CModulePipelineSlaveProxy::buildMessageFor_startBuildTask(NLNET::CMessage &__message, const std::string &projectName, uint32 pluginId) { __message.setType("GO_BT"); nlWrite(__message, serial, const_cast < std::string& > (projectName)); - nlWrite(__message, serial, const_cast < uint32& > (pluginId)); + nlWrite(__message, serial, pluginId); return __message; @@ -274,6 +306,17 @@ namespace PIPELINE return __message; } + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CModulePipelineSlaveProxy::buildMessageFor_addFileStatusToCache(NLNET::CMessage &__message, const std::string ¯oPath, const CFileStatus &fileStatus) + { + __message.setType("ADD_FS_CACHE"); + nlWrite(__message, serial, const_cast < std::string& > (macroPath)); + nlWrite(__message, serial, const_cast < CFileStatus& > (fileStatus)); + + + return __message; + } + // Message serializer. Return the message received in reference for easier integration const NLNET::CMessage &CModulePipelineSlaveProxy::buildMessageFor_masterUpdatedDatabaseStatus(NLNET::CMessage &__message) { diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h index c4d6156f1..fa30fbabb 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h +++ b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h @@ -17,6 +17,8 @@ #include "nel/net/module_message.h" #include "nel/net/module_gateway.h" +#include "metadata_storage.h" + namespace PIPELINE { @@ -66,6 +68,8 @@ namespace PIPELINE void abortBuildTask_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + void addFileStatusToCache_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + void masterUpdatedDatabaseStatus_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); void reloadSheets_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); @@ -87,10 +91,12 @@ namespace PIPELINE // virtual void submitToMaster(NLNET::IModuleProxy *sender) =0; // - virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, const uint32 &pluginId) =0; + virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, uint32 pluginId) =0; // virtual void abortBuildTask(NLNET::IModuleProxy *sender) =0; // + virtual void addFileStatusToCache(NLNET::IModuleProxy *sender, const std::string ¯oPath, const CFileStatus &fileStatus) =0; + // virtual void masterUpdatedDatabaseStatus(NLNET::IModuleProxy *sender) =0; // virtual void reloadSheets(NLNET::IModuleProxy *sender) =0; @@ -150,10 +156,12 @@ namespace PIPELINE // void submitToMaster(NLNET::IModule *sender); // - void startBuildTask(NLNET::IModule *sender, const std::string &projectName, const uint32 &pluginId); + void startBuildTask(NLNET::IModule *sender, const std::string &projectName, uint32 pluginId); // void abortBuildTask(NLNET::IModule *sender); // + void addFileStatusToCache(NLNET::IModule *sender, const std::string ¯oPath, const CFileStatus &fileStatus); + // void masterUpdatedDatabaseStatus(NLNET::IModule *sender); // void reloadSheets(NLNET::IModule *sender); @@ -166,11 +174,14 @@ namespace PIPELINE static const NLNET::CMessage &buildMessageFor_submitToMaster(NLNET::CMessage &__message); // Message serializer. Return the message received in reference for easier integration - static const NLNET::CMessage &buildMessageFor_startBuildTask(NLNET::CMessage &__message, const std::string &projectName, const uint32 &pluginId); + static const NLNET::CMessage &buildMessageFor_startBuildTask(NLNET::CMessage &__message, const std::string &projectName, uint32 pluginId); // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_abortBuildTask(NLNET::CMessage &__message); + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_addFileStatusToCache(NLNET::CMessage &__message, const std::string ¯oPath, const CFileStatus &fileStatus); + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_masterUpdatedDatabaseStatus(NLNET::CMessage &__message); diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml index 53f3572be..e1c465b3e 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml +++ b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml @@ -1,38 +1,47 @@ + + - + - + - - + + - + + + + + + + + - + - + - + - +