XRootD
XrdOssArcCompose.hh
Go to the documentation of this file.
1 #ifndef _XRDOSSARCCOMPOSE_H
2 #define _XRDOSSARCCOMPOSE_H
3 /******************************************************************************/
4 /* */
5 /* X r d O s s A r c C o m p o s e . h h */
6 /* */
7 /* (c) 2025 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <cstring>
34 #include <string>
35 
36 struct stat;
37 class XrdOucEnv;
38 
40 {
41 
42 public:
43 
44 std::string dsScope; // Dataset scope
45 std::string dsName; // Dataset name
46 std::string flScope; // File scope
47 std::string flName; // File name
48 std::string arName; // Archive filename
49 
50 enum pType {isARC=0, isBKP};
52 
53  int ArcMember(char* buff, int blen);
54 
55  int ArcPath(char* buff, int blen, bool addafn=false);
56 
57 static std::string Dir2DSN(const char* dir);
58 static std::string DSN2Dir(const char* dsn);
59 
60 static bool isArcFile(const char *path);
61 
62 static bool isArcPath(const char* path);
63 
64 static bool isBkpPath(const char* path);
65 
66 static bool isMine(const char *path);
67 
68 static int Stat(const char* Scope, const char* Name, struct stat* Stat);
69 
70  XrdOssArcCompose(const char *path, XrdOucEnv *env,
71  int& retc, bool isW=true, bool optfn=false);
72 
74 
75 private:
76 
77  int getDSN(const char* path);
78  int SetarName();
79 static int StatDecode(struct stat& Stat, const char* resp);
80 static bool StatGet(const char* var, XrdOucEnv& env, long long& val);
81 
82 static int minLenDSN;
83 static int minLenFN;
84 };
85 #endif
#define stat(a, b)
Definition: XrdPosix.hh:105
static bool isArcPath(const char *path)
static int Stat(const char *Scope, const char *Name, struct stat *Stat)
static bool isArcFile(const char *path)
XrdOssArcCompose(const char *path, XrdOucEnv *env, int &retc, bool isW=true, bool optfn=false)
static std::string Dir2DSN(const char *dir)
static std::string DSN2Dir(const char *dsn)
static bool isMine(const char *path)
static bool isBkpPath(const char *path)
int ArcMember(char *buff, int blen)
int ArcPath(char *buff, int blen, bool addafn=false)