XRootD
XrdFrmCns Class Reference

#include <XrdFrmCns.hh>

+ Collaboration diagram for XrdFrmCns:

Public Member Functions

 XrdFrmCns ()
 
 ~XrdFrmCns ()
 

Static Public Member Functions

static void Add (const char *tID, const char *Path, long long Size, mode_t Mode)
 
static int Init (const char *aPath, int Opts)
 
static int Init (const char *myID, const char *aPath, const char *iName)
 
static void Rm (const char *Path, int islfn=0)
 
static void Rmd (const char *Path, int islfn=0)
 

Static Public Attributes

static const int cnsAuto = -1
 
static const int cnsIgnore = 0
 
static const int cnsRequire = 1
 

Detailed Description

Definition at line 36 of file XrdFrmCns.hh.

Constructor & Destructor Documentation

◆ XrdFrmCns()

XrdFrmCns::XrdFrmCns ( )
inline

Definition at line 59 of file XrdFrmCns.hh.

59 {}

◆ ~XrdFrmCns()

XrdFrmCns::~XrdFrmCns ( )
inline

Definition at line 60 of file XrdFrmCns.hh.

60 {}

Member Function Documentation

◆ Add()

void XrdFrmCns::Add ( const char *  tID,
const char *  Path,
long long  Size,
mode_t  Mode 
)
static

Definition at line 67 of file XrdFrmCns.cc.

69 {
70  static const int mMask = S_IRWXU|S_IRWXG|S_IRWXO;
71  static char NewLine = '\n';
72  struct iovec iov[9];
73  char mBuff[8], sBuff[24];
74 
75 // Check if there is a cns here and we should initialize it
76 //
77  if (!cnsMode) return;
78  if (cnsInit && !Init())
79  {Say.Emsg("FrmCns", "Auto-ignore cnsd create", Path); return;}
80 
81 // Fill out the io vector
82 //
83  iov[0].iov_base = (char *)tID;
84  iov[0].iov_len = strlen(tID);
85  iov[1].iov_base = (char *)" create ";
86  iov[1].iov_len = 8;
87  iov[2].iov_base = mBuff;
88  iov[2].iov_len = sprintf(mBuff, "%3o ", Mode&mMask);
89  iov[3].iov_base = (char *)Path;
90  iov[3].iov_len = strlen(Path);
91  iov[4].iov_base = &NewLine;
92  iov[4].iov_len = 1;
93  iov[5] = iov[0];
94  iov[6].iov_base = (char *)" closew ";
95  iov[6].iov_len = 8;
96  iov[7] = iov[3];
97  iov[8].iov_base = sBuff;
98  iov[8].iov_len = sprintf(sBuff, " %lld\n", Size);
99 
100 // Send this off to the cnsd
101 //
102  if (!Send2Cnsd(iov, 9)) Say.Emsg("FrmCns", "Auto-ignore cnsd create", Path);
103 }
int Mode
XrdOucString Path
static int Init(const char *aPath, int Opts)
Definition: XrdFrmCns.cc:167
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError Say

References XrdSysError::Emsg(), Mode, Path, and XrdFrc::Say.

+ Here is the call graph for this function:

◆ Init() [1/2]

int XrdFrmCns::Init ( const char *  aPath,
int  Opts 
)
static

Definition at line 167 of file XrdFrmCns.cc.

168 {
169  int rc;
170 
171  if (aPath && (rc = setPath(aPath, 0))) return rc;
172  cnsMode = Opts;
173  return 0;
174 }
int Opts
Definition: XrdMpxStats.cc:58

References Init(), and XrdMpx::Opts.

Referenced by Init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Init() [2/2]

int XrdFrmCns::Init ( const char *  myID,
const char *  aPath,
const char *  iName 
)
static

Definition at line 178 of file XrdFrmCns.cc.

179 {
180  char buff[2048];
181  int rc;
182 
183 // If we are ignoring the cns then don't bother with this
184 //
185  if (!cnsMode) return 0;
186 
187 // Construct the path to he cns events file (we know buff is large enough)
188 //
189  if (!cnsPath && (rc = setPath(aPath, iName))) return rc;
190 
191 // Create a static headers for deletes
192 //
193  cnsHdrLen = sprintf(buff, "%s.%d.0@localhost rmdir ", myID, getpid());
194  cnsHdr[HdrRmd] = strdup(buff);
195  sprintf(buff, "%s.%d.0@localhost rm ", myID, getpid());
196  cnsHdr[HdrRmf] = strdup(buff);
197 
198 // All done
199 //
200  return 0;
201 }

References Init().

+ Here is the call graph for this function:

◆ Rm()

static void XrdFrmCns::Rm ( const char *  Path,
int  islfn = 0 
)
inlinestatic

Definition at line 53 of file XrdFrmCns.hh.

54  {if (cnsMode) Del(Path, HdrRmf, islfn);}

References Path.

◆ Rmd()

static void XrdFrmCns::Rmd ( const char *  Path,
int  islfn = 0 
)
inlinestatic

Definition at line 56 of file XrdFrmCns.hh.

57  {if (cnsMode) Del(Path, HdrRmd, islfn);}

References Path.

Referenced by XrdFrmPurgeDir::isEmpty().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cnsAuto

const int XrdFrmCns::cnsAuto = -1
static

Definition at line 43 of file XrdFrmCns.hh.

◆ cnsIgnore

const int XrdFrmCns::cnsIgnore = 0
static

Definition at line 45 of file XrdFrmCns.hh.

◆ cnsRequire

const int XrdFrmCns::cnsRequire = 1
static

Definition at line 47 of file XrdFrmCns.hh.


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