XRootD
XrdXrootdPgwFob Class Reference

#include <XrdXrootdPgwFob.hh>

+ Collaboration diagram for XrdXrootdPgwFob:

Public Member Functions

 XrdXrootdPgwFob (XrdXrootdFile *fP)
 
 ~XrdXrootdPgwFob ()
 
bool addOffs (kXR_int64 foffs, int dlen)
 
bool delOffs (kXR_int64 foffs, int dlen)
 
bool hasOffs (kXR_int64 foffs, int dlen)
 
int numOffs (int *errs=0, int *fixs=0)
 

Detailed Description

Definition at line 41 of file XrdXrootdPgwFob.hh.

Constructor & Destructor Documentation

◆ XrdXrootdPgwFob()

XrdXrootdPgwFob::XrdXrootdPgwFob ( XrdXrootdFile fP)
inline

Definition at line 77 of file XrdXrootdPgwFob.hh.

78  : fileP(fP), numErrs(0), numFixd(0) {}

◆ ~XrdXrootdPgwFob()

XrdXrootdPgwFob::~XrdXrootdPgwFob ( )

Definition at line 56 of file XrdXrootdPgwFob.cc.

57 {
58  int len, n = badOffs.size();
59 
60 // Write an error message if this file has any outstanding checksum errors
61 //
62  if (n)
63  {char buff[128];
64  snprintf(buff, sizeof(buff), "Warning! %d checksum error(s) in", n);
65  eLog.Emsg("PgwFob", buff, fileP->FileKey);
66  }
67 
68 // Check if we have anything to do and if we do, dump the list of bad checksums.
69 //
70  if (TRACING(TRACE_PGCS))
71  {const char *TraceID = "FileFob", *fname = fileP->FileKey;
72  if (n)
73  {XrdOucString lolist((1+4+1+13)*n);
74  char item[128];
75  kXR_int64 val;
76 
77  for (std::set<kXR_int64>::iterator it = badOffs.begin();
78  it != badOffs.end(); ++it)
79  {val = *it;
80  len = val & (XrdProto::kXR_pgPageSZ-1);
81  if (!len) len = XrdProto::kXR_pgPageSZ;
82  val = val >> XrdProto::kXR_pgPageBL;
83  snprintf(item, sizeof(item), " %d@%lld", len, val);
84  lolist += item;
85  }
86  TRACEI(PGCS,fname<<" had "<<numErrs<<" cksum errs and "<<numFixd
87  <<" fixes"<<"; areas in error:"<<lolist.c_str());
88  } else if (numErrs)
89  {TRACEI(PGCS,fname<<" had "<<numErrs<<" cksum errs and "
90  <<numFixd<<" fixes.");
91  }
92  }
93 }
long long kXR_int64
Definition: XPtypes.hh:98
#define TRACING(x)
Definition: XrdTrace.hh:70
#define TRACEI(act, x)
Definition: XrdTrace.hh:66
#define TRACE_PGCS
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError * eLog
static const int kXR_pgPageSZ
Definition: XProtocol.hh:494
static const int kXR_pgPageBL
Definition: XProtocol.hh:495

References XrdOucString::c_str(), XrdXrootd::eLog, XrdSysError::Emsg(), XrdProto::kXR_pgPageBL, XrdProto::kXR_pgPageSZ, TRACE_PGCS, TRACEI, and TRACING.

+ Here is the call graph for this function:

Member Function Documentation

◆ addOffs()

bool XrdXrootdPgwFob::addOffs ( kXR_int64  foffs,
int  dlen 
)
inline

Definition at line 46 of file XrdXrootdPgwFob.hh.

47  {XrdSysMutexHelper mHelp(fobMutex);
48  foffs = foffs << XrdProto::kXR_pgPageBL;
49  if (dlen < XrdProto::kXR_pgPageSZ) foffs |= dlen;
50  badOffs.insert(foffs);
51  numErrs++;
52  return badOffs.size() <= XrdProto::kXR_pgMaxEos;
53  }
static const int kXR_pgMaxEos
Definition: XProtocol.hh:498

References XrdProto::kXR_pgMaxEos, XrdProto::kXR_pgPageBL, and XrdProto::kXR_pgPageSZ.

Referenced by XrdXrootdPgwBadCS::boAdd().

+ Here is the caller graph for this function:

◆ delOffs()

bool XrdXrootdPgwFob::delOffs ( kXR_int64  foffs,
int  dlen 
)
inline

Definition at line 55 of file XrdXrootdPgwFob.hh.

56  {XrdSysMutexHelper mHelp(fobMutex);
57  foffs = foffs << XrdProto::kXR_pgPageBL;
58  if (dlen < XrdProto::kXR_pgPageSZ) foffs |= dlen;
59  numFixd++;
60  return badOffs.erase(foffs) != 0;
61  }

References XrdProto::kXR_pgPageBL, and XrdProto::kXR_pgPageSZ.

◆ hasOffs()

bool XrdXrootdPgwFob::hasOffs ( kXR_int64  foffs,
int  dlen 
)
inline

Definition at line 63 of file XrdXrootdPgwFob.hh.

64  {XrdSysMutexHelper mHelp(fobMutex);
65  foffs = foffs << XrdProto::kXR_pgPageBL;
66  if (dlen < XrdProto::kXR_pgPageSZ) foffs |= dlen;
67  return badOffs.find(foffs) != badOffs.end();
68  }

References XrdProto::kXR_pgPageBL, and XrdProto::kXR_pgPageSZ.

◆ numOffs()

int XrdXrootdPgwFob::numOffs ( int *  errs = 0,
int *  fixs = 0 
)
inline

Definition at line 70 of file XrdXrootdPgwFob.hh.

71  {XrdSysMutexHelper mHelp(fobMutex);
72  if (errs) *errs = numErrs;
73  if (fixs) *fixs = numFixd;
74  return badOffs.size();
75  }

Referenced by XrdXrootdPgwBadCS::boAdd().

+ Here is the caller graph for this function:

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