Skip to content

Commit

Permalink
[Server] Add checkpoint() method to XrdSfsFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Oct 18, 2019
1 parent b3625f9 commit f8658c1
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 54 deletions.
2 changes: 1 addition & 1 deletion docs/PreReleaseNotes.txt
Expand Up @@ -39,4 +39,4 @@ Prerelease Notes
* **[Server]** Add appname to SecEntity attribute set.
* **[Server]** Assign a unique ID to each SecEntity instance.
* **[Server]** Make cksio the default for the ofs.osslib directive.

* **[Server]** Add checkpoint() method to XrdSfsFile.
3 changes: 0 additions & 3 deletions src/XrdSfs/XrdSfsFlags.hh
Expand Up @@ -51,9 +51,6 @@ static const uint64_t hasPRP2 = 0x0000000000000004LL;

//! Feature: Proxy Server
static const uint64_t hasPRXY = 0x0000000000000008LL;

//! Feature: pgRead & pgWrite
static const uint64_t hasPGWR = 0x0000000000000010LL;
}

//-----------------------------------------------------------------------------
Expand Down
132 changes: 132 additions & 0 deletions src/XrdSfs/XrdSfsInterface.cc
Expand Up @@ -40,6 +40,56 @@ namespace
static const XrdSfsFileOffset pgSize = XrdSfsPageSize;
}

/******************************************************************************/
/* X r d S f s D i r e c t o r y M e t h o d D e f a u l t s */
/******************************************************************************/
/******************************************************************************/
/* a u t o s t a t */
/******************************************************************************/

int XrdSfsDirectory::autoStat(struct stat *buf)
{
(void)buf;
error.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}

/******************************************************************************/
/* X r d S f s F i l e M e t h o d D e f a u l t s */
/******************************************************************************/
/******************************************************************************/
/* c h e c k p o i n t */
/******************************************************************************/

int XrdSfsFile::checkpoint(cpAct act, struct iov *range, int n)
{
// Provide reasonable answers
//
switch(act)
{case cpCreate: error.setErrInfo(EDQUOT,"Checkpoint quota exceeded.");
break;
case cpDelete:
case cpRestore: error.setErrInfo(ENOENT,"Checkpoint does not exist.");
break;
default: error.setErrInfo(EINVAL,"Invalid checkpoint request.");
break;
}
return SFS_ERROR;
}

/******************************************************************************/
/* f c t l */
/******************************************************************************/

int XrdSfsFile::fctl(const int cmd,
int alen,
const char *args,
const XrdSecEntity *client)
{
(void)cmd; (void)alen; (void)args; (void)client;
return SFS_OK;
}

/******************************************************************************/
/* p g R e a d */
/******************************************************************************/
Expand Down Expand Up @@ -165,6 +215,18 @@ XrdSfsXferSize XrdSfsFile::readv(XrdOucIOVec *readV,
return totbytes;
}

/******************************************************************************/
/* S e n d D a t a */
/******************************************************************************/

int XrdSfsFile::SendData(XrdSfsDio *sfDio,
XrdSfsFileOffset offset,
XrdSfsXferSize size)
{
(void)sfDio; (void)offset; (void)size;
return SFS_OK;
}

/******************************************************************************/
/* w r i t e v */
/******************************************************************************/
Expand All @@ -186,3 +248,73 @@ XrdSfsXferSize XrdSfsFile::writev(XrdOucIOVec *writeV,
}
return totbytes;
}

/******************************************************************************/
/* X r d S f s F i l e S y s t e m M e t h o d D e f a u l t s */
/******************************************************************************/
/******************************************************************************/
/* c h k s u m */
/******************************************************************************/

int XrdSfsFileSystem::chksum( csFunc Func,
const char *csName,
const char *path,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client,
const char *opaque)
{
(void)Func; (void)csName; (void)path; (void)eInfo; (void)client;
(void)opaque;

eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}

/******************************************************************************/
/* F A t t r */
/******************************************************************************/

int XrdSfsFileSystem::FAttr( XrdSfsFACtl *faReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client)
{
(void)faReq; (void)client;

eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}

/******************************************************************************/
/* F e a t u r e s */
/******************************************************************************/

uint64_t XrdSfsFileSystem::Features() {return 0;}

/******************************************************************************/
/* F S c t l */
/******************************************************************************/

int XrdSfsFileSystem::FSctl(const int cmd,
XrdSfsFSctl &args,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client)
{
(void)cmd; (void)args; (void)eInfo; (void)client;

return SFS_OK;
}

/******************************************************************************/
/* g p F i l e */
/******************************************************************************/

int XrdSfsFileSystem::gpFile( gpfFunc &gpAct,
XrdSfsGPFile &gpReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client)
{
(void)gpAct, (void)gpReq; (void)client;

eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}
79 changes: 29 additions & 50 deletions src/XrdSfs/XrdSfsInterface.hh
Expand Up @@ -297,11 +297,7 @@ virtual const char *FName() = 0;
//! SFS_ERROR should be returned with error.code set to ENOTSUP.
//-----------------------------------------------------------------------------

virtual int autoStat(struct stat *buf)
{(void)buf;
error.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}
virtual int autoStat(struct stat *buf);

//-----------------------------------------------------------------------------
//! Constructor (user and MonID are the ones passed to newDir()!). This
Expand Down Expand Up @@ -403,6 +399,23 @@ virtual int open(const char *fileName,
const XrdSecEntity *client = 0,
const char *opaque = 0) = 0;

