XRootD
XrdEc Namespace Reference

Classes

struct  block_t
 
class  BufferPool
 Pool of buffer for caching writes. More...
 
class  Config
 Global configuration for the EC module. More...
 
class  Convert
 
class  IOError
 Generic I/O exception, wraps up XrdCl::XRootDStatus (. More...
 
struct  ObjCfg
 
class  OpenOnlyImpl
 
class  Reader
 
class  RedundancyProvider
 
class  ResponseJob
 
struct  stripe_t
 A buffer with stripe data and info on validity. More...
 
class  StrmWriter
 
struct  sync_queue
 
class  ThreadPool
 
class  WrtBuff
 

Typedefs

typedef std::vector< char > buffer_t
 a buffer type More...
 
typedef std::function< void(const XrdCl::XRootDStatus &, uint32_t)> callback_t
 
typedef std::vector< stripe_tstripes_t
 All stripes in a block. More...
 

Functions

static size_t fntoblk (const std::string &fn)
 
static int gf_gen_decode_matrix (unsigned char *encode_matrix, unsigned char *decode_matrix, unsigned int *decode_index, unsigned char *src_err_list, unsigned char *src_in_err, unsigned int nerrs, unsigned int nsrcerrs, unsigned int k, unsigned int m)
 
static uint32_t isal_crc32 (uint32_t crc, void const *buf, size_t len)
 ISAL crc32 implementation. More...
 
OpenOnlyImpl< false > OpenOnly (XrdCl::Ctx< XrdCl::ZipArchive > zip, XrdCl::Arg< std::string > fn, XrdCl::Arg< bool > updt, uint16_t timeout=0)
 
void ScheduleHandler (uint64_t offset, uint32_t size, void *buffer, XrdCl::ResponseHandler *handler)
 
void ScheduleHandler (XrdCl::ResponseHandler *handler, const XrdCl::XRootDStatus &st)
 

Variables

static const std::string ObjStr = "obj"
 

Typedef Documentation

◆ buffer_t

typedef std::vector< char > XrdEc::buffer_t

a buffer type

Definition at line 49 of file XrdEcReader.hh.

◆ callback_t

typedef std::function<void( const XrdCl::XRootDStatus&, uint32_t )> XrdEc::callback_t

Definition at line 53 of file XrdEcReader.hh.

◆ stripes_t

typedef std::vector<stripe_t> XrdEc::stripes_t

All stripes in a block.

Definition at line 64 of file XrdEcUtilities.hh.

Function Documentation

◆ fntoblk()

static size_t XrdEc::fntoblk ( const std::string &  fn)
inlinestatic

Definition at line 251 of file XrdEcUtilities.hh.

252  {
253  size_t end = fn.rfind( '.' );
254  size_t begin = fn.rfind( '.', end - 1 ) + 1;
255  size_t len = end - begin;
256  return std::stoul( fn.substr( begin, len ) );
257  }

Referenced by XrdEc::Reader::Open().

+ Here is the caller graph for this function:

◆ gf_gen_decode_matrix()

static int XrdEc::gf_gen_decode_matrix ( unsigned char *  encode_matrix,
unsigned char *  decode_matrix,
unsigned int *  decode_index,
unsigned char *  src_err_list,
unsigned char *  src_in_err,
unsigned int  nerrs,
unsigned int  nsrcerrs,
unsigned int  k,
unsigned int  m 
)
static

Definition at line 73 of file XrdEcRedundancyProvider.cc.

84 {
85  unsigned i, j, p;
86  unsigned int r;
87  unsigned char* invert_matrix, * backup, * b, s;
88  int incr = 0;
89 
90  size_t mk = (size_t)m * (size_t)k;
91  std::vector<unsigned char> memory(3 * mk);
92  b = &memory[0];
93  backup = &memory[mk];
94  invert_matrix = &memory[2 * mk];
95 
96  // Construct matrix b by removing error rows
97  for (i = 0, r = 0; i < k; i++, r++) {
98  while (src_in_err[r]) {
99  r++;
100  }
101  for (j = 0; j < k; j++) {
102  b[k * i + j] = encode_matrix[k * r + j];
103  backup[k * i + j] = encode_matrix[k * r + j];
104  }
105  decode_index[i] = r;
106  }
107  incr = 0;
108  while (gf_invert_matrix(b, invert_matrix, k) < 0) {
109  if (nerrs == (m - k)) {
110  return -1;
111  }
112  incr++;
113  memcpy(b, backup, mk);
114  for (i = nsrcerrs; i < nerrs - nsrcerrs; i++) {
115  if (src_err_list[i] == (decode_index[k - 1] + incr)) {
116  // skip the erased parity line
117  incr++;
118  continue;
119  }
120  }
121  if (decode_index[k - 1] + incr >= m) {
122  return -1;
123  }
124  decode_index[k - 1] += incr;
125  for (j = 0; j < k; j++) {
126  b[k * (k - 1) + j] = encode_matrix[k * decode_index[k - 1] + j];
127  }
128 
129  };
130 
131  for (i = 0; i < nsrcerrs; i++) {
132  for (j = 0; j < k; j++) {
133  decode_matrix[k * i + j] = invert_matrix[k * src_err_list[i] + j];
134  }
135  }
136  /* src_err_list from encode_matrix * invert of b for parity decoding */
137  for (p = nsrcerrs; p < nerrs; p++) {
138  for (i = 0; i < k; i++) {
139  s = 0;
140  for (j = 0; j < k; j++) {
141  s ^= gf_mul(invert_matrix[j * k + i],
142  encode_matrix[k * src_err_list[p] + j]);
143  }
144 
145  decode_matrix[k * p + i] = s;
146  }
147  }
148  return 0;
149 }

◆ isal_crc32()

static uint32_t XrdEc::isal_crc32 ( uint32_t  crc,
void const *  buf,
size_t  len 
)
inlinestatic

ISAL crc32 implementation.

Definition at line 26 of file XrdEcObjCfg.hh.

27  {
28  const unsigned char* buffer = reinterpret_cast<const unsigned char*>( buf );
29  return crc32_gzip_refl( crc, buffer, len );
30  }

Referenced by XrdEc::ObjCfg::ObjCfg().

+ Here is the caller graph for this function:

◆ OpenOnly()

OpenOnlyImpl<false> XrdEc::OpenOnly ( XrdCl::Ctx< XrdCl::ZipArchive zip,
XrdCl::Arg< std::string >  fn,
XrdCl::Arg< bool >  updt,
uint16_t  timeout = 0 
)
inline

Definition at line 105 of file XrdEcReader.cc.

109  {
110  return OpenOnlyImpl<false>( std::move( zip ), std::move( fn ),
111  std::move( updt ) ).Timeout( timeout );
112  }

References XrdCl::ConcreteOperation< Derived, HasHndl, HdlrFactory, Args >::Timeout().

Referenced by XrdEc::Reader::Open().

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

◆ ScheduleHandler() [1/2]

void XrdEc::ScheduleHandler ( uint64_t  offset,
uint32_t  size,
void *  buffer,
XrdCl::ResponseHandler handler 
)

A utility function for scheduling read operation handler

Parameters
offset: offset of the read
size: number of bytes read
buffer: buffer with the data read
handler: user callback

Definition at line 64 of file XrdEcUtilities.cc.

65  {
66  if( !handler ) return;
67 
68  XrdCl::ChunkInfo *chunk = new XrdCl::ChunkInfo();
69  chunk->offset = offset;
70  chunk->length = size;
71  chunk->buffer = buffer;
72 
73  XrdCl::AnyObject *resp = new XrdCl::AnyObject();
74  resp->Set( chunk );
75 
76  ResponseJob *job = new ResponseJob( handler, new XrdCl::XRootDStatus(), resp );
78  }
void Set(Type object, bool own=true)
static PostMaster * GetPostMaster()
Get default post master.
void QueueJob(Job *job, void *arg=0)
Add a job to be run.
JobManager * GetJobManager()
Get the job manager object user by the post master.
Describe a data chunk for vector read.
void * buffer
length of the chunk
uint32_t length
offset in the file

References XrdCl::ChunkInfo::buffer, XrdCl::PostMaster::GetJobManager(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::ChunkInfo::length, XrdCl::ChunkInfo::offset, XrdCl::JobManager::QueueJob(), and XrdCl::AnyObject::Set().

Referenced by XrdEc::Reader::Close(), XrdEc::StrmWriter::Close(), XrdEc::Reader::Read(), and XrdEc::StrmWriter::Write().

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

◆ ScheduleHandler() [2/2]

void XrdEc::ScheduleHandler ( XrdCl::ResponseHandler handler,
const XrdCl::XRootDStatus st = XrdCl::XRootDStatus() 
)

A utility function for scheduling an operation handler

Parameters
handler: user callback
st: operation status

Definition at line 83 of file XrdEcUtilities.cc.

84  {
85  if( !handler ) return;
86 
87  ResponseJob *job = new ResponseJob( handler, new XrdCl::XRootDStatus( st ), 0 );
89  }

References XrdCl::PostMaster::GetJobManager(), XrdCl::DefaultEnv::GetPostMaster(), and XrdCl::JobManager::QueueJob().

+ Here is the call graph for this function:

Variable Documentation

◆ ObjStr

const std::string XrdEc::ObjStr = "obj"
static

Definition at line 32 of file XrdEcObjCfg.hh.

Referenced by XrdEc::ObjCfg::GetFileName().