Downloads data into a file on local disk and handles IO read requests. More...
#include <XrdFileCachePrefetch.hh>
Classes | |
struct | RAM |
struct | RAMBlock |
struct | Task |
A prefetching task -- a file region that requires preferential treatment. More... | |
Public Member Functions | |
Prefetch (XrdOucCacheIO &inputFile, std::string &path, long long offset, long long fileSize) | |
Constructor. | |
~Prefetch () | |
Destructor. | |
void | Run () |
Thread function for file prefetching. | |
Stats & | GetStats () |
Reference to prefetch statistics. | |
void | WriteBlockToDisk (int ramIdx, size_t size) |
Write block to file on disk. Called from Cache. | |
void | DecRamBlockRefCount (int ramIdx) |
Decrease block reference count. | |
bool | InitiateClose () |
Initiate close. Return true if still IO active. Used in XrdPosixXrootd::Close(). | |
void | Sync () |
Sync file cache inf o and output data with disk. | |
Protected Member Functions | |
ssize_t | Read (char *buff, off_t offset, size_t size) |
Read from disk, RAM, task, or client. | |
int | ReadV (const XrdOucIOVec *readV, int n) |
Vector read from disk if block is already downloaded, else ReadV from client. | |
void | AppendIOStatToFileInfo () |
Write cache statistics in *cinfo file. | |
Private Types | |
enum | ReadRamState_t { kReadWait, kReadSuccess, kReadFailed } |
Private Member Functions | |
void | CloseCleanly () |
Stop Run thread. | |
Task * | GetNextTask () |
Get blocks to prefetch. | |
bool | Open () |
Open file handle for data file and info file on local disk. | |
XrdCl::Log * | clLog () const |
Short log alias. | |
ssize_t | ReadInBlocks (char *buff, off_t offset, size_t size) |
Split read in blocks. | |
Task * | CreateTaskForFirstUndownloadedBlock () |
Prefetch block. | |
bool | ReadFromTask (int bIdx, char *buff, long long off, size_t size) |
Create task from read request and wait its completed. | |
void | DoTask (Task *task) |
Read from client into in memory cache, queue ram buffer for disk write. | |
const char * | lPath () const |
Log path. | |
Private Attributes | |
RAM | m_ram |
in memory cache | |
XrdOssDF * | m_output |
file handle for data file on disk | |
XrdOssDF * | m_infoFile |
file handle for data-info file on disk | |
Info | m_cfi |
download status of file blocks and access statistics | |
XrdOucCacheIO & | m_input |
original data source | |
std::string | m_temp_filename |
filename of data file on disk | |
long long | m_offset |
offset of disk file for block-based operation | |
long long | m_fileSize |
size of disk file for block-based operation | |
bool | m_started |
state of run thread | |
bool | m_failed |
reading from original source or writing to disk has failed | |
bool | m_stopping |
run thread should be stopped | |
bool | m_stopped |
prefetch is stopped | |
XrdSysCondVar | m_stateCond |
state condition variable | |
XrdSysMutex | m_downloadStatusMutex |
mutex locking access to m_cfi object | |
std::deque< Task * > | m_tasks_queue |
download queue | |
XrdSysCondVar | m_queueCond |
m_tasks_queue condition variable | |
Stats | m_stats |
cache statistics, used in IO detach | |
XrdSysMutex | m_syncStatusMutex |
mutex locking fsync status | |
XrdJob * | m_syncer |
std::vector< int > | m_writes_during_sync |
int | m_non_flushed_cnt |
bool | m_in_sync |
Friends | |
class | IOEntireFile |
class | IOFileBlock |
Downloads data into a file on local disk and handles IO read requests.
enum XrdFileCache::Prefetch::ReadRamState_t [private] |
XrdFileCache::Prefetch::Prefetch | ( | XrdOucCacheIO & | inputFile, | |
std::string & | path, | |||
long long | offset, | |||
long long | fileSize | |||
) |
Constructor.
XrdFileCache::Prefetch::~Prefetch | ( | ) |
Destructor.
void XrdFileCache::Prefetch::AppendIOStatToFileInfo | ( | ) | [protected] |
Write cache statistics in *cinfo file.
XrdCl::Log* XrdFileCache::Prefetch::clLog | ( | ) | const [inline, private] |
Short log alias.
References XrdCl::DefaultEnv::GetLog().
void XrdFileCache::Prefetch::CloseCleanly | ( | ) | [private] |
Stop Run thread.
void XrdFileCache::Prefetch::DecRamBlockRefCount | ( | int | ramIdx | ) |
Decrease block reference count.
void XrdFileCache::Prefetch::DoTask | ( | Task * | task | ) | [private] |
Read from client into in memory cache, queue ram buffer for disk write.
Task* XrdFileCache::Prefetch::GetNextTask | ( | ) | [private] |
Get blocks to prefetch.
Stats& XrdFileCache::Prefetch::GetStats | ( | ) | [inline] |
Reference to prefetch statistics.
References m_stats.
bool XrdFileCache::Prefetch::InitiateClose | ( | ) |
Initiate close. Return true if still IO active. Used in XrdPosixXrootd::Close().
const char* XrdFileCache::Prefetch::lPath | ( | ) | const [private] |
Log path.
bool XrdFileCache::Prefetch::Open | ( | ) | [private] |
Open file handle for data file and info file on local disk.
ssize_t XrdFileCache::Prefetch::Read | ( | char * | buff, | |
off_t | offset, | |||
size_t | size | |||
) | [protected] |
Read from disk, RAM, task, or client.
bool XrdFileCache::Prefetch::ReadFromTask | ( | int | bIdx, | |
char * | buff, | |||
long long | off, | |||
size_t | size | |||
) | [private] |
Create task from read request and wait its completed.
ssize_t XrdFileCache::Prefetch::ReadInBlocks | ( | char * | buff, | |
off_t | offset, | |||
size_t | size | |||
) | [private] |
Split read in blocks.
int XrdFileCache::Prefetch::ReadV | ( | const XrdOucIOVec * | readV, | |
int | n | |||
) | [protected] |
Vector read from disk if block is already downloaded, else ReadV from client.
void XrdFileCache::Prefetch::Run | ( | ) |
Thread function for file prefetching.
void XrdFileCache::Prefetch::Sync | ( | ) |
Sync file cache inf o and output data with disk.
void XrdFileCache::Prefetch::WriteBlockToDisk | ( | int | ramIdx, | |
size_t | size | |||
) |
Write block to file on disk. Called from Cache.
friend class IOEntireFile [friend] |
friend class IOFileBlock [friend] |
Info XrdFileCache::Prefetch::m_cfi [private] |
download status of file blocks and access statistics
mutex locking access to m_cfi object
bool XrdFileCache::Prefetch::m_failed [private] |
reading from original source or writing to disk has failed
long long XrdFileCache::Prefetch::m_fileSize [private] |
size of disk file for block-based operation
bool XrdFileCache::Prefetch::m_in_sync [private] |
XrdOssDF* XrdFileCache::Prefetch::m_infoFile [private] |
file handle for data-info file on disk
XrdOucCacheIO& XrdFileCache::Prefetch::m_input [private] |
original data source
int XrdFileCache::Prefetch::m_non_flushed_cnt [private] |
long long XrdFileCache::Prefetch::m_offset [private] |
offset of disk file for block-based operation
XrdOssDF* XrdFileCache::Prefetch::m_output [private] |
file handle for data file on disk
m_tasks_queue condition variable
RAM XrdFileCache::Prefetch::m_ram [private] |
in memory cache
bool XrdFileCache::Prefetch::m_started [private] |
state of run thread
state condition variable
Stats XrdFileCache::Prefetch::m_stats [private] |
cache statistics, used in IO detach
Referenced by GetStats().
bool XrdFileCache::Prefetch::m_stopped [private] |
prefetch is stopped
bool XrdFileCache::Prefetch::m_stopping [private] |
run thread should be stopped
XrdJob* XrdFileCache::Prefetch::m_syncer [private] |
mutex locking fsync status
std::deque<Task*> XrdFileCache::Prefetch::m_tasks_queue [private] |
download queue
std::string XrdFileCache::Prefetch::m_temp_filename [private] |
filename of data file on disk
std::vector<int> XrdFileCache::Prefetch::m_writes_during_sync [private] |