![]() |
XRootD
|
#include <XrdOucCache.hh>
Public Types | |
enum | LFP_Reason { ForAccess =0 , ForInfo , ForPath } |
enum | XeqCmd { xeqNoop = 0 } |
Public Member Functions | |
XrdOucCache (const char *ctype) | |
virtual | ~XrdOucCache () |
Destructor. More... | |
virtual XrdOucCacheIO * | Attach (XrdOucCacheIO *ioP, int opts=0)=0 |
virtual int | LocalFilePath (const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess, bool forall=false) |
virtual int | Prepare (const char *url, int oflags, mode_t mode) |
virtual int | Rename (const char *oldp, const char *newp) |
virtual int | Rmdir (const char *dirp) |
virtual int | Stat (const char *url, struct stat &sbuff) |
virtual int | Truncate (const char *path, off_t size) |
virtual int | Unlink (const char *path) |
virtual int | Xeq (XeqCmd cmd, char *arg, int arglen) |
Public Attributes | |
const char | CacheType [8] |
A 1-to-7 character cache type identifier (usually pfc or rmc). More... | |
XrdOucCacheStats | Statistics |
Static Public Attributes | |
static const int | optFIS = 0x0001 |
File is structured (e.g. root file) More... | |
static const int | optNEW = 0x0014 |
File is new -> optRW (o/w read or write) More... | |
static const int | optRW = 0x0004 |
File is read/write (o/w read/only) More... | |
static const int | optWIN = 0x0024 |
File is new -> optRW use write-in cache. More... | |
The XrdOucCache class is used to define a cache. The cache is associated with one or more XrdOucCacheIO objects using the Attach() method.
Definition at line 494 of file XrdOucCache.hh.
Get the path to a file that is complete in the local cache. By default, the file must be complete in the cache (i.e. no blocks are missing). This can be overridden. Thes path can be used to access the file on the local node.
url | - Pointer to the url of interest. |
buff | - Pointer to a buffer to receive the local path to the file. If nil, no path is returned. |
blen | - Length of the buffer, buff. If zero, no path is returned. |
why | - One of the LFP_Reason enums describing the call: ForAccess - the path will be used to access the file. If the file is complete, the system will delay purging the file for a configurable window, should a purge be imminent. A null path is returned for any non-zero return code. ForInfo - same as ForAccess except that purging will not be delayed if imminent. A path is always returned, if possible. Otherwise the first byte of any supplied buffer is set to 0. ForPath - Only the path is wanted and no checks need be performed. The only possible errors are -EINVAL and -ENAMETOOLONG. |
forall | - When ForAccess is specified: when true makes the file world readable; otherwise, only group readable. The parameter is ignored unless "why" is ForAccess and a local file path is requested to be returned. |
Common return codes are: -EINVAL an argument is invalid. -EISDIR target is a directory not a file. -ENAMETOOLONG buffer not big enough to hold path. -ENOENT file not in cache -ENOTSUP method not implemented -EREMOTE file is incomplete
Enumerator | |
---|---|
ForAccess | |
ForInfo | |
ForPath |
Definition at line 570 of file XrdOucCache.hh.
enum XrdOucCache::XeqCmd |
Perform special operation on the cache.
cmd | - The operation to be performed. |
arg | - The operation argument(s). |
arglen | - The length of arg. |
Enumerator | |
---|---|
xeqNoop |
Definition at line 676 of file XrdOucCache.hh.
|
inline |
Constructor
ctype | - A 1-to-7 character cache type identifier. |
Definition at line 700 of file XrdOucCache.hh.
References CacheType.
|
inlinevirtual |
|
pure virtual |
Implemented in XrdRmcReal, and XrdPfc::Cache.
Referenced by XrdPosixFile::Finalize().
|
inlinevirtual |
Reimplemented in XrdPfc::Cache.
Definition at line 572 of file XrdOucCache.hh.
Referenced by XrdPosixCache::CachePath(), and XrdPosixCache::CacheQuery().
|
inlinevirtual |
Prepare the cache for a file open request. This method is called prior to actually opening a file. This method is meant to allow defering an open request or implementing the full I/O stack in the cache layer.
url | - Pointer to the url about to be opened. |
oflags | - Standard Unix open flags (see open(2)). |
mode | - Standard mode flags if file is being created. |
Reimplemented in XrdPfc::Cache.
Definition at line 597 of file XrdOucCache.hh.
|
inlinevirtual |
Rename a file in the cache.
oldp | - the existing path to be renamed. |
newp | - the new name it is to have. |
Definition at line 610 of file XrdOucCache.hh.
Referenced by XrdPosixCache::Rename(), and XrdPosixXrootd::Rename().
|
inlinevirtual |
Remove a directory from the cache.
dirp | - the existing directory path to be removed. |
Definition at line 622 of file XrdOucCache.hh.
Referenced by XrdPosixCache::Rmdir(), and XrdPosixXrootd::Rmdir().
|
inlinevirtual |
Perform a stat() operation (defaults to passthrough).
url | pointer to the url whose stat information is wanted. |
sbuff | reference to the stat buffer to be filled in. Only fields st_size, st_blocks, st_mtime (st_atime and st_ctime may be set to st_mtime), st_ino, and st_mode need to be set. All other fields are preset and should not be changed. |
Reimplemented in XrdPfc::Cache.
Definition at line 638 of file XrdOucCache.hh.
Referenced by XrdPosixCache::Stat(), and XrdPosixXrootd::Stat().
|
inlinevirtual |
Truncate a file in the cache to a specified size.
path | - the path of the file to truncate. |
size | - the size in bytes it is to have. |
Definition at line 651 of file XrdOucCache.hh.
Referenced by XrdPosixXrootd::Truncate(), and XrdPosixCache::Truncate().
|
inlinevirtual |
Remove a file from the cache.
path | - the path of the file to be removed. |
Reimplemented in XrdPfc::Cache.
Definition at line 663 of file XrdOucCache.hh.
Referenced by XrdPosixCache::Unlink(), and XrdPosixXrootd::Unlink().
|
inlinevirtual |
Definition at line 678 of file XrdOucCache.hh.
const char XrdOucCache::CacheType[8] |
A 1-to-7 character cache type identifier (usually pfc or rmc).
Definition at line 692 of file XrdOucCache.hh.
Referenced by XrdOucCache().
|
static |
File is structured (e.g. root file)
Obtain a new XrdOucCacheIO object that fronts an existing XrdOucCacheIO with this cache. Upon success a pointer to a new XrdOucCacheIO object is returned and must be used to read and write data with the cache interposed. Upon failure, the original XrdOucCacheIO object is returned with errno set. You can continue using the object without any cache. The new cache should use the methods in the passed CacheIO object to perform I/O operatios.
ioP | Pointer to the current CacheIO object used for I/O. |
opts | Cache options as defined below. When specified, they override the default options associated with the cache, except for optRW, optNEW, and optWIN which are valid only for a r/w cache. |
Definition at line 516 of file XrdOucCache.hh.
Referenced by XrdPosixFile::XrdPosixFile(), XrdRmcData::XrdRmcData(), and XrdRmcReal::Attach().
|
static |
File is new -> optRW (o/w read or write)
Definition at line 518 of file XrdOucCache.hh.
|
static |
File is read/write (o/w read/only)
Definition at line 517 of file XrdOucCache.hh.
Referenced by XrdPosixFile::XrdPosixFile(), XrdRmcData::XrdRmcData(), and XrdRmcReal::Attach().
|
static |
File is new -> optRW use write-in cache.
Definition at line 519 of file XrdOucCache.hh.
XrdOucCacheStats XrdOucCache::Statistics |
The following holds statistics for the cache itself. It is updated as associated cacheIO objects are deleted and their statistics are added.
Definition at line 686 of file XrdOucCache.hh.
Referenced by XrdPosixFile::DelayedDestroy(), XrdRmcData::Detach(), XrdPosixFile::Finalize(), Proto_ResourceMonitorHeartBeat(), XrdPosixCache::Statistics(), and XrdPosixConfig::Stats().