xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
XrdFileCache::Info Class Reference

Status of cached file. Can be read from and written into a binary file. More...

#include <XrdFileCacheInfo.hh>

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

Classes

struct  AStat
 
struct  Store
 

Public Member Functions

 Info (XrdSysTrace *trace, bool prefetchBuffer=false)
 Constructor. More...
 
 ~Info ()
 Destructor. More...
 
void SetBitWritten (int i)
 Mark block as downloaded. More...
 
void SetBitSynced (int i)
 Mark block as disk written. More...
 
void SetAllBitsSynced ()
 Mark all blocks as writte. More...
 
void SetBitPrefetch (int i)
 Mark block as written from prefetchxs. More...
 
void SetBufferSize (long long)
 
void SetFileSize (long long)
 
void ResizeBits (int n)
 Reserve buffer for fileSize/bufferSize bytes. More...
 
bool Read (XrdOssDF *fp, const std::string &fname="<unknown>")
 Rea load content from cinfo file into this object. More...
 
bool Write (XrdOssDF *fp, const std::string &fname="<unknown>")
 
void DisableDownloadStatus ()
 Disable allocating, writing, and reading of downlaod status. More...
 
void WriteIOStatAttach ()
 Write open time in the last entry of access statistics. More...
 
void WriteIOStat (Stats &s)
 Write bytes missed, hits, and disk. More...
 
void WriteIOStatDetach (Stats &s)
 Write close time together with bytes missed, hits, and disk. More...
 
void WriteIOStatSingle (long long bytes_disk)
 Write single open/close time for given bytes read from disk. More...
 
void WriteIOStatSingle (long long bytes_disk, time_t att, time_t dtc)
 Write open/close with given time and bytes read from disk. More...
 
bool IsAnythingEmptyInRng (int firstIdx, int lastIdx) const
 Check download status in given block range. More...
 
int GetSizeInBytes () const
 Get size of download-state bit-vector in bytes. More...
 
int GetSizeInBits () const
 Get number of blocks represented in download-state bit-vector. More...
 
long long GetFileSize () const
 Get file size. More...
 
bool GetLatestDetachTime (time_t &t) const
 Get latest detach time. More...
 
long long GetBufferSize () const
 Get prefetch buffer size. More...
 
bool TestBit (int i) const
 Test if block at the given index is downlaoded. More...
 
bool TestPrefetchBit (int i) const
 Test if block at the given index is prewritten. More...
 
bool IsComplete () const
 Get complete status. More...
 
int GetNDownloadedBlocks () const
 Get number of downloaded blocks. More...
 
long long GetNDownloadedBytes () const
 Get number of downloaded bytes. More...
 
void UpdateDownloadCompleteStatus ()
 Update complete status. More...
 
size_t GetAccessCnt ()
 Get number of accesses. More...
 
int GetVersion ()
 Get version. More...
 
const StoreRefStoredData () const
 Get stored data. More...
 
void GetCksum (unsigned char *buff, char *digest)
 Get md5 cksum. More...
 
XrdSysTraceGetTrace () const
 

Static Public Member Functions

static size_t GetMaxNumAccess ()
 

Static Public Attributes

static const char * m_infoExtension
 
static const char * m_traceID
 
static const int m_defaultVersion
 
static const size_t m_maxNumAccess
 

Protected Attributes

XrdSysTracem_trace
 
Store m_store
 
bool m_hasPrefetchBuffer
 constains current prefetch score More...
 
unsigned char * m_buff_written
 download state vector More...
 
unsigned char * m_buff_prefetch
 prefetch statistics More...
 
int m_sizeInBits
 cached More...
 
bool m_complete
 cached More...
 

Private Member Functions

unsigned char cfiBIT (int n) const
 
bool ReadV1 (XrdOssDF *fp, const std::string &fname)
 

Private Attributes

XrdCksCalcm_cksCalc
 

Detailed Description

Status of cached file. Can be read from and written into a binary file.

Constructor & Destructor Documentation

XrdFileCache::Info::Info ( XrdSysTrace trace,
bool  prefetchBuffer = false 
)

Constructor.

XrdFileCache::Info::~Info ( )

Destructor.

Member Function Documentation

unsigned char XrdFileCache::Info::cfiBIT ( int  n) const
inlineprivate
void XrdFileCache::Info::DisableDownloadStatus ( )

Disable allocating, writing, and reading of downlaod status.

size_t XrdFileCache::Info::GetAccessCnt ( )
inline

Get number of accesses.

References XrdFileCache::Info::Store::m_accessCnt, and m_store.

long long XrdFileCache::Info::GetBufferSize ( ) const
inline

Get prefetch buffer size.

References XrdFileCache::Info::Store::m_bufferSize, and m_store.

void XrdFileCache::Info::GetCksum ( unsigned char *  buff,
char *  digest 
)

Get md5 cksum.

long long XrdFileCache::Info::GetFileSize ( ) const
inline

Get file size.

References XrdFileCache::Info::Store::m_fileSize, and m_store.

bool XrdFileCache::Info::GetLatestDetachTime ( time_t &  t) const

Get latest detach time.

static size_t XrdFileCache::Info::GetMaxNumAccess ( )
inlinestatic

References m_maxNumAccess.

int XrdFileCache::Info::GetNDownloadedBlocks ( ) const
inline

Get number of downloaded blocks.

References m_sizeInBits, and TestBit().

