Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-08 10:33:39

0001 #ifndef __XRDPFC_PURGEPLG_HH__
0002 #define __XRDPFC_PURGEPLG_HH__
0003 
0004 #include <string>
0005 #include <vector>
0006 
0007 namespace XrdPfc
0008 {
0009 struct DataFsPurgeshot;
0010 struct DirUsage;
0011 
0012 //----------------------------------------------------------------------------
0013 //! Base class for reguesting directory space to obtain.
0014 //----------------------------------------------------------------------------
0015 class PurgePin
0016 {
0017 public:
0018    struct DirInfo
0019    {
0020       std::string path;
0021       long long nBytesQuota{0};
0022       long long nBytesToRecover{0};
0023 
0024       // internal use by the Cache purge thread. to be revisited, maybe an access token is more appropriate.
0025       const DirUsage* dirUsage{nullptr};
0026    };
0027 
0028    typedef std::vector<DirInfo> list_t;
0029    typedef list_t::iterator list_i;
0030 
0031 protected:
0032    list_t m_list;
0033 
0034 public:
0035    virtual ~PurgePin() {}
0036 
0037 
0038    //---------------------------------------------------------------------
0039    //! 
0040    //!
0041    //! @return total number of bytes
0042    //---------------------------------------------------------------------
0043    virtual bool CallPeriodically() { return true; };
0044 
0045 
0046    //---------------------------------------------------------------------
0047    //! Provide erase information from directory statistics
0048    //!
0049    //! @param & XrdPfc::DirState vector, exported from the tree version.
0050    //          To be revisited -- can have a multi-step approach where
0051    //          cache periodically sends udates.
0052    //!
0053    //! @return total number of bytes
0054    //---------------------------------------------------------------------
0055    virtual long long GetBytesToRecover(const DataFsPurgeshot&) = 0;
0056 
0057    //------------------------------------------------------------------------------
0058    //! Parse configuration arguments.
0059    //!
0060    //! @param params configuration parameters
0061    //!
0062    //! @return status of configuration
0063    //------------------------------------------------------------------------------
0064    virtual bool ConfigPurgePin(const char* params)  // ?? AMT should this be abstract
0065    {
0066       (void) params;
0067       return true;
0068    }
0069 
0070    //-----------------------------------------------
0071    //!
0072    //!  Get quotas for the given paths. Used in the XrdPfc:Cache::Purge() thread.
0073    //!
0074    //------------------------------------------------------------------------------
0075    list_t &refDirInfos() { return m_list; }
0076 };
0077 }
0078 
0079 #endif