XRootD
XrdRmc Class Reference

#include <XrdRmc.hh>

+ Collaboration diagram for XrdRmc:

Classes

struct  Parms
 Parameters for a newly created memory cache. More...
 

Public Member Functions

 XrdRmc ()
 
 ~XrdRmc ()
 

Static Public Member Functions

static XrdOucCacheCreate (Parms &Params, XrdOucCacheIO::aprParms *aprP=0)
 

Static Public Attributes

static const int canPreRead = 0x0040
 Enable pre-read operations (o/w ignored) More...
 
static const int Debug = 0x0003
 Produce some debug messages (levels 0, 1, 2, or 3) More...
 
static const int ioMTSafe = 0x0008
 CacheIO object is MT-safe. More...
 
static const int isServer = 0x0010
 This is server application; not a user application. More...
 
static const int isStructured = 0x0020
 
static const int logStats = 0x0080
 Display statistics upon detach. More...
 
static const int Serialized = 0x0004
 Caller ensures MRSW semantics. More...
 

Detailed Description

The class defined here implements a general memory cache for data from an arbitrary source (e.g. files, sockets, etc). It is based on the abstract definition of a cache. Use the Create() method to create instances of a cache. There can be many such instances. Each instance is associated with one or more XrdOucCacheIO objects (see the XrdOucCache::Attach() method).

Notes:

  1. The minimum PageSize is 4096 (4k) and must be a power of 2. The maximum PageSize is 16MB.
  2. The size of the cache is forced to be a multiple PageSize and have a minimum size of PageSize * 256.
  3. The minimum external read size is equal to PageSize.
  4. Currently, only write-through caches are supported.
  5. The Max2Cache value avoids placing data in the cache when a read exceeds the specified value. The minimum allowed is PageSize, which is also the default.
  6. Structured file optimization allows pages whose bytes have been fully referenced to be discarded; effectively increasing the cache.
  7. A structured cache treats all files as structured. By default, the cache treats files as unstructured. You can over-ride the settings on an individual file basis when the file's I/O object is attached by passing the XrdOucCache::optFIS option, if needed.
  8. Write-in caches are only supported for files attached with the XrdOucCache::optWIN setting. Otherwise, updates are handled with write-through operations.
  9. A cache object may be deleted. However, the deletion is delayed until all CacheIO objects attached to the cache are detached.
  10. The default maximum attached files is set to 8192 when isServer has been specified. Otherwise, it is set at 256.
  11. When canPreRead is specified, the cache asynchronously handles preread requests (see XrdOucCacheIO::Preread()) using 9 threads when isServer is in effect. Otherwise, 3 threads are used.
  12. The max queue depth for prereads is 8. When the max is exceeded the oldest preread is discarded to make room for the newest one.
  13. If you specify the canPreRead option when creating the cache you can also enable automatic prereads if the algorithm is workable. Otherwise, you will need to implement your own algorithm and issue prereads manually using the XrdOucCacheIO::Preread() method.
  14. The automatic preread algorithm is (see aprParms):
    1. A preread operation occurs when all of the following conditions are satisfied:
      • The cache CanPreRead option is in effect.
      • The read length < 'miniRead' || (read length < 'maxiRead' && Offset == next maxi offset)
    2. The preread page count is set to be readlen/pagesize and the preread occurs at the page after read_offset+readlen. The page is adjusted, as follows:
      • If the count is < minPages, it is set to minPages.
      • The count must be > 0 at this point.
    3. Normally, pre-read pages participate in the LRU scheme. However, if the preread was triggered using 'maxiRead' then the pages are marked for single use only. This means that the moment data is delivered from the page, the page is recycled.
  15. Invalid options silently force the use of the default.

Definition at line 92 of file XrdRmc.hh.

Constructor & Destructor Documentation

◆ XrdRmc()

XrdRmc::XrdRmc ( )
inline

Definition at line 150 of file XrdRmc.hh.

150 {}

◆ ~XrdRmc()

XrdRmc::~XrdRmc ( )
inline

Definition at line 151 of file XrdRmc.hh.

151 {}

Member Function Documentation

◆ Create()

XrdOucCache * XrdRmc::Create ( Parms Params,
XrdOucCacheIO::aprParms aprP = 0 
)
static

Create an instance of a memory cache.

Parameters
ParamsReference to mandatory cache parameters.
aprPOptional pointer to default automatic preread parameters.
Returns
Success: a pointer to a new instance of the cache. Failure: a null pointer is returned and errno set to the reason.

Definition at line 40 of file XrdRmc.cc.

41 {
42  XrdRmcReal *cP;
43  int rc;
44 
45 // We simply create a new instance of a real cache and return it. We do it this
46 // way so that in the future new types of caches can be created using the same
47 // interface.
48 //
49  cP = new XrdRmcReal(rc, ParmV, aprP);
50  if (rc) {delete cP; cP = 0; errno = rc;}
51  return (XrdOucCache *)cP;
52 }

Member Data Documentation

◆ canPreRead

const int XrdRmc::canPreRead = 0x0040
static

Enable pre-read operations (o/w ignored)

Definition at line 124 of file XrdRmc.hh.

Referenced by XrdRmcReal::XrdRmcReal().

◆ Debug

const int XrdRmc::Debug = 0x0003
static

Produce some debug messages (levels 0, 1, 2, or 3)

Definition at line 136 of file XrdRmc.hh.

Referenced by XrdRmcReal::XrdRmcReal().

◆ ioMTSafe

const int XrdRmc::ioMTSafe = 0x0008
static

CacheIO object is MT-safe.

Definition at line 133 of file XrdRmc.hh.

Referenced by XrdRmcData::XrdRmcData().

◆ isServer

const int XrdRmc::isServer = 0x0010
static

This is server application; not a user application.

Definition at line 118 of file XrdRmc.hh.

Referenced by XrdRmcReal::XrdRmcReal().

◆ isStructured

const int XrdRmc::isStructured = 0x0020
static

Definition at line 121 of file XrdRmc.hh.

Referenced by XrdRmcReal::Attach().

◆ logStats

const int XrdRmc::logStats = 0x0080
static

Display statistics upon detach.

Definition at line 127 of file XrdRmc.hh.

Referenced by XrdRmcReal::XrdRmcReal().

◆ Serialized

const int XrdRmc::Serialized = 0x0004
static

Caller ensures MRSW semantics.

Definition at line 130 of file XrdRmc.hh.

Referenced by XrdRmcData::XrdRmcData().


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