Referenced by GetNDownloadedBytes().

long long XrdFileCache::Info::GetNDownloadedBytes ( ) const
inline

Get number of downloaded bytes.

References GetNDownloadedBlocks(), XrdFileCache::Info::Store::m_bufferSize, and m_store.

int XrdFileCache::Info::GetSizeInBits ( ) const
inline

Get number of blocks represented in download-state bit-vector.

References m_sizeInBits.

int XrdFileCache::Info::GetSizeInBytes ( ) const
inline

Get size of download-state bit-vector in bytes.

References m_sizeInBits.

Referenced by SetBitPrefetch(), SetBitSynced(), SetBitWritten(), TestBit(), and TestPrefetchBit().

XrdSysTrace* XrdFileCache::Info::GetTrace ( ) const
inline

References m_trace.

int XrdFileCache::Info::GetVersion ( )
inline

Get version.

References m_store, and XrdFileCache::Info::Store::m_version.

bool XrdFileCache::Info::IsAnythingEmptyInRng ( int  firstIdx,
int  lastIdx 
) const
inline

Check download status in given block range.

References TestBit().

Referenced by UpdateDownloadCompleteStatus().

bool XrdFileCache::Info::IsComplete ( ) const
inline

Get complete status.

References m_complete.

bool XrdFileCache::Info::Read ( XrdOssDF fp,
const std::string &  fname = "<unknown>" 
)

Rea load content from cinfo file into this object.

Parameters
fpfile handle
fnameoptional file name for trace output
Returns
true on success
bool XrdFileCache::Info::ReadV1 ( XrdOssDF fp,
const std::string &  fname 
)
private
const Store& XrdFileCache::Info::RefStoredData ( ) const
inline

Get stored data.

References m_store.

void XrdFileCache::Info::ResizeBits ( int  n)

Reserve buffer for fileSize/bufferSize bytes.

Parameters
nnumber of file blocks
void XrdFileCache::Info::SetAllBitsSynced ( )

Mark all blocks as writte.

void XrdFileCache::Info::SetBitPrefetch ( int  i)
inline

Mark block as written from prefetchxs.

Parameters
iblock index

References cfiBIT(), GetSizeInBytes(), and m_buff_prefetch.

void XrdFileCache::Info::SetBitSynced ( int  i)
inline

Mark block as disk written.

Parameters
iblock index

References cfiBIT(), GetSizeInBytes(), XrdFileCache::Info::Store::m_buff_synced, and m_store.

void XrdFileCache::Info::SetBitWritten ( int  i)
inline

Mark block as downloaded.

Parameters
iblock index

References cfiBIT(), GetSizeInBytes(), and m_buff_written.

void XrdFileCache::Info::SetBufferSize ( long  long)
void XrdFileCache::Info::SetFileSize ( long  long)
bool XrdFileCache::Info::TestBit ( int  i) const
inline

Test if block at the given index is downlaoded.

References cfiBIT(), GetSizeInBytes(), and m_buff_written.

Referenced by GetNDownloadedBlocks(), and IsAnythingEmptyInRng().

bool XrdFileCache::Info::TestPrefetchBit ( int  i) const
inline

Test if block at the given index is prewritten.

References cfiBIT(), GetSizeInBytes(), and m_buff_prefetch.

void XrdFileCache::Info::UpdateDownloadCompleteStatus ( )
inline

Update complete status.

References IsAnythingEmptyInRng(), m_complete, and m_sizeInBits.

bool XrdFileCache::Info::Write ( XrdOssDF fp,
const std::string &  fname = "<unknown>" 
)

Write number of blocks and read buffer size

Returns
true on success
void XrdFileCache::Info::WriteIOStat ( Stats s)

Write bytes missed, hits, and disk.

void XrdFileCache::Info::WriteIOStatAttach ( )

Write open time in the last entry of access statistics.

void XrdFileCache::Info::WriteIOStatDetach ( Stats s)

Write close time together with bytes missed, hits, and disk.

void XrdFileCache::Info::WriteIOStatSingle ( long long  bytes_disk)

Write single open/close time for given bytes read from disk.

void XrdFileCache::Info::WriteIOStatSingle ( long long  bytes_disk,
time_t  att,
time_t  dtc 
)

Write open/close with given time and bytes read from disk.

Member Data Documentation

unsigned char* XrdFileCache::Info::m_buff_prefetch
protected

prefetch statistics

Referenced by SetBitPrefetch(), and TestPrefetchBit().

unsigned char* XrdFileCache::Info::m_buff_written
protected

download state vector

Referenced by SetBitWritten(), and TestBit().

XrdCksCalc* XrdFileCache::Info::m_cksCalc
private
bool XrdFileCache::Info::m_complete
protected

cached

Referenced by IsComplete(), and UpdateDownloadCompleteStatus().

const int XrdFileCache::Info::m_defaultVersion
static
bool XrdFileCache::Info::m_hasPrefetchBuffer
protected

constains current prefetch score

const char* XrdFileCache::Info::m_infoExtension
static
const size_t XrdFileCache::Info::m_maxNumAccess
static

Referenced by GetMaxNumAccess().

int XrdFileCache::Info::m_sizeInBits
protected
Store XrdFileCache::Info::m_store
protected
XrdSysTrace* XrdFileCache::Info::m_trace
protected

Referenced by GetTrace().

const char* XrdFileCache::Info::m_traceID
static

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