xrootd
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
XrdCks Class Referenceabstract

#include <XrdCks.hh>

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

Public Member Functions

virtual int Calc (const char *Xfn, XrdCksData &Cks, int doSet=1)=0
 
virtual int Calc (const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP, int doSet=1)
 
virtual int Del (const char *Xfn, XrdCksData &Cks)=0
 
virtual int Get (const char *Xfn, XrdCksData &Cks)=0
 
virtual int Config (const char *Token, char *Line)=0
 
virtual int Init (const char *ConfigFN, const char *DfltCalc=0)=0
 
virtual char * List (const char *Xfn, char *Buff, int Blen, char Sep=' ')=0
 
virtual const char * Name (int seqNum=0)=0
 
virtual XrdCksCalcObject (const char *name)
 
virtual int Size (const char *Name=0)=0
 
virtual int Set (const char *Xfn, XrdCksData &Cks, int myTime=0)=0
 
virtual int Ver (const char *Xfn, XrdCksData &Cks)=0
 
virtual int Ver (const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP)
 
 XrdCks (XrdSysError *erP)
 Constructor.
 
virtual ~XrdCks ()
 Destructor.
 

Protected Attributes

XrdSysErroreDest
 

Detailed Description

Note
Filenames passed to any of the manager's methods may be either logical (lfn) or physical (pfn). By default, these are always physical file names. However, it is possible to configure the default manager to use the Oss plugin for all I/O related functions. In this case, a logical filename may be passed if this is required by the Oss plugin as it will translate the logical name to the physical one. See the "ofs.osslib" directive for details. Additionally, when using the default Oss or Pss plugins as the I/O provider, logical file names are always provided to the manager. Note that default manager is automatically configured to accept the correct type of file name. There is no mechanism to do this for a specialized manager. So, it's possible to create a configuration file that requires logical name to be supplied when the manager override only accepts physical ones.

Constructor & Destructor Documentation

◆ XrdCks()

XrdCks::XrdCks ( XrdSysError erP)
inline

Constructor.

◆ ~XrdCks()

virtual XrdCks::~XrdCks ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Calc() [1/2]

virtual int XrdCks::Calc ( const char *  Xfn,
XrdCksData Cks,
int  doSet = 1 
)
pure virtual

Calculate a new checksum for a physical file using the checksum algorithm named in the Cks parameter.

Parameters
XfnThe logical or physical name of the file to be checksumed.
CksFor input, it specifies the checksum algorithm to be used. For output, the checksum value is returned upon success.
doSetWhen true, the new value must replace any existing value in the Xfn's extended file attributes.
pcbPIn the second form, the pointer to the callback object. A nil pointer does not invoke any callback.
Returns
Success: zero with Cks structure holding the checksum value. Failure: -errno (see significant error numbers below).

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::Calc(), and Calc().

◆ Calc() [2/2]

virtual int XrdCks::Calc ( const char *  Xfn,
XrdCksData Cks,
XrdCksPCB pcbP,
int  doSet = 1 
)
inlinevirtual

Reimplemented in XrdCksWrapper.

References Calc().

◆ Config()

virtual int XrdCks::Config ( const char *  Token,
char *  Line 
)
pure virtual

Parse a configuration directives specific to the checksum manager.

Parameters
TokenPoints to the directive that triggered the call.
LineAll the characters after the directive.
Returns
Success: 1 Failure: 0

Implemented in XrdCksManager, XrdCksWrapper, and XrdPssCks.

Referenced by XrdCksWrapper::Config().

◆ Del()

virtual int XrdCks::Del ( const char *  Xfn,
XrdCksData Cks 
)
pure virtual

Delete the checksum from the Xfn's xattrs.

Parameters
XfnThe logical or physical name of the file to be checksumed.
CksSpecifies the checksum type to delete.
Returns
Success: 0 Failure: -errno (see significant error numbers below).

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::Del().

◆ Get()

virtual int XrdCks::Get ( const char *  Xfn,
XrdCksData Cks 
)
pure virtual

Retreive the checksum from the Xfn's xattrs and return it and indicate whether or not it is stale (i.e. the file modification has changed or the name and length are not the expected values).

Parameters
XfnThe logical or physical name of the file to be checksumed.
CksFor input, it specifies the checksum type to return. For output, the checksum value is returned upon success.
Returns
Success: The length of the binary checksum in the Cks structure. Failure: -errno (see significant error numbers below).

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::Get().

◆ Init()

virtual int XrdCks::Init ( const char *  ConfigFN,
const char *  DfltCalc = 0 
)
pure virtual

Fully initialize the manager which includes loading any plugins.

Parameters
ConfigFNPoints to the configuration file path.
DfltCalcIs the default checksum and should be defaulted if NULL. The default implementation defaults this to adler32. A default is only needed should the checksum name in the XrdCksData object be omitted.
Returns
Success: 1 Failure: 0

Implemented in XrdCksManager, XrdCksWrapper, and XrdPssCks.

Referenced by XrdCksWrapper::Init().

◆ List()

virtual char * XrdCks::List ( const char *  Xfn,
char *  Buff,
int  Blen,
char  Sep = ' ' 
)
pure virtual

List names of the checksums associated with a Xfn or all supported ones.

Parameters
XfnThe logical or physical file name whose checksum names are to be returned. When Xfn is null, return all supported checksum algorithm names.
BuffPoints to a buffer, at least 64 bytes in length, to hold a "Sep" separated list of checksum names.
BlenThe length of the buffer.
SepThe separation character to be used between adjacent names.
Returns
Success: Pointer to Buff holding at least one checksum name. Failure: A nil pointer is returned.

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::List().

◆ Name()

virtual const char * XrdCks::Name ( int  seqNum = 0)
pure virtual

Get the name of the checksums associated with a sequence number. Note that Name() may be called prior to final config to see if there are any chksums to configure and avoid unintended errors.

Parameters
seqNumThe sequence number. Zero signifies the default name. Higher numbers are alternates.
Returns
Success: Pointer to the name. Failure: A nil pointer is returned (no more alternates exist).

Implemented in XrdCksManager, XrdCksWrapper, and XrdPssCks.

Referenced by XrdCksWrapper::Name().

◆ Object()

virtual XrdCksCalc * XrdCks::Object ( const char *  name)
inlinevirtual

Get a new XrdCksCalc object that can calculate the checksum corresponding to the specified name or the default object if name is a null pointer. The object can be used to compute checksums on the fly. The object's Recycle() method must be used to delete it.

Parameters
nameThe name of the checksum algorithm. If null, use the default one.
Returns
Success: A pointer to the object is returned. Failure: Zero if no corresponding object exists.

Reimplemented in XrdCksManager, and XrdCksWrapper.

Referenced by XrdCksWrapper::Object().

◆ Set()

virtual int XrdCks::Set ( const char *  Xfn,
XrdCksData Cks,
int  myTime = 0 
)
pure virtual

Set a file's checksum in the extended attributes along with the file's mtime and the time of setting.

Parameters
XfnThe logical or physical name of the file to be set.
CksSpecifies the checksum name and value.
myTimeWhen true then the fmTime and gmTime in the Cks structure are to be used; as opposed to the current time.
Returns
Success: zero is returned. Failure: -errno (see significant error numbers below).

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::Set().

◆ Size()

virtual int XrdCks::Size ( const char *  Name = 0)
pure virtual

Get the binary length of the checksum with the corresponding name.

Parameters
NameThe checksum algorithm name. If null, use the default name.
Returns
Success: checksum length. Failure: Zero if the checksum name does not exist.

Implemented in XrdCksManager, XrdCksWrapper, and XrdPssCks.

Referenced by XrdCksWrapper::Size().

◆ Ver() [1/2]

virtual int XrdCks::Ver ( const char *  Xfn,
XrdCksData Cks 
)
pure virtual

Retreive the checksum from the Xfn's xattrs and compare it to the supplied checksum. If the checksum is not available or is stale, a new checksum is calculated and written to the extended attributes.

Parameters
XfnThe logical or physical name of the file to be verified.
CksSpecifies the checksum name and value.
pcbPIn the second form, the pointer to the callback object. A nil pointer does not invoke any callback.
Returns
Success: True Failure: False (the checksums do not match) or -errno indicating that verification could not be performed (see significant error numbers below).

Implemented in XrdCksManOss, XrdCksManager, XrdPssCks, and XrdCksWrapper.

Referenced by XrdCksWrapper::Ver(), and Ver().

◆ Ver() [2/2]

virtual int XrdCks::Ver ( const char *  Xfn,
XrdCksData Cks,
XrdCksPCB pcbP 
)
inlinevirtual

Reimplemented in XrdCksWrapper.

References Ver().

Member Data Documentation

◆ eDest

XrdSysError* XrdCks::eDest
protected

Significant errno values:

-EDOM The supplied checksum length is invalid for the checksum name. -ENOTSUP The supplied or default checksum name is not supported. -ESRCH Checksum does not exist for file. -ESTALE The file's checksum is no longer valid.


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