Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-08 10:33:34

0001 #ifndef __XRDSSIRESOURCE_HH__
0002 #define __XRDSSIRESOURCE_HH__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                     X r d S s i R e s o u r c e . h h                      */
0006 /*                                                                            */
0007 /* (c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0009 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
0010 /*                                                                            */
0011 /* This file is part of the XRootD software suite.                            */
0012 /*                                                                            */
0013 /* XRootD is free software: you can redistribute it and/or modify it under    */
0014 /* the terms of the GNU Lesser General Public License as published by the     */
0015 /* Free Software Foundation, either version 3 of the License, or (at your     */
0016 /* option) any later version.                                                 */
0017 /*                                                                            */
0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0021 /* License for more details.                                                  */
0022 /*                                                                            */
0023 /* You should have received a copy of the GNU Lesser General Public License   */
0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0026 /*                                                                            */
0027 /* The copyright holder's institutional names and contributor's names may not */
0028 /* be used to endorse or promote products derived from this software without  */
0029 /* specific prior written permission of the institution or contributor.       */
0030 /******************************************************************************/
0031 
0032 #include <cstdint>
0033 #include <string>
0034   
0035 //-----------------------------------------------------------------------------
0036 //! The XrdSsiResource object is used by the Scalable Service Interface to
0037 //! describe the resource that a request needs in order to execute.
0038 //-----------------------------------------------------------------------------
0039 
0040 class XrdSsiEntity;
0041 
0042 class XrdSsiResource
0043 {
0044 public:
0045 
0046 std::string    rName;   //!< -> Name of the resource to be used
0047 std::string    rUser;   //!< -> Name of the resource user (nil if anonymous)
0048 std::string    rInfo;   //!< -> Additional information in CGI format
0049 std::string    hAvoid;  //!< -> Comma separated list of hosts to avoid
0050 XrdSsiEntity  *client;  //!< -> Pointer to client identification (server-side)
0051 
0052 enum Affinity {Default, //!< Use configured affinity
0053                None,    //!< Resource has no affinity, any endpoint will do
0054                Weak,    //!< Use resource on same node if possible, don't wait
0055                Strong,  //!< Use resource on same node even if wait required
0056                Strict   //!< Always use same node for resource no matter what
0057               };
0058 Affinity       affinity;//!< Resource affinity
0059 
0060 uint32_t       rOpts;   //!< Resource options. One or more of he following:
0061 static
0062 const uint32_t Reusable= 1;//!> Resource context may be cached and reused
0063 static
0064 const uint32_t Discard = 2;//!> Discard cached resource if it exists
0065 
0066 //-----------------------------------------------------------------------------
0067 //! Constructor
0068 //!
0069 //! @param  rname    the name of the resource. If using directory
0070 //!                  notation (i.e. slash separated names); duplicate slashes
0071 //!                  and dot-slashes are compressed out.
0072 //!
0073 //! @param  havoid   if not null then points to a comma separated list of
0074 //!                  hostnames to avoid when finding the resource. This
0075 //!                  argument is only meaningful client-side.
0076 //!
0077 //! @param  ruser    the name of the resource user. If nil the user is
0078 //!                  anonymous (unnamed). By default, all resources share
0079 //!                  the TCP connection to any endpoint. Different users have
0080 //!                  separate connections only if so requested vis the newConn
0081 //!                  option (see options above).
0082 //!
0083 //! @param  rinfo    additional information to be passed to the endpoint that
0084 //!                  that provides the resource. The string should be in cgi
0085 //!                  format (e.g. var=val&var2=val2&....).
0086 //!
0087 //! @param  raff     resource affinity (see Affinity enum).
0088 //!
0089 //! @param  ropts    resource handling options (see individual options)
0090 //-----------------------------------------------------------------------------
0091 
0092                XrdSsiResource(std::string rname,
0093                               std::string havoid="",
0094                               std::string ruser="",
0095                               std::string rinfo="",
0096                               uint32_t    ropts=0,
0097                               Affinity    raff=Default
0098                              ) : rName(rname), rUser(ruser), rInfo(rinfo),
0099                                  hAvoid(havoid), client(0), affinity(raff),
0100                                  rOpts(ropts) {}
0101 
0102 //-----------------------------------------------------------------------------
0103 //! Destructor
0104 //-----------------------------------------------------------------------------
0105 
0106               ~XrdSsiResource() {}
0107 };
0108 #endif