XrdPfc::File Class Reference

#include <XrdPfcFile.hh>

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

List of all members.

Classes

struct  IODetails

Public Member Functions

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

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.

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
typedef std::set< Block * > BlockSet_t
typedef BlockSet_t::iterator BlockSet_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)
void VReadPreProcess (IO *io, const XrdOucIOVec *readV, int n, BlockList_t &blks_to_request, 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_processed, long long &bytes_hit, long long &bytes_missed)
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
bool m_is_open
 open state (presumably not needed anymore)
bool m_in_shutdown
 file is in emergency shutdown due to irrecoverable error or unlink request
XrdOssDFm_data_file
 file handle for data file on disk
XrdOssDFm_info_file
 file handle for data-info file on disk
Info m_cfi
 download status of file blocks and access statistics
std::string m_filename
 filename of data file on disk
long long m_offset
 offset of cached file for block-based / hdfs operation
long long m_file_size
 size of cached disk file for block-based operation
IoMap_t m_io_map
IoMap_i m_current_io
 IO object to be used for prefetching.
int m_ios_in_detach
 Number of IO objects to which we replied false to ioActive() and will be removed soon.
std::vector< int > m_writes_during_sync
int m_non_flushed_cnt
bool m_in_sync
BlockMap_t m_block_map
XrdSysCondVar m_state_cond
Stats m_stats
 cache statistics for this instance
Stats m_last_stats
 copy of cache stats during last purge cycle, used for per directory stat reporting
PrefetchState_e m_prefetch_state
int m_prefetch_read_cnt
int m_prefetch_hit_cnt
float m_prefetch_score
bool m_detach_time_logged

Static Private Attributes

static const char * m_traceID

Member Typedef Documentation

typedef BlockList_t::iterator XrdPfc::File::BlockList_i [private]
typedef std::list<Block*> XrdPfc::File::BlockList_t [private]
typedef BlockMap_t::iterator XrdPfc::File::BlockMap_i [private]
typedef std::map<int, Block*> XrdPfc::File::BlockMap_t [private]
typedef BlockSet_t::iterator XrdPfc::File::BlockSet_i [private]
typedef std::set<Block*> XrdPfc::File::BlockSet_t [private]
typedef IntList_t::iterator XrdPfc::File::IntList_i [private]
typedef std::list<int> XrdPfc::File::IntList_t [private]
typedef IoMap_t::iterator XrdPfc::File::IoMap_i [private]
typedef std::map<IO*, IODetails> XrdPfc::File::IoMap_t [private]

Member Enumeration Documentation

Enumerator:
kOff 
kOn 
kHold 
kStopped 
kComplete 

Constructor & Destructor Documentation

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

Constructor.

XrdPfc::File::~File (  ) 

Destructor.


Member Function Documentation

void XrdPfc::File::AddIO ( IO io  ) 
void XrdPfc::File::BlockRemovedFromWriteQ ( Block  ) 

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

void XrdPfc::File::BlocksRemovedFromWriteQ ( std::list< Block * > &   ) 

Handle removal of a set of blocks from Cache's write queue.

long long XrdPfc::File::BufferSize (  )  [private]
int XrdPfc::File::dec_ref_cnt (  )  [inline]

References m_ref_cnt.

void XrdPfc::File::dec_ref_count ( Block  )  [private]
Stats XrdPfc::File::DeltaStatsFromLastCall (  ) 
static File* XrdPfc::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.

bool XrdPfc::File::FinalizeSyncBeforeExit (  ) 

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

void XrdPfc::File::free_block ( Block  )  [private]
int XrdPfc::File::get_ref_cnt (  )  [inline]

References m_ref_cnt.

size_t XrdPfc::File::GetAccessCnt (  )  const [inline]
int XrdPfc::File::GetBlockSize (  )  const [inline]
long long XrdPfc::File::GetFileSize (  )  [inline]

References m_file_size.

const Info::AStat* XrdPfc::File::GetLastAccessStats (  )  const [inline]
std::string& XrdPfc::File::GetLocalPath (  )  [inline]

References m_filename.

XrdSysError* XrdPfc::File::GetLog (  ) 
int XrdPfc::File::GetNBlocks (  )  const [inline]
int XrdPfc::File::GetNDownloadedBlocks (  )  const [inline]
int XrdPfc::File::GetPrefetchCountOnIO ( IO io  ) 
float XrdPfc::File::GetPrefetchScore (  )  const
XrdSysTrace* XrdPfc::File::GetTrace (  ) 
int XrdPfc::File::inc_ref_cnt (  )  [inline]

References m_ref_cnt.

void XrdPfc::File::inc_ref_count ( Block  )  [private]
void XrdPfc::File::initiate_emergency_shutdown (  ) 
bool XrdPfc::File::ioActive ( IO io  ) 

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

bool XrdPfc::File::is_in_emergency_shutdown (  )  [inline]

References m_in_shutdown.

bool XrdPfc::File::isOpen (  )  const [inline]

Data and cinfo files are open.

References m_is_open.

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

Log path.

int XrdPfc::File::offsetIdx ( int  idx  )  [private]
bool XrdPfc::File::Open (  ) 

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

bool XrdPfc::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]
void XrdPfc::File::Prefetch (  ) 
Block* XrdPfc::File::PrepareBlockRequest ( int  i,
IO io,
bool  prefetch 
) [private]
void XrdPfc::File::ProcessBlockRequest ( Block b,
bool  prefetch 
) [private]
void XrdPfc::File::ProcessBlockRequests ( BlockList_t blks,
bool  prefetch 
) [private]
void XrdPfc::File::ProcessBlockResponse ( BlockResponseHandler brh,
int  res 
)
int XrdPfc::File::Read ( IO io,
char *  buff,
long long  offset,
int  size 
)

Normal read.

int XrdPfc::File::ReadBlocksFromDisk ( IntList_t blocks,
char *  req_buf,
long long  req_off,
long long  req_size 
) [private]
int XrdPfc::File::ReadV ( IO io,
const XrdOucIOVec readV,
int  n 
)

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

void XrdPfc::File::RemoveIO ( IO io  ) 
int XrdPfc::File::RequestBlocksDirect ( IO io,
DirectResponseHandler handler,
IntList_t blocks,
char *  buff,
long long  req_off,
long long  req_size 
) [private]
void XrdPfc::File::RequestSyncOfDetachStats (  ) 

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

bool XrdPfc::File::select_current_io_or_disable_prefetching ( bool  skip_current  )  [private]
void XrdPfc::File::StopPrefetchingOnIO ( IO io  ) 
void XrdPfc::File::Sync (  ) 

Sync file cache inf o and output data with disk.

int XrdPfc::File::VReadFromDisk ( const XrdOucIOVec readV,
int  n,
ReadVBlockListDisk &  blks_on_disk 
) [private]
void XrdPfc::File::VReadPreProcess ( IO io,
const XrdOucIOVec readV,
int  n,
BlockList_t blks_to_request,
ReadVBlockListRAM &  blks_to_process,
ReadVBlockListDisk &  blks_on_disk,
std::vector< XrdOucIOVec > &  chunkVec 
) [private]
int XrdPfc::File::VReadProcessBlocks ( IO io,
const XrdOucIOVec readV,
int  n,
std::vector< ReadVChunkListRAM > &  blks_to_process,
std::vector< ReadVChunkListRAM > &  blks_processed,
long long &  bytes_hit,
long long &  bytes_missed 
) [private]
bool XrdPfc::File::VReadValidate ( const XrdOucIOVec readV,
int  n 
) [private]
void XrdPfc::File::WriteBlockToDisk ( Block b  ) 

Member Data Documentation

download status of file blocks and access statistics

Referenced by GetAccessCnt(), GetBlockSize(), GetLastAccessStats(), GetNBlocks(), and GetNDownloadedBlocks().

IO object to be used for prefetching.

file handle for data file on disk

long long XrdPfc::File::m_file_size [private]

size of cached disk file for block-based operation

Referenced by GetFileSize().

std::string XrdPfc::File::m_filename [private]

filename of data file on disk

Referenced by GetLocalPath().

file is in emergency shutdown due to irrecoverable error or unlink request

Referenced by is_in_emergency_shutdown().

bool XrdPfc::File::m_in_sync [private]

file handle for data-info file on disk

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

bool XrdPfc::File::m_is_open [private]

open state (presumably not needed anymore)

Referenced by isOpen().

copy of cache stats during last purge cycle, used for per directory stat reporting

long long XrdPfc::File::m_offset [private]

offset of cached file for block-based / hdfs operation

int XrdPfc::File::m_ref_cnt [private]

number of references from IO or sync

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

cache statistics for this instance

const char* XrdPfc::File::m_traceID [static, private]
std::vector<int> XrdPfc::File::m_writes_during_sync [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 7 Jul 2020 for xrootd by  doxygen 1.6.1