Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
XrdProofdNetMgr.h
Go to the documentation of this file.
1// @(#)root/proofd:$Id$
2// Author: G. Ganis Jan 2008
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_XrdProofdNetMgr
13#define ROOT_XrdProofdNetMgr
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// XrdProofdNetMgr //
18// //
19// Authors: G. Ganis, CERN, 2008 //
20// //
21// Manages connections between PROOF server daemons //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "XpdSysPthread.h"
26
27#include "XrdOuc/XrdOucHash.hh"
28
29#include "XrdProofConn.h"
30#include "XrdProofdConfig.h"
31
36class XrdProofWorker;
37
39
40private:
41
42 XrdSysRecMutex fMutex; // Atomize this instance
43
45 XrdOucHash<XrdProofConn> fProofConnHash; // Available connections
46 int fNumLocalWrks; // Number of workers to be started locally
47 int fResourceType; // resource type
48 XrdProofdFile fPROOFcfg; // PROOF static configuration
49 bool fReloadPROOFcfg; // Whether the file should regurarl checked for updates
50 bool fDfltFallback; // Whether to fallback to default if file cannot be read
51 bool fWorkerUsrCfg; // user cfg files enabled / disabled
52 int fRequestTO; // Timeout on broadcast request
53
54 std::list<XrdProofWorker *> fDfltWorkers; // List of possible default workers
55 std::list<XrdProofWorker *> fRegWorkers; // List of all workers registered
56 std::list<XrdProofWorker *> fWorkers; // List of currently available workers
57 std::list<XrdProofWorker *> fNodes; // List of worker unique nodes
58
60 int ReadPROOFcfg(bool reset = 1);
61 int FindUniqueNodes();
62
63 int LocateLocalFile(XrdOucString &file);
64
65 int DoDirectiveAdminReqTO(char *, XrdOucStream *, bool);
66 int DoDirectiveResource(char *, XrdOucStream *, bool);
67 int DoDirectiveWorker(char *, XrdOucStream *, bool);
68
69public:
70 XrdProofdNetMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e);
71 virtual ~XrdProofdNetMgr();
72
73 int Config(bool rcf = 0);
75 char *val, XrdOucStream *cfg, bool rcf);
76 void RegisterDirectives();
77
78 void Dump();
79
80 const char *PROOFcfg() const { return fPROOFcfg.fName.c_str(); }
81 bool WorkerUsrCfg() const { return fWorkerUsrCfg; }
82
83 int Broadcast(int type, const char *msg, const char *usr = 0,
84 XrdProofdResponse *r = 0, bool notify = 0, int subtype = -1);
85 int BroadcastCtrlC(const char *usr);
86 XrdProofConn *GetProofConn(const char *url);
87 bool IsLocal(const char *host, bool checkport = 0);
88 XrdClientMessage *Send(const char *url, int type,
89 const char *msg, int srvtype, XrdProofdResponse *r,
90 bool notify = 0, int subtype = -1);
91
93 char *ReadBufferLocal(const char *file, kXR_int64 ofs, int &len);
94 char *ReadBufferLocal(const char *file, const char *pat, int &len, int opt);
95 char *ReadBufferRemote(const char *url, const char *file,
96 kXR_int64 ofs, int &len, int grep);
97 char *ReadLogPaths(const char *url, const char *stag, int isess);
98 char *ReadLogPaths(const char *stag, int isess);
99
100 // List of available and unique workers (on master only)
101 std::list<XrdProofWorker *> *GetActiveWorkers();
102 std::list<XrdProofWorker *> *GetNodes();
103
104 void BalanceNodesOrder();
105};
106
107// Auxiliary structure to store information for the balancer algorithm.
108typedef struct BalancerInfo {
109 unsigned int available;
110 unsigned int per_iteration;
111 unsigned int added;
113
114#endif
#define d(i)
Definition RSha256.hxx:102
#define e(i)
Definition RSha256.hxx:103
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
#define XrdSysError
Definition XpdSysError.h:8
#define XrdSysRecMutex
Definition XrdSysToOuc.h:18
XrdOucString fName
char * ReadBufferRemote(const char *url, const char *file, kXR_int64 ofs, int &len, int grep)
Send a read buffer request of length 'len' at offset 'ofs' for remote file defined by 'url'; the retu...
XrdOucHash< XrdProofConn > fProofConnHash
bool WorkerUsrCfg() const
std::list< XrdProofWorker * > * GetNodes()
Return the list of unique nodes after having made sure that the info is up-to-date.
int DoDirectiveResource(char *, XrdOucStream *, bool)
Process 'resource' directive.
XrdProofConn * GetProofConn(const char *url)
Get a XrdProofConn for url; create a new one if not available.
std::list< XrdProofWorker * > fDfltWorkers
void BalanceNodesOrder()
Indices (this will be used twice).
std::list< XrdProofWorker * > fNodes
int Broadcast(int type, const char *msg, const char *usr=0, XrdProofdResponse *r=0, bool notify=0, int subtype=-1)
Broadcast request to known potential sub-nodes.
bool IsLocal(const char *host, bool checkport=0)
Check if 'host' is this local host.
XrdClientMessage * Send(const char *url, int type, const char *msg, int srvtype, XrdProofdResponse *r, bool notify=0, int subtype=-1)
Broadcast request to known potential sub-nodes.
int LocateLocalFile(XrdOucString &file)
Locate the exact file path allowing for wildcards '*' in the file name.
XrdProofdFile fPROOFcfg
char * ReadBufferLocal(const char *file, kXR_int64 ofs, int &len)
Read a buffer of length 'len' at offset 'ofs' of local file 'path'; the returned buffer must be freed...
void Dump()
Dump status.
std::list< XrdProofWorker * > * GetActiveWorkers()
Return the list of workers after having made sure that the info is up-to-date.
int BroadcastCtrlC(const char *usr)
Broadcast a ctrlc interrupt Return 0 on success, -1 on error.
void CreateDefaultPROOFcfg()
Fill-in fWorkers for a localhost based on the number of workers fNumLocalWrks.
char * ReadLogPaths(const char *url, const char *stag, int isess)
Get log paths from next tier; used in multi-master setups Returns 0 in case of error.
void RegisterDirectives()
Register config directives.
int FindUniqueNodes()
Scan fWorkers for unique nodes (stored in fNodes).
int ReadPROOFcfg(bool reset=1)
Read PROOF config file and load the information in fWorkers.
std::list< XrdProofWorker * > fWorkers
XrdProofdManager * fMgr
int DoDirectiveWorker(char *, XrdOucStream *, bool)
Process 'worker' directive.
std::list< XrdProofWorker * > fRegWorkers
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
XrdOucRecMutex fMutex
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
virtual ~XrdProofdNetMgr()
Destructor.
int ReadBuffer(XrdProofdProtocol *p)
Process a readbuf request.
const char * PROOFcfg() const
int DoDirectiveAdminReqTO(char *, XrdOucStream *, bool)
Process 'adminreqto' directive.
unsigned int added
unsigned int per_iteration
unsigned int available