//-----------------------------------------------------------------------------
//! Create, delete, query, or rollback a file checkpoint.
//!
//! @param act - The operation to be performed (see cpAct enum below).
//! @param range - Portions of the file to be checkpointed.
//! @param n - Number of elements in range.
//!
//! @return One of SFS_OK or SFS_ERROR.
//-----------------------------------------------------------------------------

enum cpAct {cpCreate=0, //!< Create a checkpoint, one must not be active.
cpDelete, //!< Delete an existing checkpoint
cpRestore //!< Restore an active checkpoint and delete it.
};

virtual int checkpoint(cpAct act, struct iov *range=0, int n=0);

//-----------------------------------------------------------------------------
//! Close the file.
//!
Expand Down Expand Up @@ -452,11 +465,7 @@ virtual int fctl(const int cmd,
virtual int fctl(const int cmd,
int alen,
const char *args,
const XrdSecEntity *client = 0)
{
(void)cmd; (void)alen; (void)args; (void)client;
return SFS_OK;
}
const XrdSecEntity *client = 0);

//-----------------------------------------------------------------------------
//! Get the file path.
Expand Down Expand Up @@ -620,11 +629,7 @@ virtual XrdSfsXferSize readv(XrdOucIOVec *readV,

virtual int SendData(XrdSfsDio *sfDio,
XrdSfsFileOffset offset,
XrdSfsXferSize size)
{
(void)sfDio; (void)offset; (void)size;
return SFS_OK;
}
XrdSfsXferSize size);

//-----------------------------------------------------------------------------
//! Write file bytes from a buffer.
Expand Down Expand Up @@ -833,8 +838,7 @@ virtual XrdSfsDirectory *newDir(char *user=0, int MonID=0) = 0;
//! @return nil - Insufficient memory to allocate an object.
//-----------------------------------------------------------------------------

virtual XrdSfsDirectory *newDir(XrdOucErrInfo &eInfo)
{(void)eInfo; return 0;}
virtual XrdSfsDirectory *newDir(XrdOucErrInfo &eInfo) {(void)eInfo; return 0;}

//-----------------------------------------------------------------------------
//! Obtain a new file object to be used for a future file requests.
Expand Down Expand Up @@ -863,8 +867,7 @@ virtual XrdSfsFile *newFile(char *user=0, int MonID=0) = 0;
//! @return nil - Insufficient memory to allocate an object.
//-----------------------------------------------------------------------------

virtual XrdSfsFile *newFile(XrdOucErrInfo &eInfo)
{(void)eInfo; return 0;}
virtual XrdSfsFile *newFile(XrdOucErrInfo &eInfo) {(void)eInfo; return 0;}

//-----------------------------------------------------------------------------
//! Obtain checksum information for a file.
Expand Down Expand Up @@ -894,13 +897,7 @@ virtual int chksum( csFunc Func,
const char *path,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0,
const char *opaque = 0)
{
(void)Func; (void)csName; (void)path; (void)eInfo; (void)client;
(void)opaque;
eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}
const char *opaque = 0);

//-----------------------------------------------------------------------------
//! Change file mode settings.
Expand Down Expand Up @@ -937,10 +934,7 @@ virtual void Connect(const XrdSecEntity *client = 0)
//! @param client - Client's identify (see common description).
//-----------------------------------------------------------------------------

virtual void Disc(const XrdSecEntity *client = 0)
{
(void)client;
}
virtual void Disc(const XrdSecEntity *client = 0) {(void)client;}

//-----------------------------------------------------------------------------
//! Notify filesystem about implmentation dependent environment. This method
Expand All @@ -949,10 +943,7 @@ virtual void Disc(const XrdSecEntity *client = 0)
//! @param envP - Pointer to environmental information.
//-----------------------------------------------------------------------------

virtual void EnvInfo(XrdOucEnv *envP)
{
(void)envP;
}
virtual void EnvInfo(XrdOucEnv *envP) {(void)envP;}

//-----------------------------------------------------------------------------
//! Return directory/file existence information (short stat).
Expand Down Expand Up @@ -996,11 +987,7 @@ virtual int exists(const char *path,

virtual int FAttr( XrdSfsFACtl *faReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0)
{(void)faReq; (void)client;
eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}
const XrdSecEntity *client = 0);

//-----------------------------------------------------------------------------
//! Obtain file system feature set.
Expand All @@ -1009,7 +996,7 @@ virtual int FAttr( XrdSfsFACtl *faReq,
//! See include file XrdSfsFlags.hh for actual bit values.
//-----------------------------------------------------------------------------

virtual uint64_t Features() {return 0;}
virtual uint64_t Features();

//-----------------------------------------------------------------------------
//! Perform a filesystem control operation (version 2)
Expand All @@ -1032,11 +1019,7 @@ virtual uint64_t Features() {return 0;}
virtual int FSctl(const int cmd,
XrdSfsFSctl &args,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0)
{
(void)cmd; (void)args; (void)eInfo; (void)client;
return SFS_OK;
}
const XrdSecEntity *client = 0);

//-----------------------------------------------------------------------------
//! Perform a filesystem control operation (version 1)
Expand Down Expand Up @@ -1116,11 +1099,7 @@ enum gpfFunc {gpfCancel=0, //!< Cancel this request
virtual int gpFile( gpfFunc &gpAct,
XrdSfsGPFile &gpReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0)
{(void)gpAct, (void)gpReq; (void)client;
eInfo.setErrInfo(ENOTSUP, "Not supported.");
return SFS_ERROR;
}
const XrdSecEntity *client = 0);

//-----------------------------------------------------------------------------
//! Create a directory.
Expand Down

0 comments on commit f8658c1

Please sign in to comment.