XRootD
XrdOssMirage Class Reference

#include <XrdOssMirage.hh>

+ Inheritance diagram for XrdOssMirage:
+ Collaboration diagram for XrdOssMirage:

Public Member Functions

 XrdOssMirage ()=default
 
virtual ~XrdOssMirage ()=default
 
virtual int Chmod (const char *path, mode_t mode, XrdOucEnv *envP=0) override
 
virtual int Create (const char *tid, const char *path, mode_t mode, XrdOucEnv &env, int opts=0) override
 
virtual uint64_t Features () override
 
std::optional< XrdOssMirageEntryget_entry_read (const char *path)
 
std::optional< XrdOssMirageEntryPtrget_entry_write (const char *path)
 
virtual int Init (XrdSysLogger *lp, const char *cfn) override
 
virtual int Mkdir (const char *path, mode_t mode, int mkpath=0, XrdOucEnv *envP=0) override
 
virtual XrdOssDFnewDir (const char *tident) override
 
virtual XrdOssDFnewFile (const char *tident) override
 
virtual int Remdir (const char *path, int Opts=0, XrdOucEnv *envP=0) override
 
virtual int Rename (const char *oPath, const char *nPath, XrdOucEnv *oEnvP=0, XrdOucEnv *nEnvP=0) override
 
virtual int Stat (const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0) override
 
virtual int Truncate (const char *path, unsigned long long fsize, XrdOucEnv *envP=0) override
 
virtual int Unlink (const char *path, int Opts=0, XrdOucEnv *envP=0) override
 
- Public Member Functions inherited from XrdOss
 XrdOss ()
 Constructor and Destructor. More...
 
virtual ~XrdOss ()
 
virtual void Connect (XrdOucEnv &env)
 
virtual void Disc (XrdOucEnv &env)
 
virtual void EnvInfo (XrdOucEnv *envP)
 
virtual int FSctl (int cmd, int alen, const char *args, char **resp=0)
 
virtual bool getErrMsg (std::string &eText)
 
virtual int Init (XrdSysLogger *lp, const char *cfn, XrdOucEnv *envP)
 
virtual int Lfn2Pfn (const char *Path, char *buff, int blen)
 
virtual const char * Lfn2Pfn (const char *Path, char *buff, int blen, int &rc)
 
virtual int Reloc (const char *tident, const char *path, const char *cgName, const char *anchor=0)
 
