xrootd
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
XrdFileCache::File Class Reference

#include <XrdFileCacheFile.hh>

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

Classes

struct  IODetails
 

Public Member Functions

 File (const std::string &path, long long offset, long long fileSize)
 Constructor. More...
 
 ~File ()
 Destructor. More...
 
void BlockRemovedFromWriteQ (Block *)
 Handle removal of a block from Cache's write queue. More...
 
bool Open ()
 Open file handle for data file and info file on local disk. More...
 
int ReadV (IO *io, const XrdOucIOVec *readV, int n)
 Vector read from disk if block is already downloaded, else ReadV from client. More...
 
int Read (IO *io, char *buff, long long offset, int size)
 Normal read. More...
 
bool isOpen () const
 Data and cinfo files are open. More...
 
bool ioActive (IO *io)
 Initiate close. Return true if still IO active. Used in XrdPosixXrootd::Close() More...
 
void RequestSyncOfDetachStats ()
 Flags that detach stats should be written out in final sync. Called from CacheIO upon Detach. More...
 
bool FinalizeSyncBeforeExit ()
 Returns true if any of blocks need sync. Called from Cache::dec_ref_cnt on zero ref cnt. More...
 
void Sync ()
 Sync file cache inf o and output data with disk. More...
 
StatsGetStats ()
 Reference to prefetch statistics. More...
 
void ProcessBlockResponse (BlockResponseHandler *brh, int res)
 
void WriteBlockToDisk (Block *b)
 
void Prefetch ()
 
float GetPrefetchScore () const
 
const char * lPath () const
 Log path. More...
 
std::string & GetLocalPath ()
 
XrdSysErrorGetLog ()
 
XrdSysTraceGetTrace ()
 
long long GetFileSize ()
 
void AddIO (IO *io)
 
int GetPrefetchCountOnIO (IO *io)
 
void StopPrefetchingOnIO (IO *io)
 
void RemoveIO (IO *io)
 
int get_ref_cnt ()
 
int inc_ref_cnt ()
 
int dec_ref_cnt ()
 

Static Public Member Functions

static FileFileOpen (const std::string &path, long long offset, long long fileSize)
 Static constructor that also does Open. Returns null ptr if Open fails. More...
 

Private Types

enum  PrefetchState_e {
  kOff =-1, kOn, kHold, kStopped,
  kComplete
}
 
typedef std::map< IO *, IODetailsIoMap_t
 
typedef IoMap_t::iterator IoMap_i
 
typedef std::list< int > IntList_t
 
typedef IntList_t::iterator IntList_i
 
typedef std::list< Block * > BlockList_t
 
typedef BlockList_t::iterator BlockList_i
 
typedef std::map< int, Block * > BlockMap_t
 
typedef BlockMap_t::iterator BlockMap_i
 

Private Member Functions

bool overlap (int blk, long long blk_size, long long req_off, int req_size, long long &off, long long &blk_off, long long &size)
 
BlockPrepareBlockRequest (int i, IO *io, bool prefetch)
 
void ProcessBlockRequest (Block *b, bool prefetch)
 
void ProcessBlockRequests (BlockList_t &blks, bool prefetch)
 
int RequestBlocksDirect (IO *io, DirectResponseHandler *handler, IntList_t &blocks, char *buff, long long req_off, long long req_size)
 
int ReadBlocksFromDisk (IntList_t &blocks, char *req_buf, long long req_off, long long req_size)
 
bool VReadValidate (const XrdOucIOVec *readV, int n)
 
bool VReadPreProcess (IO *io, const XrdOucIOVec *readV, int n, ReadVBlockListRAM &blks_to_process, ReadVBlockListDisk &blks_on_disk, std::vector< XrdOucIOVec > &chunkVec)
 
int VReadFromDisk (const XrdOucIOVec *readV, int n, ReadVBlockListDisk &blks_on_disk)
 
int VReadProcessBlocks (IO *io, const XrdOucIOVec *readV, int n, std::vector< ReadVChunkListRAM > &blks_to_process, std::vector< ReadVChunkListRAM > &blks_rocessed)
 
long long BufferSize ()
 
void inc_ref_count (Block *)
 
void dec_ref_count (Block *)
 
void free_block (Block *)
 
bool select_current_io_or_disable_prefetching (bool skip_current)
 
int offsetIdx (int idx)
 

Private Attributes

int m_ref_cnt
 number of references from IO or sync More...
 
bool m_is_open
 open state More...
 
XrdOssDFm_output
 file handle for data file on disk More...
 
XrdOssDFm_infoFile
 file handle for data-info file on disk More...
 
Info m_cfi
 download status of file blocks and access statistics More...
 
std::string m_filename
 filename of data file on disk More...
 
long long m_offset
 offset of cached file for block-based / hdfs operation More...
 
long long m_fileSize
 size of cached disk file for block-based operation More...
 
IoMap_t m_io_map
 
IoMap_i m_current_io
 IO object to be used for prefetching. More...
 
int m_ios_in_detach
 Number of IO objects to which we replied false to ioActive() and will be removed soon. More...
 
std::vector< int > m_writes_during_sync
 
int m_non_flushed_cnt
 
bool m_in_sync
 
BlockMap_t m_block_map
 
XrdSysCondVar m_downloadCond
 
Stats m_stats
 cache statistics, used in IO detach More...
 
PrefetchState_e m_prefetchState
 
int m_prefetchReadCnt
 
int m_prefetchHitCnt
 
float m_prefetchScore
 
bool m_detachTimeIsLogged
 

Static Private Attributes

static const char * m_traceID
 

Member Typedef Documentation

◆ BlockList_i

typedef BlockList_t::iterator XrdFileCache::File::BlockList_i
private

◆ BlockList_t

typedef std::list<Block*> XrdFileCache::File::BlockList_t
private

◆ BlockMap_i

typedef BlockMap_t::iterator XrdFileCache::File::BlockMap_i
private

◆ BlockMap_t

typedef std::map<int, Block*> XrdFileCache::File::BlockMap_t
private

◆ IntList_i

typedef IntList_t::iterator XrdFileCache::File::IntList_i
private

◆ IntList_t

typedef std::list<int> XrdFileCache::File::IntList_t
private

◆ IoMap_i

typedef IoMap_t::iterator XrdFileCache::File::IoMap_i
private

◆ IoMap_t

typedef std::map<IO*, IODetails> XrdFileCache::File::IoMap_t
private

Member Enumeration Documentation

◆ PrefetchState_e

Enumerator
kOff 
kOn 
kHold 
kStopped 
kComplete 

Constructor & Destructor Documentation

◆ File()

XrdFileCache::File::File ( const std::string &  path,
long long  offset,
long long  fileSize 
)

Constructor.

◆ ~File()

XrdFileCache::File::~File ( )

Destructor.

Member Function Documentation

◆ AddIO()

void XrdFileCache::File::AddIO ( IO io)

◆ BlockRemovedFromWriteQ()

void XrdFileCache::File::BlockRemovedFromWriteQ ( Block )

Handle removal of a block from Cache's write queue.

◆ BufferSize()

long long XrdFileCache::File::BufferSize ( )
private

◆ dec_ref_cnt()

int XrdFileCache::File::dec_ref_cnt ( )
inline

References m_ref_cnt.

◆ dec_ref_count()

void XrdFileCache::File::dec_ref_count ( Block )
private

◆ FileOpen()

static File* XrdFileCache::File::FileOpen ( const std::string &  path,
long long  offset,
long long  fileSize 
)
static

Static constructor that also does Open. Returns null ptr if Open fails.

◆ FinalizeSyncBeforeExit()

bool XrdFileCache::File::FinalizeSyncBeforeExit ( )

Returns true if any of blocks need sync. Called from Cache::dec_ref_cnt on zero ref cnt.

