Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TXProofMgr.h
Go to the documentation of this file.
1 // @(#)root/proofx:$Id$
2 // Author: G. Ganis, Nov 2005
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_TXProofMgr
13 #define ROOT_TXProofMgr
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TXProofMgr //
19 // //
20 // The PROOF manager interacts with the PROOF server coordinator to //
21 // create or destroy a PROOF session, attach to or detach from //
22 // existing one, and to monitor any client activity on the cluster. //
23 // At most one manager instance per server is allowed. //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #include "TProofMgr.h"
28 #include "TUrl.h"
29 #include "TXHandler.h"
30 
31 //
32 // XPROOF client version: increase whenever a non backward compatible
33 // change occur
34 // ->1 first version being tested by ALICE
35 const Int_t kXPROOF_Protocol = 1;
36 
37 class TStopwatch;
38 class TXSocket;
39 
40 class TXProofMgr : public TProofMgr, public TXHandler {
41 
42 private:
43 
44  TXSocket *fSocket; // Connection to XRD
45 
46  Int_t Init(Int_t loglevel = -1);
47 
48  void CpProgress(const char *pfx, Long64_t bytes,
49  Long64_t size, TStopwatch *watch, Bool_t cr = kFALSE);
50  TObjString *Exec(Int_t action,
51  const char *what, const char *how, const char *where);
52 
53 public:
54  TXProofMgr(const char *url, Int_t loglevel = -1, const char *alias = "");
55  virtual ~TXProofMgr();
56 
57  Bool_t HandleInput(const void *);
58  Bool_t HandleError(const void *in = 0);
59 
60  Bool_t IsValid() const { return fSocket; }
61  void SetInvalid();
62 
63  TProof *AttachSession(Int_t id, Bool_t gui = kFALSE)
64  { return TProofMgr::AttachSession(id, gui); }
65  TProof *AttachSession(TProofDesc *d, Bool_t gui = kFALSE);
66  void DetachSession(Int_t, Option_t * = "");
67  void DetachSession(TProof *, Option_t * = "");
68  const char *GetMssUrl(Bool_t = kFALSE);
69  TProofLog *GetSessionLogs(Int_t ridx = 0, const char *stag = 0,
70  const char *pattern = "-v \"| SvcMsg\"",
71  Bool_t rescan = kFALSE);
72  Bool_t MatchUrl(const char *url);
73  void ShowROOTVersions();
74  TList *QuerySessions(Option_t *opt = "S");
75  TObjString *ReadBuffer(const char *file, Long64_t ofs, Int_t len);
76  TObjString *ReadBuffer(const char *file, const char *pattern);
77  Int_t Reset(Bool_t hard = kFALSE, const char *usr = 0);
78  Int_t SendMsgToUsers(const char *msg, const char *usr = 0);
79  Int_t SetROOTVersion(const char *tag);
80  void ShowWorkers();
81 
82  // Remote file system actions
83  Int_t Cp(const char *src, const char *dst = 0, const char *opts = 0);
84  void Find(const char *what = "~/", const char *how = "-type f", const char *where = 0);
85  void Grep(const char *what, const char *how = 0, const char *where = 0);
86  void Ls(const char *what = "~/", const char *how = 0, const char *where = 0);
87  void More(const char *what, const char *how = 0, const char *where = 0);
88  Int_t Rm(const char *what, const char *how = 0, const char *where = 0);
89  void Tail(const char *what, const char *how = 0, const char *where = 0);
90  Int_t Md5sum(const char *what, TString &sum, const char *where = 0);
91  Int_t Stat(const char *what, FileStat_t &st, const char *where = 0);
92 
93  Int_t GetFile(const char *remote, const char *local, const char *opt = 0);
94  Int_t PutFile(const char *local, const char *remote, const char *opt = 0);
95 
96  ClassDef(TXProofMgr,0) // XrdProofd PROOF manager interface
97 };
98 
99 #endif