From ef51fc22516e43f676068db3fee2338103ad7a9a Mon Sep 17 00:00:00 2001 From: Andrew Hanushevsky Date: Thu, 6 Jun 2019 05:53:05 -0700 Subject: [PATCH] [Server] Add Features(), getFile(), and putFile() methods to SFS. [Server] Improve SFS wrapping and add "how to" documentation. --- src/XrdServer.cmake | 1 + src/XrdSfs/XrdSfsFlags.hh | 30 ++++++++- src/XrdSfs/XrdSfsGPFInfo.hh | 123 ++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 src/XrdSfs/XrdSfsGPFInfo.hh diff --git a/src/XrdServer.cmake b/src/XrdServer.cmake index a2f4b883fc0..93abdc7fe35 100644 --- a/src/XrdServer.cmake +++ b/src/XrdServer.cmake @@ -81,6 +81,7 @@ add_library( XrdSfs/XrdSfsAio.hh XrdSfs/XrdSfsFAttr.hh XrdSfs/XrdSfsFlags.hh + XrdSfs/XrdSfsGPFInfo.hh XrdSfs/XrdSfsInterface.hh #----------------------------------------------------------------------------- diff --git a/src/XrdSfs/XrdSfsFlags.hh b/src/XrdSfs/XrdSfsFlags.hh index 8939a405571..574016beacd 100644 --- a/src/XrdSfs/XrdSfsFlags.hh +++ b/src/XrdSfs/XrdSfsFlags.hh @@ -29,14 +29,30 @@ /* specific prior written permission of the institution or contributor. */ /******************************************************************************/ +#include #include #include //----------------------------------------------------------------------------- -//! This include file defines certain falgs that can be used by various Sfs -//! plug-ins to passthrough special attributes of regular files. +//! This include file defines certain flags that can be used by various Sfs +//! plug-ins to passthrough features and special attributes of regular files. //----------------------------------------------------------------------------- +namespace SfsFeature +{ +//! Feature: Authorization +static const uint64_t hasAUTZ = 0x0000000000000001LL; + +//! Feature: CheckSum On Close +static const uint64_t hasCSOC = 0x0000000000000002LL; + +//! Feature: Persist On Successful Close +static const uint64_t hasPOSC = 0x0000000000000004LL; + +//! Feature: Prepare Handler Version 2 (different calling conventions) +static const uint64_t hasPRP2 = 0x0000000000000008LL; +} + //----------------------------------------------------------------------------- //! The following flags define the mode bit that can be used to mark a file //! as close pending. This varies depending on the platform. This supports the @@ -63,4 +79,14 @@ static const dev_t XRDSFS_HASBKUP = static_cast(0x40LL<<((sizeof(dev_t)*8)-8)); static const dev_t XRDSFS_RDVMASK = static_cast(~(0xffLL<<((sizeof(dev_t)*8)-8))); + +//------------------------------------------------------------------------------ +//! The following defines the feature set bits that use used by the SFS +//! interface in response to a Features() call to indicate the various features +//! the plug-in has implemented. +//------------------------------------------------------------------------------ + +namespace XrdSfs +{ +} #endif diff --git a/src/XrdSfs/XrdSfsGPFInfo.hh b/src/XrdSfs/XrdSfsGPFInfo.hh new file mode 100644 index 00000000000..a4c3b1d6899 --- /dev/null +++ b/src/XrdSfs/XrdSfsGPFInfo.hh @@ -0,0 +1,123 @@ +#ifndef __XRDSFSGPFINFO_H__ +#define __XRDSFSGPFINFO_H__ +/******************************************************************************/ +/* */ +/* X r d S f s G P F I n f o . h h */ +/* */ +/* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */ +/* All Rights Reserved */ +/* Produced by Andrew Hanushevsky for Stanford University under contract */ +/* DE-AC02-76-SFO0515 with the Department of Energy */ +/* */ +/* This file is part of the XRootD software suite. */ +/* */ +/* XRootD is free software: you can redistribute it and/or modify it under */ +/* the terms of the GNU Lesser General Public License as published by the */ +/* Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ +/* License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ +/* COPYING (GPL license). If not, see . */ +/* */ +/* The copyright holder's institutional names and contributor's names may not */ +/* be used to endorse or promote products derived from this software without */ +/* specific prior written permission of the institution or contributor. */ +/******************************************************************************/ + +#include +#include + +//! Class XrdSfsGPFInfo is used to control the execution of the GetFile() +//! and putFile() methods in XrdSfsInterface. An nstance of this class is +//! passed to the correspondng method specifying what has to be done and how +//! results are to be communicated back. + +/******************************************************************************/ +/* C l a s s X r d S f s G P F I n f o */ +/******************************************************************************/ + +//------------------------------------------------------------------------------ +//! The XrdXrdSfsGPFInfo class contains the get/putFile() parameters and +//! contains callback methods that indicate when the operation completes as +//! well as for progress status updates. +//------------------------------------------------------------------------------ + +class XrdSfsGPFInfo +{ +public: + +std::string cksType; //!< Checksum type or empty if none wanted +std::string cksValue; //!< Checksum value as ASCII hexdecimal string +std::string src; //!< Source getFile: URL putFile: path +std::string srcCgi; //!< Source cgi or empty if none +std::string dst; //!< Destination getFile: path putFile: URL +std::string dstCgi; //!< Destination cgi or empty if none. +const char *tident; //!< Trace identifier +void *rsvd1; //!< Reserved for future use +uint16_t options; //!< Processing options +uint16_t rsvd2; //!< Reserved for future use. +uint8_t pingsec; //!< Seconds between calls to Update() (0 -> no calls) +uint8_t sources; //!< Number of parallel sources (0 -> default) +uint8_t streams; //!< Number of parallel streams (0 -> default) +uint8_t rsvd3; //!< Reserved for future use. + +//------------------------------------------------------------------------------ +//! Possible options. +//------------------------------------------------------------------------------ + +static const uint16_t Keep = 0x0001; //!< Do not remove file upon failure. +static const uint16_t Replace = 0x0002; //