Attaches/creates and detaches/deletes cache-io objects for disk based cache. More...
#include <XrdFileCache.hh>
Classes | |
struct | WriteQ |
Public Member Functions | |
Cache (XrdSysLogger *logger) | |
Constructor. | |
virtual XrdOucCacheIO2 * | Attach (XrdOucCacheIO2 *, int Options=0) |
virtual int | isAttached () |
Number of cache-io objects atteched through this cache. | |
virtual void | EnvInfo (XrdOucEnv &theEnv) |
virtual int | LocalFilePath (const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess) |
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 XrdFileCache configuration. | |
bool | Config (const char *config_filename, const char *parameters) |
Parse configuration file. | |
void | Purge () |
Thread function running disk cache purge periodically. | |
int | UnlinkUnlessOpen (const std::string &f_name) |
Remove file from cache unless it is currently open. | |
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. | |
bool | RequestRAMBlock () |
void | RAMBlockReleased () |
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 () |
void | ExecuteCommandUrl (const std::string &command_url) |
Static Public Member Functions | |
static Cache & | CreateInstance (XrdSysLogger *logger) |
Singleton creation. | |
static Cache & | GetInstance () |
Singleton access. | |
static bool | VCheck (XrdVersionInfo &urVersion) |
Version check. | |
Private Types | |
typedef std::map< std::string, File * > | ActiveMap_t |
typedef ActiveMap_t::iterator | ActiveMap_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 | xdlib (XrdOucStream &) |
bool | xtrace (XrdOucStream &) |
bool | cfg2bytes (const std::string &str, long long &store, long long totalSpace, const char *name) |
int | UnlinkCommon (const std::string &f_name, bool fail_if_open) |
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) |
Private Attributes | |
XrdSysError | m_log |
XrdFileCache namespace logger. | |
XrdSysTrace * | m_trace |
const char * | m_traceID |
XrdOucCacheStats | m_stats |
XrdOss * | m_output_fs |
disk cache file system | |
std::vector < XrdFileCache::Decision * > | m_decisionpoints |
decision plugins | |
std::map< std::string, long long > | m_filesInQueue |
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_RAMblock_mutex |
lock for allcoation of RAM blocks | |
int | m_RAMblocks_used |
bool | m_isClient |
True if running as client. | |
WriteQ | m_writeQ |
ActiveMap_t | m_active |
FNameSet_t | m_purge_delay_set |
bool | m_in_purge |
XrdSysCondVar | m_active_cond |
PrefetchList | m_prefetchList |
Static Private Attributes | |
static Cache * | m_factory |
this object | |
static XrdScheduler * | schedP |
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
typedef ActiveMap_t::iterator XrdFileCache::Cache::ActiveMap_i [private] |
typedef std::map<std::string, File*> XrdFileCache::Cache::ActiveMap_t [private] |
typedef std::set<std::string> XrdFileCache::Cache::FNameSet_t [private] |
typedef std::vector<File*> XrdFileCache::Cache::PrefetchList [private] |
XrdFileCache::Cache::Cache | ( | XrdSysLogger * | logger | ) |
Constructor.
void XrdFileCache::Cache::AddWriteTask | ( | Block * | b, | |
bool | from_read | |||
) |
Add downloaded block in write queue.
virtual XrdOucCacheIO2* XrdFileCache::Cache::Attach | ( | XrdOucCacheIO2 * | , | |
int | Options = 0 | |||
) | [virtual] |
Implements XrdOucCache2.
bool XrdFileCache::Cache::cfg2bytes | ( | const std::string & | str, | |
long long & | store, | |||
long long | totalSpace, | |||
const char * | name | |||
) | [private] |
bool XrdFileCache::Cache::Config | ( | const char * | config_filename, | |
const char * | parameters | |||
) |
Parse configuration file.
config_filename | path to configuration file | |
parameters | optional parameters to be passed |
bool XrdFileCache::Cache::ConfigParameters | ( | std::string | , | |
XrdOucStream & | , | |||
TmpConfiguration & | tmpc | |||
) | [private] |
bool XrdFileCache::Cache::ConfigXeq | ( | char * | , | |
XrdOucStream & | ||||
) | [private] |
static Cache& XrdFileCache::Cache::CreateInstance | ( | XrdSysLogger * | logger | ) | [static] |
Singleton creation.
void XrdFileCache::Cache::dec_ref_cnt | ( | File * | , | |
bool | high_debug | |||
) | [private] |
bool XrdFileCache::Cache::Decide | ( | XrdOucCacheIO * | ) |
Makes decision if the original XrdOucCacheIO should be cached.
& | URL of file |
void XrdFileCache::Cache::DeRegisterPrefetchFile | ( | File * | ) |
virtual void XrdFileCache::Cache::EnvInfo | ( | XrdOucEnv & | theEnv | ) | [virtual] |
Supply environmental information to the cache. This is only called on the server but is optional and might not be called. When it is called, it is gauranteed to occur before any active use of the cache and is essentially serialized (i.e. the main start-up thread is used). The environmental information should only be used to optimize processing. For instance, when cache monitoring is enabled, the variable "pfc.gStream*" is defined and is a pointer to a gStream object that can be used to report statistical information to a monitoring collector.
theEnv | - Reference to environmental information. |
Reimplemented from XrdOucCache2.
void XrdFileCache::Cache::ExecuteCommandUrl | ( | const std::string & | command_url | ) |
void XrdFileCache::Cache::FileSyncDone | ( | File * | , | |
bool | high_debug | |||
) |
File* XrdFileCache::Cache::GetFile | ( | const std::string & | , | |
IO * | , | |||
long long | off = 0 , |
|||
long long | filesize = 0 | |||
) |
static Cache& XrdFileCache::Cache::GetInstance | ( | ) | [static] |
Singleton access.
XrdSysError* XrdFileCache::Cache::GetLog | ( | ) | [inline] |
References m_log.
File* XrdFileCache::Cache::GetNextFileToPrefetch | ( | ) |
XrdOss* XrdFileCache::Cache::GetOss | ( | ) | const [inline] |
References m_output_fs.
XrdSysTrace* XrdFileCache::Cache::GetTrace | ( | ) | [inline] |
References m_trace.
Referenced by XrdFileCache::IO::GetTrace().
void XrdFileCache::Cache::inc_ref_cnt | ( | File * | , | |
bool | lock, | |||
bool | high_debug | |||
) | [private] |
virtual int XrdFileCache::Cache::isAttached | ( | ) | [virtual] |
Number of cache-io objects atteched through this cache.
Reimplemented from XrdOucCache.
bool XrdFileCache::Cache::IsFileActiveOrPurgeProtected | ( | const std::string & | ) |
virtual int XrdFileCache::Cache::LocalFilePath | ( | const char * | url, | |
char * | buff = 0 , |
|||
int | blen = 0 , |
|||
LFP_Reason | why = ForAccess | |||
) | [virtual] |
Reimplemented from XrdOucCache2.
void XrdFileCache::Cache::Prefetch | ( | ) |
virtual int XrdFileCache::Cache::Prepare | ( | const char * | url, | |
int | oflags, | |||
mode_t | mode | |||
) | [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 XrdOucCache2.
void XrdFileCache::Cache::ProcessWriteTasks | ( | ) |
Separate task which writes blocks from ram to disk.
void XrdFileCache::Cache::Purge | ( | ) |
Thread function running disk cache purge periodically.
void XrdFileCache::Cache::RAMBlockReleased | ( | ) |
const Configuration& XrdFileCache::Cache::RefConfiguration | ( | ) | const [inline] |
Reference XrdFileCache configuration.
References m_configuration.
void XrdFileCache::Cache::RegisterPrefetchFile | ( | File * | ) |
void XrdFileCache::Cache::RemoveWriteQEntriesFor | ( | File * | f | ) |
Remove blocks from write queue which belong to given prefetch. This method is used at the time of File destruction.
bool XrdFileCache::Cache::RequestRAMBlock | ( | ) |
void XrdFileCache::Cache::schedule_file_sync | ( | File * | , | |
bool | ref_cnt_already_set, | |||
bool | high_debug | |||
) | [private] |
Referenced by ScheduleFileSync().
void XrdFileCache::Cache::ScheduleFileSync | ( | File * | f | ) | [inline] |
References schedule_file_sync().
virtual int XrdFileCache::Cache::Stat | ( | const char * | url, | |
struct stat & | sbuff | |||
) | [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 XrdOucCache2.
virtual int XrdFileCache::Cache::Unlink | ( | const char * | url | ) | [virtual] |
Reimplemented from XrdOucCache.
int XrdFileCache::Cache::UnlinkCommon | ( | const std::string & | f_name, | |
bool | fail_if_open | |||
) | [private] |
int XrdFileCache::Cache::UnlinkUnlessOpen | ( | const std::string & | f_name | ) |
Remove file from cache unless it is currently open.
static bool XrdFileCache::Cache::VCheck | ( | XrdVersionInfo & | urVersion | ) | [inline, static] |
Version check.
bool XrdFileCache::Cache::xdlib | ( | XrdOucStream & | ) | [private] |
bool XrdFileCache::Cache::xtrace | ( | XrdOucStream & | ) | [private] |
ActiveMap_t XrdFileCache::Cache::m_active [private] |
configurable parameters
Referenced by RefConfiguration().
std::vector<XrdFileCache::Decision*> XrdFileCache::Cache::m_decisionpoints [private] |
decision plugins
Cache* XrdFileCache::Cache::m_factory [static, private] |
this object
std::map<std::string, long long> XrdFileCache::Cache::m_filesInQueue [private] |
bool XrdFileCache::Cache::m_in_purge [private] |
bool XrdFileCache::Cache::m_isClient [private] |
True if running as client.
XrdSysError XrdFileCache::Cache::m_log [private] |
XrdFileCache namespace logger.
Referenced by GetLog().
XrdOss* XrdFileCache::Cache::m_output_fs [private] |
disk cache file system
Referenced by GetOss().
lock for vector of prefetching files
bool XrdFileCache::Cache::m_prefetch_enabled [private] |
set to true when prefetching is enabled
lock for allcoation of RAM blocks
int XrdFileCache::Cache::m_RAMblocks_used [private] |
XrdOucCacheStats XrdFileCache::Cache::m_stats [private] |
XrdSysTrace* XrdFileCache::Cache::m_trace [private] |
Referenced by GetTrace().
const char* XrdFileCache::Cache::m_traceID [private] |
WriteQ XrdFileCache::Cache::m_writeQ [private] |
XrdScheduler* XrdFileCache::Cache::schedP [static, private] |