xrootd
XrdCpWorkLst.hh
Go to the documentation of this file.
00001 
00002 //                                                                      //
00003 // XrdCpWorkLst                                                         //
00004 //                                                                      //
00005 // Author: Fabrizio Furano (INFN Padova, 2004)                          //
00006 //                                                                      //
00007 // A class implementing a list of cp to do for XrdCp                    //
00008 //                                                                      //
00010 
00011 //   $Id$
00012 
00013 #include <sys/types.h>
00014 #include "XrdClient/XrdClientAdmin.hh"
00015 #include "XrdClient/XrdClient.hh"
00016 #include <stdint.h>
00017 
00018 class XrdSysDir;
00019 void PrintLastServerError(XrdClient *cli);
00020 bool PedanticOpen4Write(XrdClient *cli, kXR_unt16 mode, kXR_unt16 options);
00021 
00022 //------------------------------------------------------------------------------
00023 // Check if the opaque data provides the file size information and add it
00024 // if needed
00025 //------------------------------------------------------------------------------
00026 XrdOucString AddSizeHint( const char *dst, off_t size );
00027 
00028 class XrdCpWorkLst {
00029 
00030    vecString fWorkList;
00031    int fWorkIt;
00032    uint64_t pSourceSize;  // set if the source URL refers to a file
00033 
00034    XrdClientAdmin *xrda_src, *xrda_dst;
00035 
00036    XrdOucString fSrc, fDest;
00037    bool fDestIsDir, fSrcIsDir;
00038 
00039  public:
00040    
00041    XrdCpWorkLst();
00042    ~XrdCpWorkLst();
00043 
00044 
00045    // Sets the source path for the file copy
00046    int SetSrc(XrdClient **srccli, XrdOucString url,
00047               XrdOucString urlopaquedata, bool do_recurse);
00048 
00049    // Sets the destination of the file copy
00050    int SetDest(XrdClient **xrddest, const char *url,
00051                const char *urlopaquedata,
00052                kXR_unt16 xrdopenflags);
00053 
00054    inline void GetDest(XrdOucString &dest, bool& isdir) {
00055       dest = fDest;
00056       isdir = fDestIsDir;
00057    }
00058 
00059    inline void GetSrc(XrdOucString &src, bool& isdir) {
00060       src = fSrc;
00061       isdir = fSrcIsDir;
00062    }
00063 
00064 
00065    // Actually builds the worklist
00066    int BuildWorkList_xrd(XrdOucString url, XrdOucString opaquedata);
00067    int BuildWorkList_loc(XrdSysDir *dir, XrdOucString pat);
00068 
00069    bool GetCpJob(XrdOucString &src, XrdOucString &dest);
00070    
00071 };