Logo ROOT   6.14/05
Reference Guide
XrdProofWorker.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: Gerardo Ganis June 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_XrdProofWorker
13 #define ROOT_XrdProofWorker
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // XrdProofWorker //
18 // //
19 // Authors: G. Ganis, CERN, 2007 //
20 // //
21 // Class with information about a potential worker. //
22 // A list of instances of this class is built using the config file or //
23 // or the information collected from the resource discoverers. //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 #include <list>
27 
28 #include "XpdSysPthread.h"
29 
30 #include "XrdOuc/XrdOucString.hh"
31 
32 
33 class XrdProofdProofServ;
34 
36 
37 public:
38  XrdProofWorker(const char *str = 0);
40  virtual ~XrdProofWorker();
41 
42  void Reset(const char *str); // Set from 'str'
43 
44  const char *Export(const char *ord = 0);
45 
46  bool Matches(const char *host);
47  bool Matches(XrdProofWorker *wrk);
48  int GetNActiveSessions();
49 
50  static void Sort(std::list<XrdProofWorker *> *lst,
51  bool (*f)(XrdProofWorker *&lhs,
52  XrdProofWorker *&rhs));
53 
54  inline int Active() const {
56  return fProofServs.size();
57  }
58  inline void AddProofServ(XrdProofdProofServ *xps) {
60  return fProofServs.push_back(xps);
61  }
62  inline void RemoveProofServ(XrdProofdProofServ *xps) {
64  return fProofServs.remove(xps);
65  }
66  // Allows to copy the session objects from other worker.
67  void MergeProofServs(const XrdProofWorker &other);
68 
69  std::list<XrdProofdProofServ *> fProofServs; // ProofServ sessions using
70  // this worker
71 
72  // Worker definitions
73  XrdOucString fExport; // export string
74  char fType; // type: worker ('W') or submaster ('S')
75  XrdOucString fUser; // user
76  XrdOucString fHost; // host FQDN
77  int fPort; // port
78  int fPerfIdx; // performance index
79  XrdOucString fImage; // image name
80  XrdOucString fWorkDir; // work directory
81  XrdOucString fMsd; // mass storage domain
82  XrdOucString fId; // ID string
83  int fNwrks; // # workers if 'S' and P-Lite
84 
85  XrdOucString fOrd; // Used only for temp exports
86 
87  bool fActive; // TRUE if available
88 
89 private:
90  XrdSysRecMutex *fMutex; // Local mutex
91 };
92 
93 #endif
const char * Export(const char *ord=0)
Export current content in a form understood by parsing algorithms inside the PROOF session...
std::list< XrdProofdProofServ * > fProofServs
void RemoveProofServ(XrdProofdProofServ *xps)
virtual ~XrdProofWorker()
Destructor.
XrdOucString fId
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
XrdOucString fImage
XrdSysRecMutex * fMutex
#define f(i)
Definition: RSha256.hxx:104
void Reset(const char *str)
Set content from a config file-like string.
XrdOucString fUser
void AddProofServ(XrdProofdProofServ *xps)
int Active() const
XrdOucString fMsd
int GetNActiveSessions()
Calculate the number of workers existing on this node which are currently running.
bool Matches(const char *host)
Check compatibility of host with this instance.
#define XrdSysMutexHelper
Definition: XrdSysToOuc.h:17
void MergeProofServs(const XrdProofWorker &other)
Merge session objects from the other worker object in order to merge all the objects in only one...
XrdProofWorker(const char *str=0)
Constructor from a config file-like string.
static void Sort(std::list< XrdProofWorker *> *lst, bool(*f)(XrdProofWorker *&lhs, XrdProofWorker *&rhs))
Sort ascendingly the list according to the comparing algorithm defined by &#39;f&#39;; &#39;f&#39; should return &#39;tru...
XrdOucString fOrd
XrdOucString fWorkDir
XrdOucString fExport
XrdOucString fHost