xrootd
|
Attaches/creates and detaches/deletes cache-io objects for disk based cache. More...
#include <XrdPfc.hh>
Classes | |
struct | WriteQ |
Public Member Functions | |
Cache (XrdSysLogger *logger, XrdOucEnv *env) | |
Constructor. | |
virtual XrdOucCacheIO * | Attach (XrdOucCacheIO *, int Options=0) |
virtual int | LocalFilePath (const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess, bool forall=false) |
virtual int | Prepare (const char *url, int oflags, mode_t mode) |
virtual int | Stat (const char *url, struct stat &sbuff) |
virtual int | Unlink (const char *url) |
bool | Decide (XrdOucCacheIO *) |
Makes decision if the original XrdOucCacheIO should be cached. | |
const Configuration & | RefConfiguration () const |
Reference XrdPfc configuration. | |
bool | Config (const char *config_filename, const char *parameters) |
Parse configuration file. | |
void | ResourceMonitorHeartBeat () |
Thread function checking resource usage periodically. | |
void | Purge () |
Thread function invoked to scan and purge files from disk when needed. | |
int | UnlinkFile (const std::string &f_name, bool fail_if_open) |
Remove cinfo and data files from cache. | |
void | AddWriteTask (Block *b, bool from_read) |
Add downloaded block in write queue. | |
void | RemoveWriteQEntriesFor (File *f) |
Remove blocks from write queue which belong to given prefetch. This method is used at the time of File destruction. | |
void | ProcessWriteTasks () |
Separate task which writes blocks from ram to disk. | |
char * | RequestRAM (long long size) |
void | ReleaseRAM (char *buf, long long size) |
void | RegisterPrefetchFile (File *) |
void | DeRegisterPrefetchFile (File *) |
File * | GetNextFileToPrefetch () |
void | Prefetch () |
XrdOss * | GetOss () const |
bool | IsFileActiveOrPurgeProtected (const std::string &) |
File * | GetFile (const std::string &, IO *, long long off=0, long long filesize=0) |
void | ReleaseFile (File *, IO *) |
void | ScheduleFileSync (File *f) |
void | FileSyncDone (File *, bool high_debug) |
XrdSysError * | GetLog () |
XrdSysTrace * | GetTrace () |
XrdXrootdGStream * | GetGStream () |
void | ExecuteCommandUrl (const std::string &command_url) |
virtual XrdOucCacheIO * | Attach (XrdOucCacheIO *ioP, int opts=0)=0 |
Obtain a new IO object that fronts existing XrdOucCacheIO. | |
Public Member Functions inherited from XrdOucCache | |
virtual int | Rename (const char *oldp, const char *newp) |
virtual int | Rmdir (const char *dirp) |
virtual int | Truncate (const char *path, off_t size) |
virtual int | Xeq (XeqCmd cmd, char *arg, int arglen) |
XrdOucCache (const char *ctype) | |
virtual | ~XrdOucCache () |
Destructor. | |
Static Public Member Functions | |
static Cache & | CreateInstance (XrdSysLogger *logger, XrdOucEnv *env) |
Singleton creation. | |
static Cache & | GetInstance () |
Singleton access. | |
static const Cache & | TheOne () |
static const Configuration & | Conf () |
static bool | VCheck (XrdVersionInfo &urVersion) |
Version check. | |
Static Public Attributes | |
static XrdScheduler * | schedP |
Static Public Attributes inherited from XrdOucCache | |
static const int | optFIS = 0x0001 |
File is structured (e.g. root file) | |
static const int | optRW = 0x0004 |
File is read/write (o/w read/only) | |
static const int | optNEW = 0x0014 |
File is new -> optRW (o/w read or write) | |
static const int | optWIN = 0x0024 |
File is new -> optRW use write-in cache. | |
Private Types | |
enum | ScanAndPurgeThreadState_e { SPTS_Idle , SPTS_Scan , SPTS_Purge , SPTS_Done } |
typedef std::map< std::string, File * > | ActiveMap_t |
typedef ActiveMap_t::iterator | ActiveMap_i |
typedef std::multimap< std::string, XrdPfc::Stats > | StatsMMap_t |
typedef StatsMMap_t::iterator | StatsMMap_i |
typedef std::set< std::string > | FNameSet_t |
typedef std::vector< File * > | PrefetchList |
Private Member Functions | |
bool | ConfigParameters (std::string, XrdOucStream &, TmpConfiguration &tmpc) |
bool | ConfigXeq (char *, XrdOucStream &) |
bool | xcschk (XrdOucStream &) |
bool | xdlib (XrdOucStream &) |
bool | xtrace (XrdOucStream &) |
bool | cfg2bytes (const std::string &str, long long &store, long long totalSpace, const char *name) |
void | inc_ref_cnt (File *, bool lock, bool high_debug) |
void | dec_ref_cnt (File *, bool high_debug) |
void | schedule_file_sync (File *, bool ref_cnt_already_set, bool high_debug) |
void | copy_out_active_stats_and_update_data_fs_state () |
Private Attributes | |
XrdOucEnv * | m_env |
environment passed in at creation | |
XrdSysError | m_log |
XrdPfc namespace logger. | |
XrdSysTrace * | m_trace |
const char * | m_traceID |
XrdOss * | m_oss |
disk cache file system | |
XrdXrootdGStream * | m_gstream |
std::vector< XrdPfc::Decision * > | m_decisionpoints |
decision plugins | |
Configuration | m_configuration |
configurable parameters | |
XrdSysCondVar | m_prefetch_condVar |
lock for vector of prefetching files | |
bool | m_prefetch_enabled |
set to true when prefetching is enabled | |
XrdSysMutex | m_RAM_mutex |
lock for allcoation of RAM blocks | |
long long | m_RAM_used |
long long | m_RAM_write_queue |
std::list< char * > | m_RAM_std_blocks |
A list of blocks of standard size, to be reused. | |
int | m_RAM_std_size |
bool | m_isClient |
True if running as client. | |
WriteQ | m_writeQ |
ActiveMap_t | m_active |
Map of currently active / open files. | |
StatsMMap_t | m_closed_files_stats |
FNameSet_t | m_purge_delay_set |
bool | m_in_purge |
XrdSysCondVar | m_active_cond |
Cond-var protecting active file data structures. | |
PrefetchList | m_prefetchList |
XrdSysCondVar | m_stats_n_purge_cond |
communication between heart-beat and scan-purge threads | |
DataFsState * | m_fs_state |
directory state for access / usage info and quotas | |
int | m_last_scan_duration |
int | m_last_purge_duration |
ScanAndPurgeThreadState_e | m_spt_state |
Static Private Attributes | |
static Cache * | m_instance |
this object | |
Additional Inherited Members | |
Public Types inherited from XrdOucCache | |
enum | LFP_Reason { ForAccess =0 , ForInfo , ForPath } |
enum | XeqCmd { xeqNoop = 0 } |
Public Attributes inherited from XrdOucCache | |
XrdOucCacheStats | Statistics |
const char | CacheType [8] |
A 1-to-7 character cache type identifier (usually pfc or rmc). | |
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
XrdPfc::Cache::Cache | ( | XrdSysLogger * | logger, |
XrdOucEnv * | env | ||
) |
Constructor.
void XrdPfc::Cache::AddWriteTask | ( | Block * | b, |
bool | from_read | ||
) |
Add downloaded block in write queue.
|
virtual |
Implements XrdOucCache.
|
virtual |
Obtain a new IO object that fronts existing XrdOucCacheIO.
Implements XrdOucCache.
|
private |
|
static |
bool XrdPfc::Cache::Config | ( | const char * | config_filename, |
const char * | parameters | ||
) |
Parse configuration file.
config_filename | path to configuration file |
parameters | optional parameters to be passed |
|
private |
|
private |
|
private |
|
static |
Singleton creation.
|
private |
bool XrdPfc::Cache::Decide | ( | XrdOucCacheIO * | ) |
Makes decision if the original XrdOucCacheIO should be cached.
& | URL of file |
void XrdPfc::Cache::DeRegisterPrefetchFile | ( | File * | ) |
void XrdPfc::Cache::ExecuteCommandUrl | ( | const std::string & | command_url | ) |
void XrdPfc::Cache::FileSyncDone | ( | File * | , |
bool | high_debug | ||
) |
File * XrdPfc::Cache::GetFile | ( | const std::string & | , |
IO * | , | ||
long long | off = 0 , |
||
long long | filesize = 0 |
||
) |
|
inline |
References m_gstream.
|
static |
Singleton access.
|
inline |
References m_log.
File * XrdPfc::Cache::GetNextFileToPrefetch | ( | ) |
|
inline |
References m_trace.
Referenced by XrdPfc::IO::GetTrace().
|
private |
bool XrdPfc::Cache::IsFileActiveOrPurgeProtected | ( | const std::string & | ) |
|
virtual |
Reimplemented from XrdOucCache.
void XrdPfc::Cache::Prefetch | ( | ) |
|
virtual |
Prepare the cache for a file open request. This method is called prior to actually opening a file. This method is meant to allow defering an open request or implementing the full I/O stack in the cache layer.
url | - Pointer to the url about to be opened. |
oflags | - Standard Unix open flags (see open(2)). |
mode | - Standard mode flags if file is being created. |
Reimplemented from XrdOucCache.
void XrdPfc::Cache::ProcessWriteTasks | ( | ) |
Separate task which writes blocks from ram to disk.
void XrdPfc::Cache::Purge | ( | ) |
Thread function invoked to scan and purge files from disk when needed.
|
inline |
Reference XrdPfc configuration.
References m_configuration.
void XrdPfc::Cache::RegisterPrefetchFile | ( | File * | ) |
void XrdPfc::Cache::ReleaseRAM | ( | char * | buf, |
long long | size | ||
) |
void XrdPfc::Cache::RemoveWriteQEntriesFor | ( | File * | f | ) |
Remove blocks from write queue which belong to given prefetch. This method is used at the time of File destruction.
char * XrdPfc::Cache::RequestRAM | ( | long long | size | ) |
void XrdPfc::Cache::ResourceMonitorHeartBeat | ( | ) |
Thread function checking resource usage periodically.
|
private |
Referenced by ScheduleFileSync().
|
inline |
References schedule_file_sync().
|
virtual |
Perform a stat() operation (defaults to passthrough).
url | pointer to the url whose stat information is wanted. |
sbuff | reference to the stat buffer to be filled in. Only fields st_size, st_blocks, st_mtime (st_atime and st_ctime may be set to st_mtime), st_ino, and st_mode need to be set. All other fields are preset and should not be changed. |
Reimplemented from XrdOucCache.
|
static |
|
virtual |
Remove a file from the cache.
path | - the path of the file to be removed. |
Reimplemented from XrdOucCache.
int XrdPfc::Cache::UnlinkFile | ( | const std::string & | f_name, |
bool | fail_if_open | ||
) |
Remove cinfo and data files from cache.
|
inlinestatic |
Version check.
|
private |
|
private |
|
private |
|
private |
Map of currently active / open files.
|
private |
Cond-var protecting active file data structures.
|
private |
|
private |
configurable parameters
Referenced by RefConfiguration().
|
private |
decision plugins
|
private |
environment passed in at creation
|
private |
directory state for access / usage info and quotas
|
private |
Referenced by GetGStream().
|
private |
|
staticprivate |
this object
|
private |
True if running as client.
|
private |
|
private |
|
private |
|
private |
lock for vector of prefetching files
|
private |
set to true when prefetching is enabled
|
private |
|
private |
|
private |
lock for allcoation of RAM blocks
|
private |
A list of blocks of standard size, to be reused.
|
private |
|
private |
|
private |
|
private |
|
private |
communication between heart-beat and scan-purge threads
|
private |
Referenced by GetTrace().
|
private |
|
private |
|
static |