◆ free_block()

void XrdFileCache::File::free_block ( Block )
private

◆ get_ref_cnt()

int XrdFileCache::File::get_ref_cnt ( )
inline

References m_ref_cnt.

◆ GetFileSize()

long long XrdFileCache::File::GetFileSize ( )
inline

References m_fileSize.

◆ GetLocalPath()

std::string& XrdFileCache::File::GetLocalPath ( )
inline

References m_filename.

◆ GetLog()

XrdSysError* XrdFileCache::File::GetLog ( )

◆ GetPrefetchCountOnIO()

int XrdFileCache::File::GetPrefetchCountOnIO ( IO io)

◆ GetPrefetchScore()

float XrdFileCache::File::GetPrefetchScore ( ) const

◆ GetStats()

Stats& XrdFileCache::File::GetStats ( )
inline

Reference to prefetch statistics.

References m_stats.

◆ GetTrace()

XrdSysTrace* XrdFileCache::File::GetTrace ( )

◆ inc_ref_cnt()

int XrdFileCache::File::inc_ref_cnt ( )
inline

References m_ref_cnt.

◆ inc_ref_count()

void XrdFileCache::File::inc_ref_count ( Block )
private

◆ ioActive()

bool XrdFileCache::File::ioActive ( IO io)

Initiate close. Return true if still IO active. Used in XrdPosixXrootd::Close()

◆ isOpen()

bool XrdFileCache::File::isOpen ( ) const
inline

Data and cinfo files are open.

References m_is_open.

◆ lPath()

const char* XrdFileCache::File::lPath ( ) const

Log path.

◆ offsetIdx()

int XrdFileCache::File::offsetIdx ( int  idx)
private

◆ Open()

bool XrdFileCache::File::Open ( )

Open file handle for data file and info file on local disk.

◆ overlap()

bool XrdFileCache::File::overlap ( int  blk,
long long  blk_size,
long long  req_off,
int  req_size,
long long &  off,
long long &  blk_off,
long long &  size 
)
private

◆ Prefetch()

void XrdFileCache::File::Prefetch ( )

◆ PrepareBlockRequest()

Block* XrdFileCache::File::PrepareBlockRequest ( int  i,
IO io,
bool  prefetch 
)
private

◆ ProcessBlockRequest()

void XrdFileCache::File::ProcessBlockRequest ( Block b,
bool  prefetch 
)
private

◆ ProcessBlockRequests()

void XrdFileCache::File::ProcessBlockRequests ( BlockList_t blks,
bool  prefetch 
)
private

◆ ProcessBlockResponse()

void XrdFileCache::File::ProcessBlockResponse ( BlockResponseHandler brh,
int  res 
)

◆ Read()

int XrdFileCache::File::Read ( IO io,
char *  buff,
long long  offset,
int  size 
)

Normal read.

◆ ReadBlocksFromDisk()

int XrdFileCache::File::ReadBlocksFromDisk ( IntList_t blocks,
char *  req_buf,
long long  req_off,
long long  req_size 
)
private

◆ ReadV()

int XrdFileCache::File::ReadV ( IO io,
const XrdOucIOVec readV,
int  n 
)

Vector read from disk if block is already downloaded, else ReadV from client.

◆ RemoveIO()

void XrdFileCache::File::RemoveIO ( IO io)

◆ RequestBlocksDirect()

int XrdFileCache::File::RequestBlocksDirect ( IO io,
DirectResponseHandler handler,
IntList_t blocks,
char *  buff,
long long  req_off,
long long  req_size 
)
private

◆ RequestSyncOfDetachStats()

void XrdFileCache::File::RequestSyncOfDetachStats ( )

Flags that detach stats should be written out in final sync. Called from CacheIO upon Detach.

◆ select_current_io_or_disable_prefetching()

bool XrdFileCache::File::select_current_io_or_disable_prefetching ( bool  skip_current)
private

