Loading...
Searching...
No Matches
XrdPfc::IO Class Referenceabstract

Base cache-io class that implements some XrdOucCacheIO abstract methods. More...

`#include <XrdPfcIO.hh>`

Inheritance diagram for XrdPfc::IO:
Collaboration diagram for XrdPfc::IO:

## Classes

struct | ReadReqRHCond

## Public Member Functions

| IO (XrdOucCacheIO *io, Cache &cache)
virtual XrdOucCacheIO * | Base ()
| Original data source.
bool | Detach (XrdOucCacheIOCD &iocdP) final
virtual void | DetachFinalize ()=0
XrdOucCacheIO * | GetInput ()
const char * | GetLocation ()
XrdSysTrace * | GetTrace ()
virtual bool | ioActive ()=0
const char * | Path () override
| Original data source URL.
int | Sync () override
virtual void | Sync (XrdOucCacheIOCB &iocb)
int | Trunc (long long Offset) override
virtual void | Trunc (XrdOucCacheIOCB &iocb, long long offs)
void | Update (XrdOucCacheIO &iocp) override
int | Write (char *Buffer, long long Offset, int Length) override
virtual void | Write (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
Public Member Functions inherited from XrdOucCacheIO
| XrdOucCacheIO ()
| Construct and Destructor.
virtual long long | FSize ()=0
virtual int | Fstat (struct stat &sbuff)
virtual const char * | Location (bool refresh=false)
virtual int | pgRead (char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
virtual void | pgRead (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
virtual int | pgWrite (char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
virtual void | pgWrite (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
virtual void | Preread (aprParms &Parms)
virtual void | Preread (long long offs, int rlen, int opts=0)
virtual int | Read (char *buff, long long offs, int rlen)=0
virtual void | Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
virtual int | ReadV (const XrdOucIOVec *readV, int rnum)
virtual void | ReadV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
virtual int | WriteV (const XrdOucIOVec *writV, int wnum)
virtual void | WriteV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *writV, int wnum)

## Protected Member Functions

std::string | GetFilename ()
const char * | GetPath ()
unsigned short | ObtainReadSid ()
const char * | RefreshLocation ()
bool | register_block_error (int res)
bool | register_incomplete_read ()
Protected Member Functions inherited from XrdOucCacheIO
virtual | ~XrdOucCacheIO ()

## Protected Attributes

RAtomic_int | m_active_read_reqs
| number of active read requests
Cache & | m_cache
| reference to Cache object
std::map< int, int > | m_error_counts
int | m_incomplete_count {0}
const char * | m_traceID

## Friends

class | File

## Additional Inherited Members

Static Public Attributes inherited from XrdOucCacheIO
static const uint64_t | forceCS = 0x0000000000000001ULL
static const int | SingleUse = 0x0001
| Mark pages for single use.

## Detailed Description

Base cache-io class that implements some XrdOucCacheIO abstract methods.

Definition at line 15 of file XrdPfcIO.hh.

## Constructor & Destructor Documentation

## IO()

IO::IO | ( | XrdOucCacheIO * | io,
|  | Cache & | cache )

Definition at line 7 of file XrdPfcIO.cc.

:
m_cache (cache),
m_traceID ("IO"),
m_active_read_reqs(0),
m_io (io),
m_read_seqid (0u)
{}
XrdPfc::IO::m_traceID
const char * m_traceID
Definition XrdPfcIO.hh:51
XrdPfc::IO::m_cache
Cache & m_cache
reference to Cache object
Definition XrdPfcIO.hh:50
XrdPfc::IO::m_active_read_reqs
RAtomic_int m_active_read_reqs
number of active read requests
Definition XrdPfcIO.hh:70

References XrdOucCacheIO::XrdOucCacheIO(), m_active_read_reqs, m_cache, and m_traceID.

Referenced by XrdPfc::IOFile::IOFile(), XrdPfc::IOFileBlock::IOFileBlock(), and Detach().

Here is the call graph for this function:
Here is the caller graph for this function:

## Member Function Documentation

## Base()

virtual XrdOucCacheIO * XrdPfc::IO::Base | ( |  | ) |

inline virtual

Original data source.

Definition at line 21 of file XrdPfcIO.hh.

{ return m_io; }

References XrdOucCacheIO::XrdOucCacheIO().

Here is the call graph for this function:

## Detach()

bool IO::Detach | ( | XrdOucCacheIOCD & | iocd | ) |

final virtual

Detach this CacheIO object from the cache.

Note
  This method must be called instead of using the delete operator since CacheIO objects may have multiple outstanding references and actual deletion may need to be deferred.

Parameters

  iocd | reference to the detach complete callback object.

Returns
  true Deletion can occur immediately. There is no outstanding I/O.
  false Deletion must be deferred until it is safe to so from the cache perspective. At which point, the cache will call the DetachDone() method in the passed callback object. No locks may be held with respect to the CacheIO object when this is done to avoid deadlocks.

Implements XrdOucCacheIO.

Definition at line 43 of file XrdPfcIO.cc.

{
// Called from XrdPosixFile when local connection is closed.
if ( ! ioActive())
{
DetachFinalize();
return true;
}
else
{
class FutureDetach : public XrdJob
{
IO *f_io;
XrdOucCacheIOCD *f_detach_cb;
time_t f_wait_time;
public:
FutureDetach(IO *io, XrdOucCacheIOCD *cb, time_t wt) :
f_io (io),
f_detach_cb (cb),
f_wait_time (wt)
{}
void DoIt()
{
if (f_io->ioActive())
{
// Reschedule up to 120 sec in the future.
f_wait_time = std::min(2 * f_wait_time, (time_t) 120);
Schedule();
}
else
{
f_io->DetachFinalize();
f_detach_cb->DetachDone();
delete this;
}
}
void Schedule()
{
Cache::schedP->Schedule(this, time(0) + f_wait_time);
}
};
(new FutureDetach(this, &iocdP, 10))->Schedule();
return false;
}
}
DoIt
int DoIt(int argpnt, int argc, char **argv, bool singleshot)
Definition XrdAccTest.cc:262
XrdOucCacheIOCD::DetachDone
virtual void DetachDone()=0
Indicate that the CacheIO object has been detached.
XrdPfc::Cache::schedP
static XrdScheduler * schedP
Definition XrdPfc.hh:302
XrdPfc::IO::ioActive
virtual bool ioActive()=0
XrdPfc::IO::DetachFinalize
virtual void DetachFinalize()=0
XrdScheduler::Schedule
void Schedule(XrdJob *jp)
Definition XrdScheduler.cc:373

References IO(), XrdOucCacheIOCD::DetachDone(), DetachFinalize(), DoIt(), ioActive(), and XrdPfc::Cache::schedP.

Here is the call graph for this function:

## DetachFinalize()

virtual void XrdPfc::IO::DetachFinalize | ( |  | ) |

pure virtual

Implemented in XrdPfc::IOFile, and XrdPfc::IOFileBlock.

Referenced by Detach().

Here is the caller graph for this function:

## GetFilename()

std::string IO::GetFilename | ( |  | ) |

protected

Definition at line 36 of file XrdPfcIO.cc.

{
return XrdCl::URL(GetPath()).GetPath();
}
XrdPfc::IO::GetPath
const char * GetPath()
Definition XrdPfcIO.hh:53

References XrdCl::URL::GetPath(), and GetPath().

Referenced by XrdPfc::IOFile::IOFile().

Here is the call graph for this function:
Here is the caller graph for this function:

## GetInput()

XrdOucCacheIO * IO::GetInput | ( |  | ) |

Definition at line 31 of file XrdPfcIO.cc.

{
return m_io;
}

References XrdOucCacheIO::XrdOucCacheIO().

Referenced by XrdPfc::Cache::GetFile(), and XrdPfc::IOFileBlock::Read().

Here is the call graph for this function:
Here is the caller graph for this function:

## GetLocation()

const char * XrdPfc::IO::GetLocation | ( |  | ) |

inline

Definition at line 44 of file XrdPfcIO.hh.

{ return m_io->Location(false); }

Referenced by XrdPfc::File::AddIO(), XrdPfc::File::ioActive(), XrdPfc::File::ioUpdated(), and Update().

Here is the caller graph for this function:

## GetPath()

const char * XrdPfc::IO::GetPath | ( |  | ) |

inline protected

Definition at line 53 of file XrdPfcIO.hh.

{ return m_io->Path(); }

Referenced by GetFilename().

Here is the caller graph for this function:

## GetTrace()

XrdSysTrace * XrdPfc::IO::GetTrace | ( |  | ) |

inline

Definition at line 45 of file XrdPfcIO.hh.

{ return m_cache.GetTrace(); }

References m_cache.

Referenced by XrdPfc::IOFileBlock::IOFileBlock().

Here is the caller graph for this function:

## ioActive()

virtual bool XrdPfc::IO::ioActive | ( |  | ) |

pure virtual

Implemented in XrdPfc::IOFile, and XrdPfc::IOFileBlock.

Referenced by Detach().

Here is the caller graph for this function:

## ObtainReadSid()

unsigned short XrdPfc::IO::ObtainReadSid | ( |  | ) |

inline protected

Definition at line 57 of file XrdPfcIO.hh.

{ return m_read_seqid++; }

Referenced by XrdPfc::IOFile::pgRead(), XrdPfc::IOFile::Read(), XrdPfc::IOFile::Read(), XrdPfc::IOFileBlock::Read(), XrdPfc::IOFile::ReadV(), and XrdPfc::IOFile::ReadV().

Here is the caller graph for this function:

## Path()

const char * XrdPfc::IO::Path | ( |  | ) |

inline override virtual

Original data source URL.

Implements XrdOucCacheIO.

Definition at line 24 of file XrdPfcIO.hh.

{ return m_io->Path(); }

Referenced by Update().

Here is the caller graph for this function:

## RefreshLocation()

const char * XrdPfc::IO::RefreshLocation | ( |  | ) |

inline protected

Definition at line 55 of file XrdPfcIO.hh.

{ return m_io->Location(true); }

Referenced by XrdPfc::IOFile::ioActive(), XrdPfc::IOFileBlock::ioActive(), and Update().

Here is the caller graph for this function:

## register_block_error()

bool XrdPfc::IO::register_block_error | ( | int | res | ) |

inline protected

Definition at line 93 of file XrdPfcIO.hh.

{
return m_error_counts[res]++ == 0;
}
XrdPfc::IO::m_error_counts
std::map< int, int > m_error_counts
Definition XrdPfcIO.hh:89

References m_error_counts.

## register_incomplete_read()

bool XrdPfc::IO::register_incomplete_read | ( |  | ) |

inline protected

Definition at line 90 of file XrdPfcIO.hh.

{
return m_incomplete_count++ == 0;
}
XrdPfc::IO::m_incomplete_count
int m_incomplete_count
Definition XrdPfcIO.hh:88

References m_incomplete_count.

## Sync() [1/2]

int XrdPfc::IO::Sync | ( |  | ) |

inline override virtual

Perform an synchronous sync() operation.

Returns
  <0 - Sync failed, value is -errno. =0 - Sync succeeded.

Implements XrdOucCacheIO.

Definition at line 27 of file XrdPfcIO.hh.

{ return 0; }

## Sync() [2/2]

virtual void XrdOucCacheIO::Sync | ( | XrdOucCacheIOCB & | iocb | ) |

inline virtual

Perform an asynchronous sync() operation (defaults to synchronous).

Parameters

  iocb | reference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.

Reimplemented from XrdOucCacheIO.

Definition at line 380 of file XrdOucCache.hh.

{iocb.Done(Sync());}
XrdOucCacheIOCB::Done
virtual void Done(int result)=0
XrdPfc::IO::Sync
int Sync() override
Definition XrdPfcIO.hh:27

## Trunc() [1/2]

int XrdPfc::IO::Trunc | ( | long long | offs | ) |

inline override virtual

Perform an synchronous trunc() operation.

Parameters

  offs | the size the file is have.

Returns
  <0 - Trunc failed, value is -errno. =0 - Trunc succeeded.

Implements XrdOucCacheIO.

Definition at line 30 of file XrdPfcIO.hh.

{ return -ENOTSUP; }

## Trunc() [2/2]

virtual void XrdOucCacheIO::Trunc | ( | XrdOucCacheIOCB & | iocb,
|  | long long | offs )

inline virtual

Perform an asynchronous trunc() operation (defaults to synchronous).

Parameters

  iocb | reference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
  offs | the size the file is have.

Reimplemented from XrdOucCacheIO.

Definition at line 403 of file XrdOucCache.hh.

{iocb.Done(Trunc(offs));}
XrdPfc::IO::Trunc
int Trunc(long long Offset) override
Definition XrdPfcIO.hh:30

## Update()

void IO::Update | ( | XrdOucCacheIO & | iocp | ) |

override virtual

Update the originally passed XrdOucCacheIO object with the object passed. All future uses underlying XrdOucCacheIO object must now use this object. Update() is called when Prepare() indicated that the file should not be physically opened and a file method was invoked in the XrdOucCacheIO passed to Attach(). When this occurs, the file is actually opened and Update() called to replace the original XrdOucCacheIO object with one that uses the newly opened file.

Parameters

  iocp | reference to the new XrdOucCacheIO object.

Reimplemented from XrdOucCacheIO.

Reimplemented in XrdPfc::IOFile, and XrdPfc::IOFileBlock.

Definition at line 17 of file XrdPfcIO.cc.

{
SetInput(&iocp);
RefreshLocation();
TRACE_PC(Info, const char* loc = GetLocation(),
"Update() " << Path() << " location: " <<
((loc && loc[0] != 0) ? loc : "<not set>"));
}
TRACE_PC
#define TRACE_PC(act, pre_code, x)
Definition XrdPfcTrace.hh:59
XrdPfc::IO::Path
const char * Path() override
Original data source URL.
Definition XrdPfcIO.hh:24
XrdPfc::IO::RefreshLocation
const char * RefreshLocation()
Definition XrdPfcIO.hh:55
XrdPfc::IO::GetLocation
const char * GetLocation()
Definition XrdPfcIO.hh:44

References XrdOucCacheIO::XrdOucCacheIO(), GetLocation(), Path(), RefreshLocation(), and TRACE_PC.

Referenced by XrdPfc::IOFile::Update(), and XrdPfc::IOFileBlock::Update().

Here is the call graph for this function:
Here is the caller graph for this function:

## Write() [1/2]

int XrdPfc::IO::Write | ( | char * | buff,
|  | long long | offs,
|  | int | wlen )

inline override virtual

Perform an synchronous write.

Parameters

  buff | pointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
  offs | the offset into the file.
  wlen | the number of bytes to write

Returns
  < 0 - Write failed, value is -errno. >=0 - Write succeeded, value is number of bytes written.

Implements XrdOucCacheIO.

Definition at line 33 of file XrdPfcIO.hh.

{ return -ENOTSUP; }

## Write() [2/2]

virtual void XrdOucCacheIO::Write | ( | XrdOucCacheIOCB & | iocb,
|  | char * | buff,
|  | long long | offs,
|  | int | wlen )

inline virtual

Perform an asynchronous write (defaults to synchronous).

Parameters

  iocb | reference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
  buff | pointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
  offs | the offset into the file.
  wlen | the number of bytes to write

Reimplemented from XrdOucCacheIO.

Definition at line 447 of file XrdOucCache.hh.

{iocb.Done(Write(buff, offs, wlen));}
XrdPfc::IO::Write
int Write(char *Buffer, long long Offset, int Length) override
Definition XrdPfcIO.hh:33

## Friends And Related Symbol Documentation

## File

friend class File

friend

Definition at line 80 of file XrdPfcIO.hh.

References File.

Referenced by File, and XrdPfc::IOFileBlock::Read().

## Member Data Documentation

## m_active_read_reqs

RAtomic_int XrdPfc::IO::m_active_read_reqs

protected

number of active read requests

Definition at line 70 of file XrdPfcIO.hh.

Referenced by IO(), XrdPfc::File::ioActive(), XrdPfc::IOFile::pgRead(), XrdPfc::IOFile::Read(), XrdPfc::IOFile::Read(), XrdPfc::IOFile::ReadV(), and XrdPfc::IOFile::ReadV().

## m_cache

Cache& XrdPfc::IO::m_cache

protected

reference to Cache object

Definition at line 50 of file XrdPfcIO.hh.

Referenced by IO(), XrdPfc::IOFileBlock::DetachFinalize(), and GetTrace().

## m_error_counts

std::map<int, int> XrdPfc::IO::m_error_counts

protected

Definition at line 89 of file XrdPfcIO.hh.

Referenced by XrdPfc::IOFile::DetachFinalize(), and register_block_error().

## m_incomplete_count

int XrdPfc::IO::m_incomplete_count {0}

protected

Definition at line 88 of file XrdPfcIO.hh.

{0};

Referenced by XrdPfc::IOFile::DetachFinalize(), and register_incomplete_read().

## m_traceID

const char* XrdPfc::IO::m_traceID

protected

Definition at line 51 of file XrdPfcIO.hh.

Referenced by IO().

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

- XrdPfcIO.hh
- XrdPfcIO.cc