xrootd
Public Types | Public Member Functions | List of all members
XrdOucCache2 Class Referenceabstract

#include <XrdOucCache2.hh>

Inheritance diagram for XrdOucCache2:
Inheritance graph
[legend]
Collaboration diagram for XrdOucCache2:
Collaboration graph
[legend]

Public Types

enum  LFP_Reason { ForAccess =0, ForInfo, ForPath }
 

Public Member Functions

virtual XrdOucCacheIO2Attach (XrdOucCacheIO2 *ioP, int opts=0)=0
 
virtual XrdOucCacheIOAttach (XrdOucCacheIO *ioP, int opts=0)
 
virtual XrdOucCacheCreate (Parms &Params, XrdOucCacheIO::aprParms *aprP=0)
 
virtual void EnvInfo (XrdOucEnv &theEnv)
 
virtual int LocalFilePath (const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess)
 
virtual int Prepare (const char *url, int oflags, mode_t mode)
 
virtual int Stat (const char *url, struct stat &sbuff)
 
 XrdOucCache2 ()
 
virtual ~XrdOucCache2 ()
 
virtual XrdOucCacheIOAttach (XrdOucCacheIO *ioP, int Options=0)=0
 
- Public Member Functions inherited from XrdOucCache
virtual int isAttached ()
 
virtual int Unlink (const char *)
 
virtual int Rmdir (const char *)
 
virtual int Rename (const char *, const char *)
 
virtual int Truncate (const char *, off_t)
 
 XrdOucCache ()
 
virtual ~XrdOucCache ()
 

Additional Inherited Members

- Public Attributes inherited from XrdOucCache
XrdOucCacheStats Stats
 
- Static Public Attributes inherited from XrdOucCache
static const int optADB = 0x1000
 
static const int optFIS = 0x0001
 
static const int optFIU = 0x0002
 
static const int optRW = 0x0004
 
static const int optNEW = 0x0014
 
static const int optWIN = 0x0024
 
static const int isServer = 0x0010
 
static const int isStructured = 0x0020
 
static const int canPreRead = 0x0040
 
static const int logStats = 0x0080
 
static const int Serialized = 0x0004
 
static const int ioMTSafe = 0x0008
 
static const int Debug = 0x0003
 

Detailed Description

The XrdOucCache2 class is used to define a version 2 cache. In version 2, there can be only one such instance. the cache is associated with one or more XrdOucCacheIO2 objects. Use the Attach() method in this class to create such associations.

Member Enumeration Documentation

◆ LFP_Reason

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.

Parameters
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.
Returns
0 - the file is complete and the local path to the file is in the buffer, if it has been supllied.
<0 - the request could not be fulfilled. The return value is -errno describing why. If a buffer was supplied and a path could be generated it is returned only if "why" is ForInfo or ForPath. Otherwise, a null path is 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

Returns
>0 - Reserved for future use.
Enumerator
ForAccess 
ForInfo 
ForPath 

Constructor & Destructor Documentation

◆ XrdOucCache2()

XrdOucCache2::XrdOucCache2 ( )
inline

◆ ~XrdOucCache2()

virtual XrdOucCache2::~XrdOucCache2 ( )
inlinevirtual

Member Function Documentation

◆ Attach() [1/3]

virtual XrdOucCacheIO* XrdOucCache::Attach

Obtain a new XrdOucCacheIO2 object that fronts an existing XrdOucCacheIO2 with this cache. Upon success a pointer to a new XrdOucCacheIO2 object is returned and must be used to read and write data with the cache interposed. Upon failure, the original XrdOucCacheIO2 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 CacheIO2 object to perform I/O operatios.

Parameters
ioPPointer to the current CacheIO2 object used for I/O.
optsCache options identical to those defined for XrdOucCache Attach() method.
Returns
Pointer to a new XrdOucCacheIO2 object (success) or the original XrdOucCacheIO2 object (failure) with errno set.

◆ Attach() [2/3]

virtual XrdOucCacheIO2* XrdOucCache2::Attach ( XrdOucCacheIO2 ioP,
int  opts = 0 
)
pure virtual

Implemented in XrdFileCache::Cache, and XrdPosixCacheBC.

◆ Attach() [3/3]

virtual XrdOucCacheIO* XrdOucCache2::Attach ( XrdOucCacheIO ioP,
int  opts = 0 
)
inlinevirtual

Implements XrdOucCache.

◆ Create()

virtual XrdOucCache* XrdOucCache2::Create ( Parms Params,
XrdOucCacheIO::aprParms aprP = 0 
)
inlinevirtual

Creates an instance of a version 1 cache. This method is no longer used so we simply define a default for this method here for backward compatability.

Returns
A pointer to an XrdOucCache object upon success or a nil pointer with errno set upon failure.

Implements XrdOucCache.

◆ EnvInfo()

virtual void XrdOucCache2::EnvInfo ( XrdOucEnv theEnv)
inlinevirtual

Supply environmental information to the cache for optimization. This is only called server-side but is optional and might not be called. The environmental information should only be used for optimizations. When called, it is gauranteed to occur before any active use of the cache and is essentially serialized (i.e. the main start-up thread is used).

Parameters
theEnv- Reference to environmental information.

Reimplemented in XrdFileCache::Cache.

◆ LocalFilePath()

virtual int XrdOucCache2::LocalFilePath ( const char *  url,
char *  buff = 0,
int  blen = 0,
LFP_Reason  why = ForAccess 
)
inlinevirtual

Reimplemented in XrdFileCache::Cache.

◆ Prepare()

virtual int XrdOucCache2::Prepare ( const char *  url,
int  oflags,
mode_t  mode 
)
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.

Parameters
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.
Returns
<0 Error has occurred, return value is -errno; fail open request. The error code -EUSERS may be returned to trigger overload recovery as specified by the xrootd.fsoverload directive. No other method should return this error code. =0 Continue with open() request. >0 Defer open but treat the file as actually being open. Use the XrdOucCacheIO2::Open() method to open the file at a later time.

Reimplemented in XrdFileCache::Cache.

◆ Stat()

virtual int XrdOucCache2::Stat ( const char *  url,
struct stat sbuff 
)
inlinevirtual

Perform a stat() operation (defaults to passthrough).

Parameters
urlpointer to the url whose stat information is wanted.
sbuffreference 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.
Returns
<0 - Stat failed, value is -errno. =0 - Stat succeeded, sbuff holds stat information. >0 - Stat could not be done, forward operation to next level.

Reimplemented in XrdFileCache::Cache.


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