Added: #1440 Master command for reloading workspace sheets on all pipeline services

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 369e1fc6fc
commit 54eda8ebef

@ -9,6 +9,7 @@ StartCommands +=
// Create a layer 3 server transport
"gw.transportAdd L3Server l3s",
"gw.transportOptions l3s(PeerInvisible)",
"gw.transportCmd l3s(open port="+MasterPort+")",
// Create the master module (MASTER ONLY)

@ -9,6 +9,7 @@ StartCommands +=
// Create a layer 3 client transport (SLAVE ONLY)
"gw.transportAdd L3Client l3c",
"gw.transportOptions l3c(PeerInvisible)",
"gw.transportCmd l3c(connect addr="+MasterAddress+":"+MasterPort+")",
// Create the slave module

@ -62,16 +62,23 @@ class CModulePipelineMaster :
CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy)
: Master(master),
Proxy(moduleProxy),
ActiveTaskId(0) { }
ActiveTaskId(0),
SheetsOk(true) { }
CModulePipelineMaster *Master;
CModulePipelineSlaveProxy Proxy;
std::vector<std::string> Vector;
uint32 ActiveTaskId;
bool SheetsOk;
void cbUpdateDatabaseStatus()
{
Proxy.masterUpdatedDatabaseStatus(Master);
}
bool canAcceptTask()
{
return SheetsOk && (ActiveTaskId == 0);
}
};
protected:
@ -162,6 +169,12 @@ public:
// TODO
}
virtual void slaveReloadedSheets(NLNET::IModuleProxy *sender)
{
CSlave *slave = m_Slaves[sender];
slave->SheetsOk = true;
}
virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str)
{
CSlave *slave = m_Slaves[sender];
@ -174,6 +187,29 @@ public:
g_DatabaseStatus->updateDatabaseStatus(CCallback<void>(slave, &CSlave::cbUpdateDatabaseStatus), slave->Vector, false, false);
slave->Vector.clear();
}
protected:
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CModulePipelineMaster, reloadSheets, "Reload sheets across all services", "")
NLMISC_COMMAND_HANDLER_TABLE_END
NLMISC_CLASS_COMMAND_DECL(reloadSheets)
{
if (args.size() != 0) return false;
m_SlavesMutex.lock();
for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it)
{
CSlave *slave = it->second;
slave->SheetsOk = false;
slave->Proxy.reloadSheets(this);
}
m_SlavesMutex.unlock();
return true;
}
}; /* class CModulePipelineMaster */

@ -16,6 +16,10 @@
<param type="uint32" name="taskId" />
</method>
<method name="slaveReloadedSheets" msg="RE_SHEETS_OK">
<doc line=""/>
</method>
<method name="vectorPushString" msg="VEC_PUSH_STR">
<doc line=""/>

@ -59,9 +59,10 @@ class CModulePipelineSlave :
public:
CModulePipelineMasterProxy *m_Master;
bool m_TestCommand;
bool m_RequestedReloadSheets;
public:
CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false)
CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_RequestedReloadSheets(false)
{
}
@ -103,6 +104,12 @@ public:
}
}
virtual void onModuleUpdate()
{
if (m_RequestedReloadSheets)
m_RequestedReloadSheets = !PIPELINE::reloadSheets();
}
virtual void startBuildTask(NLNET::IModuleProxy *sender, uint32 taskId, const std::string &projectName, const std::string &processHandler)
{
//this->queueModuleTask
@ -121,6 +128,12 @@ public:
nlwarning("NOT_IMPLEMENTED");
}
}
virtual void reloadSheets(NLNET::IModuleProxy *sender)
{
if (!PIPELINE::reloadSheets())
m_RequestedReloadSheets = true;
}
protected:
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineSlave, CModuleBase)

@ -16,6 +16,9 @@
<doc line=""/>
</method>
<method name="reloadSheets" msg="RELOAD_SHEETS">
</method>
</module_interface>
</namespace>

@ -235,11 +235,15 @@ class CReloadSheets : public IRunnable
};
CReloadSheets s_ReloadSheets;
} /* anonymous namespace */
bool reloadSheets()
{
return tryStateTask(STATE_RELOAD_SHEETS, &s_ReloadSheets);
}
namespace {
// ******************************************************************
class CUpdateDatabaseStatus : public IRunnable

@ -70,6 +70,8 @@ std::string macroPath(const std::string &path);
bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task);
void endedRunnableTask();
bool reloadSheets();
extern NLGEORGES::UFormLoader *g_FormLoader;
extern CPipelineWorkspace *g_PipelineWorkspace;
extern CDatabaseStatus *g_DatabaseStatus;

Loading…
Cancel
Save