Commits

Anonymous committed d522b8e

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

  • Participants
  • Parent commits 93f9a84
  • Branches build_pipeline_v3

Comments (0)

Files changed (12)

File code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg

 	
 	// 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)

File code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg

 	
 	// 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

File code/nel/tools/pipeline/service/module_pipeline_master.cpp

 		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:
 		// 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];
 		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 */
 

File code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp

Binary file modified.

File code/nel/tools/pipeline/service/module_pipeline_master_itf.h

Binary file modified.

File code/nel/tools/pipeline/service/module_pipeline_master_itf.xml

 				<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=""/>
 				

File code/nel/tools/pipeline/service/module_pipeline_slave.cpp

 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)
 	{
 		
 	}
 		}
 	}
 
+	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
 			nlwarning("NOT_IMPLEMENTED");
 		}
 	}
+
+	virtual void reloadSheets(NLNET::IModuleProxy *sender)
+	{
+		if (!PIPELINE::reloadSheets())
+			m_RequestedReloadSheets = true;
+	}
 	
 protected:
 	NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineSlave, CModuleBase)

File code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp

Binary file modified.

File code/nel/tools/pipeline/service/module_pipeline_slave_itf.h

Binary file modified.

File code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml

 				<doc line=""/>
 			</method>
 
+			<method name="reloadSheets" msg="RELOAD_SHEETS">
+			</method>
+
 		</module_interface>
 
 	</namespace>

File code/nel/tools/pipeline/service/pipeline_service.cpp

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

File code/nel/tools/pipeline/service/pipeline_service.h

 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;