From 54eda8ebef69efba4b88dee192e97250bf71c5d0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 4 Mar 2012 02:39:12 +0100 Subject: [PATCH] Added: #1440 Master command for reloading workspace sheets on all pipeline services --HG-- branch : build_pipeline_v3 --- .../example_cfg/pipeline_service_master.cfg | 1 + .../example_cfg/pipeline_service_slave.cfg | 1 + .../service/module_pipeline_master.cpp | 38 +++++++++++++++++- .../service/module_pipeline_master_itf.cpp | Bin 14104 -> 16762 bytes .../service/module_pipeline_master_itf.h | Bin 11464 -> 12316 bytes .../service/module_pipeline_master_itf.xml | 4 ++ .../service/module_pipeline_slave.cpp | 15 ++++++- .../service/module_pipeline_slave_itf.cpp | Bin 9018 -> 11546 bytes .../service/module_pipeline_slave_itf.h | Bin 9838 -> 10606 bytes .../service/module_pipeline_slave_itf.xml | 3 ++ .../pipeline/service/pipeline_service.cpp | 4 ++ .../tools/pipeline/service/pipeline_service.h | 2 + 12 files changed, 66 insertions(+), 2 deletions(-) diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg index 5ece8f6c9..eadef870d 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg @@ -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) diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg index 1a9f077a7..280033b36 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg @@ -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 diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index b2e73a205..4e9170b67 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -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 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(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 */ diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp index 9da26b338d90f5704acdd18ec1a2da436c9d9ecb..3e59a5e446196d106976dcad6044528cbcee0f47 100644 GIT binary patch delta 417 zcmbP{_p6Cu@SdzIDlLvf*W~Sz@{=!! zyG^#?(wgiecww@Oy29p9Vn=vXi-9gpWGDl=4v(uRGm6Piwvrdvd_u#5aqRIVWL*h2Z2o0Y32@hJ1!Zh7^WWAP#280Me-pB@D%r^@XNy))Sn^HaSZLx1xmt zmXrTU@NHfop2CaQw1oollmDnnOzu*ZnS4gv4#*amEFd5-`HGg-<{s5YER)Y^@JZru Q3WLVvMj_kHA(|!30HJ3y+yDRo delta 31 ncmbP}a3XSph2Z9Yf>YQwYe`!0PW~sTu=$so7whIjx=~C3)?o~g diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml index 8f8126c64..e5a93eae7 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml +++ b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml @@ -16,6 +16,10 @@ + + + + diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp index be424159a..562960171 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp @@ -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) 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 829328a04bd804b83b1b69946f1a4b148681daf2..4c768a123b526d9abdb0f7ffb9a5b381d7d30ef9 100644 GIT binary patch delta 380 zcmdnxHY;jF0q5j8_6$)U27d-e1{a2ShF}H{23H^qVF;eA$Yw8E#E{C6!;sIA$dCe* z%K-9H8A>*1bBJrHJH$!pA0WAswT7uPD22BQQ23`g(22LQv zs(*95P&60NYLm$)WchGf&nPHAnM+t;^DzkvMjYNSl-kIMQ@^2t=;Q@59FzC)aBQ}b m`N6h%pNs`=)q-;7lj{V9Ca+V{636Z>rO6u=+}UcuUIPGhNmT>@ delta 28 jcmbOgwaaZo0q15nZUN3sVpd$6t5mAk*lHPg8Mqh#jV}kX 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 05a534a5b09d28a4033884cf369c4703731d2c6e..c8098b51365ac40e15bb577ae518a3dee5095d24 100644 GIT binary patch delta 169 zcmaFo^DbzEjNs%helGDMhE#?ehJ1!Zh7^Wih72Gtm7#>8c=CGw>6>K)ZCEF75M`PC zibG)X0ue4ztcoXpR281QKtN-&mzWFB + + + diff --git a/code/nel/tools/pipeline/service/pipeline_service.cpp b/code/nel/tools/pipeline/service/pipeline_service.cpp index c7470bca3..144658241 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.cpp +++ b/code/nel/tools/pipeline/service/pipeline_service.cpp @@ -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 diff --git a/code/nel/tools/pipeline/service/pipeline_service.h b/code/nel/tools/pipeline/service/pipeline_service.h index 8e6f4e885..3f3812c45 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.h +++ b/code/nel/tools/pipeline/service/pipeline_service.h @@ -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;