Added: #1440 File status cache for initial file status update

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent b159cd2502
commit b4619055d6

@ -1,4 +1,4 @@

/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////

@ -105,6 +105,8 @@ public:
bool m_AbortRequested;
std::map<std::string, CFileStatus> 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 &macroPath, 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

@ -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 &macroPath, 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 &macroPath, 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)
{

@ -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 &macroPath, 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 &macroPath, 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 &macroPath, const CFileStatus &fileStatus);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_masterUpdatedDatabaseStatus(NLNET::CMessage &__message);

@ -1,38 +1,47 @@
<generator header_tag="PIPELINE_MODULE_PIPELINE_SLAVE_ITF_H">
<include file="metadata_storage.h"/>
<namespace name="PIPELINE">
<module_interface name="CModulePipelineSlave">
<method name="submitToMaster" msg="M_HELLO">
<doc line=""/>
<doc line="" />
</method>
<method name="startBuildTask" msg="GO_BT">
<doc line=""/>
<doc line="" />
<param type="std::string" name="projectName" byref="true"/>
<param type="uint32" name="pluginId" byref="true"/>
<param type="std::string" name="projectName" byref="true" />
<param type="uint32" name="pluginId" />
</method>
<method name="abortBuildTask" msg="ABORT_BT">
<doc line=""/>
<doc line="" />
</method>
<method name="addFileStatusToCache" msg="ADD_FS_CACHE">
<doc line="" />
<param type="std::string" name="macroPath" byref="true" />
<param type="CFileStatus" name="fileStatus" byref="true" />
</method>
<method name="masterUpdatedDatabaseStatus" msg="RE_UPD_DB_ST">
<doc line=""/>
<doc line="" />
</method>
<method name="reloadSheets" msg="RELOAD_SHEETS">
<doc line=""/>
<doc line="" />
</method>
<method name="enterBuildReadyState" msg="BRT_ENTER">
<doc line=""/>
<doc line="" />
</method>
<method name="leaveBuildReadyState" msg="BRT_LEAVE">
<doc line=""/>
<doc line="" />
</method>
</module_interface>

Loading…
Cancel
Save