12 #ifndef ROOT_TMPWorker 13 #define ROOT_TMPWorker 23 #include <type_traits> 41 virtual void Init(
int fd,
unsigned workerN);
58 std::unique_ptr<TSocket>
fS;
virtual void HandleInput(MPCodeBufPair &msg)
Handle a message with an EMPCode.
pid_t fPid
the PID of the process in which this worker is running
unsigned fNWorker
the ordinal number of this worker (0 to nWorkers-1)
This class works in conjuction with TMPClient, reacting to messages received from it as specified by ...
ULong64_t fProcessedEntries
the number of entries processed by this worker so far
void SendError(const std::string &errmsg, unsigned int code=MPCode::kError)
Error sender.
unsigned GetNWorker() const
#define ClassDef(name, id)
ULong64_t fMaxNEntries
the maximum number of entries to be processed by this worker
std::unique_ptr< TSocket > fS
This worker's socket. The unique_ptr makes sure resources are released.
TMPWorker(unsigned nWorkers, ULong64_t maxEntries)
std::pair< unsigned, std::unique_ptr< TBufferFile > > MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
unsigned fNWorkers
the number of workers spawned
TMPWorker & operator=(const TMPWorker &)=delete
unsigned long long ULong64_t
std::string fId
identifier string in the form W<nwrk>|P<proc id>="">
virtual void Init(int fd, unsigned workerN)
This method is called by children processes right after forking.