Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/xrootd/XrdPosix/XrdPosixCache.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef __XRDOUPOSIXCACHE_HH__
0002 #define __XRDOUPOSIXCACHE_HH__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                      X r d P o s i x C a c h e . h h                       */
0006 /*                                                                            */
0007 /* (c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*                            All Rights Reserved                             */
0009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
0011 /*                                                                            */
0012 /* This file is part of the XRootD software suite.                            */
0013 /*                                                                            */
0014 /* XRootD is free software: you can redistribute it and/or modify it under    */
0015 /* the terms of the GNU Lesser General Public License as published by the     */
0016 /* Free Software Foundation, either version 3 of the License, or (at your     */
0017 /* option) any later version.                                                 */
0018 /*                                                                            */
0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0022 /* License for more details.                                                  */
0023 /*                                                                            */
0024 /* You should have received a copy of the GNU Lesser General Public License   */
0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0027 /*                                                                            */
0028 /* The copyright holder's institutional names and contributor's names may not */
0029 /* be used to endorse or promote products derived from this software without  */
0030 /* specific prior written permission of the institution or contributor.       */
0031 /******************************************************************************/
0032 
0033 class XrdOucCacheStats;
0034 
0035 class XrdPosixCache
0036 {
0037 public:
0038 
0039 //-----------------------------------------------------------------------------
0040 //! Convert a logical path to the path of the corresonding entry in the cache.
0041 //!
0042 //! @param  url     -> url of the directory or file to be converted.
0043 //! @param  buff    -> buffer to receive the result.
0044 //! @param  blen    The length of the buffer (should be at least 1024).
0045 //!
0046 //! @return =0      Buffer holds the result.
0047 //! @return <0      Conversion failed, the return value is -errno.
0048 //-----------------------------------------------------------------------------
0049 
0050 int           CachePath(const char *url, char *buff, int blen);
0051 
0052 //-----------------------------------------------------------------------------
0053 //! Check cache status of a file.
0054 //!
0055 //! @param  url     -> url of the logical file to be checked in the cache.
0056 //! @param  hold    When true, the file purge time is extended to allow the
0057 //!                 file to be accessed before eligible for purging. When
0058 //!                 false (the default) only status information is returned.
0059 //!
0060 //! @return >0      The file is fully cached.
0061 //! @return =0      The file exists in the cache but is not fully cached.
0062 //! @return <0      The file does not exist in the cache.
0063 //-----------------------------------------------------------------------------
0064 
0065 int           CacheQuery(const char *url, bool hold=false);
0066 
0067 //-----------------------------------------------------------------------------
0068 //! Remove directory from the cache.
0069 //!
0070 //! @param  path    -> filepath of directory to be removed
0071 //!
0072 //! @return 0       This method is currently not supported.
0073 //-----------------------------------------------------------------------------
0074 
0075 int           Rmdir(const char* path);
0076 
0077 //-----------------------------------------------------------------------------
0078 //! Rename a file or directory in the cache.
0079 //!
0080 //! @param  oldPath -> filepath of existing directory or file.
0081 //! @param  newPath -> filepath the directory or file is to have.
0082 //!
0083 //! @return 0       This method is currently not supported.
0084 //-----------------------------------------------------------------------------
0085 
0086 int           Rename(const char* oldPath, const char* newPath);
0087 
0088 //-----------------------------------------------------------------------------
0089 //! Rename a file or directory in the cache.
0090 //!
0091 //! @param  path    -> filepath of existing directory or file. This is the
0092 //!                    actual path in the cache (see CachePath()).
0093 //! @param  sbuff   Reference to the stat structure to hold the information.
0094 //!
0095 //! @return =0      The sbuff hold the information.
0096 //! @return !0      The file or direcory does not exist in the cache.
0097 //-----------------------------------------------------------------------------
0098 
0099 int           Stat(const char *path, struct stat &sbuff);
0100 
0101 //-----------------------------------------------------------------------------
0102 //! Rename a file or directory in the cache.
0103 //!
0104 //! @param  Stats   Reference to the statistics object to be filled in.
0105 //-----------------------------------------------------------------------------
0106 
0107 void          Statistics(XrdOucCacheStats &Stats);
0108 
0109 //-----------------------------------------------------------------------------
0110 //! Truncate a file in the cache.
0111 //!
0112 //! @param  path    -> filepath of file to be truncated.
0113 //! @param  size    The size in bytes the file should have.
0114 //!
0115 //! @return 0       This method is currently not supported.
0116 //-----------------------------------------------------------------------------
0117 
0118 int           Truncate(const char* path, off_t size);
0119 
0120 //-----------------------------------------------------------------------------
0121 //! Remove a file from the cache.
0122 //!
0123 //! @param  path    -> filepath of file to be removed.
0124 //!
0125 //! @return =0      File was removed.
0126 //! @return !0      File could not be removed, because of one of the below:
0127 //!                 -EBUSY   - the file is in use.
0128 //!                 -EAGAIN  - file is currently subject to internal processing.
0129 //!                 -errno   - file was not removed, filesystem unlink() failed.
0130 //-----------------------------------------------------------------------------
0131 
0132 int           Unlink(const char* path);
0133 
0134 //-----------------------------------------------------------------------------
0135 //! Constructor and destructor.
0136 //-----------------------------------------------------------------------------
0137 
0138               XrdPosixCache() {}
0139              ~XrdPosixCache() {}
0140 };
0141 #endif