◆ StopPrefetchingOnIO()

void XrdFileCache::File::StopPrefetchingOnIO ( IO io)

◆ Sync()

void XrdFileCache::File::Sync ( )

Sync file cache inf o and output data with disk.

◆ VReadFromDisk()

int XrdFileCache::File::VReadFromDisk ( const XrdOucIOVec readV,
int  n,
ReadVBlockListDisk &  blks_on_disk 
)
private

◆ VReadPreProcess()

bool XrdFileCache::File::VReadPreProcess ( IO io,
const XrdOucIOVec readV,
int  n,
ReadVBlockListRAM &  blks_to_process,
ReadVBlockListDisk &  blks_on_disk,
std::vector< XrdOucIOVec > &  chunkVec 
)
private

◆ VReadProcessBlocks()

int XrdFileCache::File::VReadProcessBlocks ( IO io,
const XrdOucIOVec readV,
int  n,
std::vector< ReadVChunkListRAM > &  blks_to_process,
std::vector< ReadVChunkListRAM > &  blks_rocessed 
)
private

◆ VReadValidate()

bool XrdFileCache::File::VReadValidate ( const XrdOucIOVec readV,
int  n 
)
private

◆ WriteBlockToDisk()

void XrdFileCache::File::WriteBlockToDisk ( Block b)

Member Data Documentation

◆ m_block_map

BlockMap_t XrdFileCache::File::m_block_map
private

◆ m_cfi

Info XrdFileCache::File::m_cfi
private

download status of file blocks and access statistics

◆ m_current_io

IoMap_i XrdFileCache::File::m_current_io
private

IO object to be used for prefetching.

◆ m_detachTimeIsLogged

bool XrdFileCache::File::m_detachTimeIsLogged
private

◆ m_downloadCond

XrdSysCondVar XrdFileCache::File::m_downloadCond
private

◆ m_filename

std::string XrdFileCache::File::m_filename
private

filename of data file on disk

Referenced by GetLocalPath().

◆ m_fileSize

long long XrdFileCache::File::m_fileSize
private

size of cached disk file for block-based operation

Referenced by GetFileSize().

◆ m_in_sync

bool XrdFileCache::File::m_in_sync
private

◆ m_infoFile

XrdOssDF* XrdFileCache::File::m_infoFile
private

file handle for data-info file on disk

◆ m_io_map

IoMap_t XrdFileCache::File::m_io_map
private

◆ m_ios_in_detach

int XrdFileCache::File::m_ios_in_detach
private

Number of IO objects to which we replied false to ioActive() and will be removed soon.

◆ m_is_open

bool XrdFileCache::File::m_is_open
private

open state

Referenced by isOpen().

◆ m_non_flushed_cnt

int XrdFileCache::File::m_non_flushed_cnt
private

◆ m_offset

long long XrdFileCache::File::m_offset
private

offset of cached file for block-based / hdfs operation

◆ m_output

XrdOssDF* XrdFileCache::File::m_output
private

file handle for data file on disk

◆ m_prefetchHitCnt

int XrdFileCache::File::m_prefetchHitCnt
private

◆ m_prefetchReadCnt

int XrdFileCache::File::m_prefetchReadCnt
private

◆ m_prefetchScore

float XrdFileCache::File::m_prefetchScore
private

◆ m_prefetchState

PrefetchState_e XrdFileCache::File::m_prefetchState
private

◆ m_ref_cnt

int XrdFileCache::File::m_ref_cnt
private

number of references from IO or sync

Referenced by dec_ref_cnt(), get_ref_cnt(), and inc_ref_cnt().

◆ m_stats

Stats XrdFileCache::File::m_stats
private

cache statistics, used in IO detach

Referenced by GetStats().

◆ m_traceID

const char* XrdFileCache::File::m_traceID
staticprivate

◆ m_writes_during_sync

std::vector<int> XrdFileCache::File::m_writes_during_sync
private

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