XrdFileCache::Prefetch Class Reference

Downloads data into a file on local disk and handles IO read requests. More...

#include <XrdFileCachePrefetch.hh>

Collaboration diagram for XrdFileCache::Prefetch:
Collaboration graph
[legend]

List of all members.

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.
StatsGetStats ()
 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.
TaskGetNextTask ()
 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.
TaskCreateTaskForFirstUndownloadedBlock ()
 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
XrdOssDFm_output
 file handle for data file on disk
XrdOssDFm_infoFile
 file handle for data-info file on disk
Info m_cfi
 download status of file blocks and access statistics
XrdOucCacheIOm_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
XrdJobm_syncer
std::vector< int > m_writes_during_sync
int m_non_flushed_cnt
bool m_in_sync

Friends

class IOEntireFile
class IOFileBlock

Detailed Description

Downloads data into a file on local disk and handles IO read requests.


Member Enumeration Documentation

Enumerator:
kReadWait 
kReadSuccess 
kReadFailed 

Constructor & Destructor Documentation

XrdFileCache::Prefetch::Prefetch ( XrdOucCacheIO inputFile,
std::string &  path,
long long  offset,
long long  fileSize 
)

Constructor.

XrdFileCache::Prefetch::~Prefetch (  ) 

Destructor.


Member Function Documentation

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.

Task* XrdFileCache::Prefetch::CreateTaskForFirstUndownloadedBlock (  )  [private]

Prefetch block.

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.


Friends And Related Function Documentation

friend class IOEntireFile [friend]
friend class IOFileBlock [friend]

Member Data Documentation

download status of file blocks and access statistics

mutex locking access to m_cfi object

reading from original source or writing to disk has failed

size of disk file for block-based operation

file handle for data-info file on disk

original data source

long long XrdFileCache::Prefetch::m_offset [private]

offset of disk file for block-based operation

file handle for data file on disk

m_tasks_queue condition variable

in memory cache

state of run thread

state condition variable

cache statistics, used in IO detach

Referenced by GetStats().

prefetch is stopped

run thread should be stopped

mutex locking fsync status

download queue

filename of data file on disk


The documentation for this class was generated from the following file:

Generated on 3 Oct 2016 for xrootd by  doxygen 1.6.1