TRFIOFile.h

Go to the documentation of this file.
00001 // @(#)root/rfio:$Id: TRFIOFile.h 35330 2010-09-16 12:12:03Z pcanal $
00002 // Author: Fons Rademakers  20/01/99 + Giulia Taurelli  29/06/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TRFIOFile
00013 #define ROOT_TRFIOFile
00014 
00015 ///////////////////////////////////////////////////////////////////////////
00016 //                                                                       //
00017 // TRFIOFile                                                             //
00018 //                                                                       //
00019 // A TRFIOFile is like a normal TFile except that it reads and writes    //
00020 // its data via a rfiod server (for more on the rfiod daemon see         //
00021 // http://wwwinfo.cern.ch/pdp/serv/shift.html). TRFIOFile file names     //
00022 // are in standard URL format with protocol "rfio". The following are    //
00023 // valid TRFIOFile URL's:                                                //
00024 //                                                                       //
00025 //    rfio:/afs/cern.ch/user/r/rdm/galice.root                           //
00026 //         where galice.root is a symlink of the type /shift/.../...     //
00027 //    rfio:na49db1:/data1/raw.root                                       //
00028 //    rfio:/castor/cern.ch/user/r/rdm/test.root                          //
00029 //                                                                       //
00030 // If Castor 2.1 is used the file names can be given also in the         //
00031 // following ways:                                                       //
00032 //                                                                       //
00033 //  rfio://host:port/?path=FILEPATH                                      //
00034 //  rfio://host/?path=FILEPATH                                           //
00035 //  rfio:///castor?path=FILEPATH                                         //
00036 //  rfio://stager_host:stager_port/?path=/castor/cern.ch/user/r/         //
00037 //    rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION      //
00038 //  rfio://stager_host/?path=/castor/cern.ch/user/r/                     //
00039 //    rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION      //
00040 //  rfio:///castor?path=/castor/cern.ch/user/r/                          //
00041 //    rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION      //
00042 //                                                                       //
00043 // path is mandatory as parameter but all the other ones are optional.   //
00044 //                                                                       //
00045 // For the ultimate description of supported urls see:                   //
00046 //    https://twiki.cern.ch/twiki/bin/view/FIOgroup/RfioRootTurl         //
00047 //                                                                       //
00048 ///////////////////////////////////////////////////////////////////////////
00049 
00050 #ifndef ROOT_TFile
00051 #include "TFile.h"
00052 #endif
00053 #ifndef ROOT_TSystem
00054 #include "TSystem.h"
00055 #endif
00056 
00057 
00058 class TRFIOFile : public TFile {
00059 
00060 private:
00061    TRFIOFile() { }
00062 
00063    // Interface to basic system I/O routines
00064    Int_t    SysOpen(const char *pathname, Int_t flags, UInt_t mode);
00065    Int_t    SysClose(Int_t fd);
00066    Int_t    SysRead(Int_t fd, void *buf, Int_t len);
00067    Int_t    SysWrite(Int_t fd, const void *buf, Int_t len);
00068    Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence);
00069    Int_t    SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
00070    Int_t    SysSync(Int_t) { /* no fsync for RFIO */ return 0; }
00071    Bool_t   ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
00072 
00073 public:
00074    TRFIOFile(const char *url, Option_t *option="",
00075              const char *ftitle="", Int_t compress=1);
00076    ~TRFIOFile();
00077 
00078    Int_t   GetErrno() const;
00079    void    ResetErrno() const;
00080 
00081    ClassDef(TRFIOFile,1)  //A ROOT file that reads/writes via a rfiod server
00082 };
00083 
00084 
00085 class TRFIOSystem : public TSystem {
00086 
00087 private:
00088    void    *fDirp;   // directory handler
00089 
00090    void    *GetDirPtr() const { return fDirp; }
00091 
00092 public:
00093    TRFIOSystem();
00094    virtual ~TRFIOSystem() { }
00095 
00096    Int_t       MakeDirectory(const char *name);
00097    void       *OpenDirectory(const char *name);
00098    void        FreeDirectory(void *dirp);
00099    const char *GetDirEntry(void *dirp);
00100    Int_t       GetPathInfo(const char *path, FileStat_t &buf);
00101    Bool_t      AccessPathName(const char *path, EAccessMode mode);
00102    Int_t       Unlink(const char *path);
00103 
00104    ClassDef(TRFIOSystem,0)  // Directory handler for RFIO
00105 };
00106 
00107 #endif

Generated on Tue Jul 5 14:30:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1