Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/BdbAccess/BdbFSMgr.hh

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // File:
00003 //      BdbFSMgr.hh
00004 //
00005 // Description:
00006 //      Class BdbFSMgr definition. The class provides an API to all
00007 //      the file system operations
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory
00011 //
00012 // Author List:
00013 //      Jacek Becla                Original Author
00014 //      Jean-Noel Albert           Support for the large files on Sun
00015 //
00016 // Copyright Information:
00017 //      Copyright (C) 1997      Stanford Linear Accelerator Center
00018 //
00019 //------------------------------------------------------------------------------
00020 
00021 #ifndef BDBFSMGR_HH
00022 #define BDBFSMGR_HH
00023 
00024 #ifndef BDB_HH
00025 #include "BdbUtil/Bdb.hh"
00026 #endif
00027 
00028 extern "C" {
00029 #include <sys/types.h>
00030 }
00031 
00032 #include "BdbAccess/BdbFileConfig.hh"
00033 #include "BdbAccess/BdbFileSystem.hh"
00034 
00035 class BdbPud;
00036 
00037 #ifndef BDBANYFSHANDLER
00038 #include "BdbAccess/BdbAnyFSHandler.hh"
00039 #endif
00040 
00041 
00042 class BdbFSMgr
00043 {
00044 // -----------------
00045 // Static Members --
00046 // -----------------
00047 private:
00048 
00049     static d_Boolean _neverUseDaemon;   // if true, the FS must be available locally
00050 
00051     // ------------------
00052 // Private Members --
00053 // ------------------
00054 private:
00055 
00056     ooVString  _fsGroup;
00057     
00058     d_ULong _currentFSNr;        // if !sequentialDistribution it needs to be resynchronized
00059 
00060     BdbAnyFSHandler _anyFSHandler;
00061 
00062 // --------------------
00063 // Private Functions --
00064 // --------------------
00065 private:
00066 
00067     BdbPud* selectDaemon(d_Boolean anyDaemon);
00068 
00069         BdbStatus firstAvailableDisk(d_ULong currentGlobalFSNr=0);
00070         d_Boolean isAvailableSpace();
00071                 
00072         BdbStatus changeFileMode(int mode, const char* fileName) const;
00073 
00074         BdbPud* daemon(d_Boolean anyDaemon=true);
00075         
00076 // -------------------
00077 // Public Interface --
00078 // -------------------
00079 public:
00080 
00081    // Constructor(s)
00082         BdbFSMgr();
00083 
00084         // Destructor
00085         ~BdbFSMgr();
00086 
00087         BdbStatus rebuildFSInfo(const char* domainName, 
00088                             const char* authLevelName,
00089                             const char* authName, 
00090                             const char* compName);
00091 
00092         BdbStatus verifyDiskSpace(d_Boolean* diskChanged);
00093 
00094         BdbStatus copyFile(const char* source, const char* target, d_Boolean anyDaemon=true);
00095         BdbStatus moveFile(const char* source, const char* target, d_Boolean anyDaemon=true);
00096         BdbStatus symLink(const char* source, const char* target, d_Boolean anyDaemon=true);
00097         BdbStatus checkAvailSpace(const char* path, d_ULong minSpaceNeeded, 
00098                               d_Boolean* isAvailable, d_Boolean anyDaemon=true);
00099         BdbStatus chmodWrite(const char* fileName, d_Boolean anyDaemon=true);
00100         BdbStatus chmodRead(const char* fileName, d_Boolean anyDaemon=true);
00101         BdbStatus checkExist(const char* fileName, d_Boolean anyDaemon=true);
00102     BdbStatus createFile(const char* fileName, d_Boolean anyDaemon=true);
00103         BdbStatus rmFile(const char* fileName, d_Boolean anyDaemon=true);
00104         BdbStatus mkDir(const char* dirName, d_Boolean anyDaemon=true);
00105         BdbStatus rmDir(const char* dirName, d_Boolean anyDaemon=true);
00106         BdbStatus getFileSize(const char* fileName, off_t& theSize, 
00107                           d_Boolean anyDaemon=true);
00108         BdbStatus getFDFilePath(const char* bootFilePath, 
00109                                 char*& theFDPath) const;
00110 
00111     BdbStatus getModificationDate(const char* fileName, time_t& stime, 
00112                                   d_Boolean anyDaemon=true);
00113 
00114     BdbStatus purgeMigrateFile(const char* path, const char* params);
00115                         
00116     const char* baseDir(d_Boolean anyFS=true);
00117     const char* host(d_Boolean anyFS=true);
00118     int getPortNr(const char* host) const;
00119     d_ULong minDiskSpace(d_Boolean anyFS=true);
00120 
00121         inline d_Boolean daemonDisabled() const;
00122         inline const char* fsGroupName() const;
00123 } ;
00124 
00125 
00126 // ------------------------------------------------------
00127 // --  I  N  L  I  N  E      F  U  N  C  T  I  O  N  S --
00128 // ------------------------------------------------------
00129 
00130 inline d_Boolean BdbFSMgr::daemonDisabled() const
00131 {       return _neverUseDaemon ; }
00132 
00133 inline const char* BdbFSMgr::fsGroupName() const
00134 {       return _fsGroup.head() ; }
00135 
00136 #endif /* BDBFSMGR_HH */
00137 

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002