virtual int StatFS (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
 
virtual int StatPF (const char *path, struct stat *buff)
 
virtual int StatPF (const char *path, struct stat *buff, int opts)
 
virtual int Stats (char *buff, int blen)
 
virtual int StatVS (XrdOssVSInfo *vsP, const char *sname=0, int updt=0)
 
virtual int StatXA (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatXP (const char *path, unsigned long long &attr, XrdOucEnv *envP=0)
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOss
static const int PF_csVer = 0x00000001
 verified file checksums present More...
 
static const int PF_csVun = 0x00000002
 unverified file checksums present More...
 
static const int PF_dInfo = 0x00000001
 
static const int PF_dNums = 0x00000002
 
static const int PF_dStat = 0x00000008
 
static const int PF_isLFN = 0x00000004
 

Detailed Description

Definition at line 12 of file XrdOssMirage.hh.

Constructor & Destructor Documentation

◆ XrdOssMirage()

XrdOssMirage::XrdOssMirage ( )
default

◆ ~XrdOssMirage()

virtual XrdOssMirage::~XrdOssMirage ( )
virtualdefault

Member Function Documentation

◆ Chmod()

int XrdOssMirage::Chmod ( const char *  path,
mode_t  mode,
XrdOucEnv envP = 0 
)
overridevirtual

Change file mode settings.

Parameters
path- Pointer to the path of the file in question.
mode- The new file mode setting.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 29 of file XrdOssMirage.cc.

30 {
31  return -ENOTSUP;
32 }

◆ Create()

int XrdOssMirage::Create ( const char *  tid,
const char *  path,
mode_t  mode,
XrdOucEnv env,
int  opts = 0 
)
overridevirtual

Create file.

Parameters
tid- Pointer to the trace identifier.
path- Pointer to the path of the file to create.
mode- The new file mode setting.
env- Reference to environmental information.
opts- Create options: XRDOSS_coloc - Colocate file using the URL encoded path in env "oss.coloc" XRDOSS_mkpath - create dir path if it does not exist. XRDOSS_new - the file must not already exist. oflags<<8 - open flags shifted 8 bits to the left/
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 34 of file XrdOssMirage.cc.

35 {
36  const std::lock_guard lock(mutex);
37 
38  if (has_entry(path))
39  {
40  if (opts & XRDOSS_new)
41  return -EEXIST;
42 
43  if (is_entry_being_written(path))
44  return -EBUSY;
45  }
46 
47  // preserve previous configuration but reset the size in case it already exists
48  entries.try_emplace(path, std::make_shared<XrdOssMirageEntry>());
49  entries[path]->size = 0;
50 
51  static std::once_flag xattr_injection_flag;
52  std::call_once(xattr_injection_flag, [this]() noexcept
53  {
54  if (XrdOssMirageXAttr * const xattr = dynamic_cast<XrdOssMirageXAttr*>(XrdSysFAttr::Xat); xattr != nullptr)
55  xattr->setOss(*this);
56  });
57 
58  return XrdOssOK;
59 }
#define XrdOssOK
Definition: XrdOss.hh:54
#define XRDOSS_new
Definition: XrdOss.hh:527
struct myOpts opts
static XrdSysXAttr * Xat
Definition: XrdSysFAttr.hh:51

References opts, XrdSysFAttr::Xat, XRDOSS_new, and XrdOssOK.

◆ Features()

uint64_t XrdOssMirage::Features ( )
overridevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 61 of file XrdOssMirage.cc.

62 {
63  return XRDOSS_HASNAIO;
64 }
#define XRDOSS_HASNAIO
Definition: XrdOss.hh:541

References XRDOSS_HASNAIO.

◆ get_entry_read()

std::optional< XrdOssMirageEntry > XrdOssMirage::get_entry_read ( const char *  path)

Definition at line 137 of file XrdOssMirage.cc.

138 {
139  const std::lock_guard lock(mutex);
140 
141  if (!has_entry(path) || is_entry_being_written(path))
142  return {};
143 
144  return *entries[path];
145 }

Referenced by XrdOssMirageFile::Open().

+ Here is the caller graph for this function:

◆ get_entry_write()

std::optional< XrdOssMirageEntryPtr > XrdOssMirage::get_entry_write ( const char *  path)

Definition at line 147 of file XrdOssMirage.cc.

148 {
149  const std::lock_guard lock(mutex);
150 
151  if (!has_entry(path) || is_entry_being_written(path))
152  return {};
153 
154  return entries[path];
155 }

Referenced by XrdOssMirageFile::Open().

+ Here is the caller graph for this function:

◆ Init()

int XrdOssMirage::Init ( XrdSysLogger lp,
const char *  cfn 
)
overridevirtual

Initialize the storage system V1 (deprecated).

Parameters
lp- Pointer to the message logging object.
cfn- Pointer to the configuration file.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 66 of file XrdOssMirage.cc.

67 {
68  return XrdOssOK;
69 }

References XrdOssOK.

◆ Mkdir()

int XrdOssMirage::Mkdir ( const char *  path,
mode_t  mode,
int  mkpath = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Create a directory.

Parameters
path- Pointer to the path of the directory to be created.
mode- The directory mode setting.
mkpath- When true the path is created if it does not exist.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 71 of file XrdOssMirage.cc.

72 {
73  return -ENOTSUP;
74 }

◆ newDir()

XrdOssDF * XrdOssMirage::newDir ( const char *  tident)
overridevirtual

Obtain a new director object to be used for future directory requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to an XrdOssDF object.
nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 19 of file XrdOssMirage.cc.

20 {
21  return new XrdOssMirageDir;
22 }

◆ newFile()

XrdOssDF * XrdOssMirage::newFile ( const char *  tident)
overridevirtual

Obtain a new file object to be used for a future file requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to an XrdOssDF object.
nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 24 of file XrdOssMirage.cc.

25 {
26  return new XrdOssMirageFile(*this);
27 }

◆ Remdir()

int XrdOssMirage::Remdir ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Remove a directory.

Parameters
path- Pointer to the path of the directory to be removed.
Opts- The processing options: XRDOSS_Online - only remove online copy XRDOSS_isPFN - path is already translated.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 76 of file XrdOssMirage.cc.

77 {
78  return -ENOTSUP;
79 }

◆ Rename()

int XrdOssMirage::Rename ( const char *  oPath,
const char *  nPath,
XrdOucEnv oEnvP = 0,
XrdOucEnv nEnvP = 0 
)
overridevirtual

Rename a file or directory.

Parameters
oPath- Pointer to the path to be renamed.
nPath- Pointer to the path oPath is to have.
oEnvP- Environmental information for oPath.
nEnvP- Environmental information for nPath.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 81 of file XrdOssMirage.cc.

82 {
83  const std::lock_guard lock(mutex);
84 
85  if (!has_entry(oPath))
86  return -ENOENT;
87 
88  if (has_entry(nPath))
89  return -EEXIST;
90 
91  entries[nPath] = std::move(entries[oPath]);
92  entries.erase(oPath);
93 
94  return XrdOssOK;
95 }

References XrdOssOK.

◆ Stat()

int XrdOssMirage::Stat ( const char *  path,
struct stat buff,
int  opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Return state information on a file or directory.

Parameters
path- Pointer to the path in question.
buff- Pointer to the structure where info it to be returned.
opts- Options: XRDOSS_preop - this is a stat prior to open. XRDOSS_resonly - only look for resident files. XRDOSS_updtatm - update file access time.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 97 of file XrdOssMirage.cc.

98 {
99  const std::lock_guard lock(mutex);
100 
101  if (!has_entry(path))
102  return -ENOENT;
103 
104  *buff = {};
105  buff->st_size = entries[path]->size;
106 
107  return XrdOssOK;
108 }

References XrdOssOK.

◆ Truncate()

int XrdOssMirage::Truncate ( const char *  path,
unsigned long long  fsize,
XrdOucEnv envP = 0 
)
overridevirtual

Truncate a file.

Parameters
path- Pointer to the path of the file to be truncated.
fsize- The size that the file is to have.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 110 of file XrdOssMirage.cc.

111 {
112  const std::lock_guard lock(mutex);
113 
114  if (!has_entry(path))
115  return -ENOENT;
116 
117  if (is_entry_being_written(path))
118  return -EBUSY;
119 
120  entries[path]->size = fsize;
121 
122  return XrdOssOK;
123 }

References XrdOssOK.

◆ Unlink()

int XrdOssMirage::Unlink ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Remove a file.

Parameters
path- Pointer to the path of the file to be removed.
Opts- Options: XRDOSS_isMIG - this is a migratable path. XRDOSS_isPFN - do not apply name2name to path. XRDOSS_Online - remove only the online copy.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 125 of file XrdOssMirage.cc.

126 {
127  const std::lock_guard lock(mutex);
128 
129  if (!has_entry(path))
130  return -ENOENT;
131 
132  entries.erase(path);
133 
134  return XrdOssOK;
135 }

References XrdOssOK.


The documentation for this class was generated from the following files: