00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ROOT_TXNetFile
00011 #define ROOT_TXNetFile
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef ROOT_TNetFile
00048 #include "TNetFile.h"
00049 #endif
00050 #ifndef ROOT_TString
00051 #include "TString.h"
00052 #endif
00053 #ifndef ROOT_TUrl
00054 #include "TUrl.h"
00055 #endif
00056 #ifdef OLDXRDOUC
00057 # include "XrdSysToOuc.h"
00058 #endif
00059
00060 class TFileStager;
00061 class TSocket;
00062 class XrdClient;
00063 class XrdSysRecMutex;
00064
00065 class TXNetFile : public TNetFile {
00066
00067 friend class TXNetSystem;
00068
00069 private:
00070
00071 XrdClient *fClient;
00072 Bool_t fIsRootd;
00073
00074
00075 static Bool_t fgInitDone;
00076 static Bool_t fgRootdBC;
00077 static TFileStager *fgFileStager;
00078
00079 XrdSysRecMutex *fInitMtx;
00080
00081
00082
00083 TXNetFile(const TXNetFile&);
00084 TXNetFile& operator=(const TXNetFile&);
00085 void CreateXClient(const char *url, Option_t *option, Int_t netopt,
00086 Bool_t parallelopen);
00087
00088 Int_t ParseOptions(const char *opts, Int_t &cachesz, Int_t &readaheadsz,
00089 Int_t &rmpolicy, Int_t &mxredir, Int_t &rastrategy, Int_t &readtrimblksz);
00090
00091
00092
00093 void SynchronizeCacheSize();
00094
00095 void Init(Bool_t create);
00096 Bool_t Open(Option_t *option, Bool_t parallelopen);
00097 Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags,
00098 Long_t *modtime);
00099 Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode);
00100 Int_t SysClose(Int_t fd);
00101
00102
00103 static void FormUrl(TUrl uut, TString &uu);
00104 static Int_t GetRootdProtocol(TSocket *s);
00105 static void SetEnv();
00106
00107 public:
00108 TXNetFile() : TNetFile(), fClient(0), fIsRootd(0), fInitMtx(0) {}
00109 TXNetFile(const char *url, Option_t *option = "", const char *fTitle = "",
00110 Int_t compress = 1, Int_t netopt = 0, Bool_t parallelopen = kFALSE,
00111 const char *logicalurl = 0);
00112
00113 virtual ~TXNetFile();
00114
00115 virtual void Close(const Option_t *opt ="");
00116 virtual void ResetCache();
00117 virtual void Flush();
00118 virtual Int_t GetBytesToPrefetch() const;
00119 virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len);
00120 virtual TFile::EAsyncOpenStatus GetAsyncOpenStatus();
00121 virtual Bool_t IsOpen() const;
00122
00123 virtual void Print(Option_t *option="") const;
00124 virtual Bool_t ReadBuffer(char *buf, Int_t len);
00125 virtual Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
00126 virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
00127 virtual Int_t ReOpen(const Option_t *mode);
00128 virtual Bool_t WriteBuffer(const char *buffer, Int_t BufferLength);
00129
00130 ClassDef(TXNetFile,0)
00131 };
00132
00133 #endif