xrootd
Loading...
Searching...
No Matches
XrdEcRedundancyProvider.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
5//------------------------------------------------------------------------------
6
7/************************************************************************
8 * KineticIo - a file io interface library to kinetic devices. *
9 * *
10 * This Source Code Form is subject to the terms of the Mozilla *
11 * Public License, v. 2.0. If a copy of the MPL was not *
12 * distributed with this file, You can obtain one at *
13 * https://mozilla.org/MP:/2.0/. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but is provided AS-IS, WITHOUT ANY WARRANTY; including without *
17 * the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or *
18 * FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public *
19 * License for more details. *
20 ************************************************************************/
21
22#ifndef KINETICIO_REDUNDANCYPROVIDER_HH
23#define KINETICIO_REDUNDANCYPROVIDER_HH
24
25#include "XrdEc/XrdEcObjCfg.hh"
27
28#include <memory>
29#include <vector>
30#include <string>
31#include <unordered_map>
32#include <mutex>
33
34namespace XrdEc
35{
36 //------------------------------------------------------------------------------
40 //------------------------------------------------------------------------------
42 public:
43 //--------------------------------------------------------------------------
50 //--------------------------------------------------------------------------
51 void compute( stripes_t &stripes );
52
53 //--------------------------------------------------------------------------
57 //--------------------------------------------------------------------------
59
60 private:
61 //--------------------------------------------------------------------------
64 //--------------------------------------------------------------------------
65 struct CodingTable {
67 std::vector<unsigned char> table;
69 std::vector<unsigned int> blockIndices;
72 };
73
74 //--------------------------------------------------------------------------
83 //--------------------------------------------------------------------------
84 std::string getErrorPattern( stripes_t &stripes ) const;
85
86 //--------------------------------------------------------------------------
93 //--------------------------------------------------------------------------
95 const std::string& pattern
96 );
97
98 private:
99
100 void replication( stripes_t &stripes );
101
103
105 std::vector<unsigned char> encode_matrix;
107 std::unordered_map<std::string, CodingTable> cache;
109 std::mutex mutex;
110 };
111
112};
113
114#endif /* ERASURECODING_HH */
Definition XrdEcRedundancyProvider.hh:41
std::unordered_map< std::string, CodingTable > cache
a cache of previously used coding tables
Definition XrdEcRedundancyProvider.hh:107
std::vector< unsigned char > encode_matrix
the encoding matrix, required to compute any decode matrix
Definition XrdEcRedundancyProvider.hh:105
RedundancyProvider(const ObjCfg &objcfg)
void compute(stripes_t &stripes)
CodingTable & getCodingTable(const std::string &pattern)
std::string getErrorPattern(stripes_t &stripes) const
std::mutex mutex
concurrency control
Definition XrdEcRedundancyProvider.hh:109
void replication(stripes_t &stripes)
ObjCfg objcfg
Definition XrdEcRedundancyProvider.hh:102
Definition XrdClZipArchive.hh:45
std::vector< stripe_t > stripes_t
All stripes in a block.
Definition XrdEcUtilities.hh:64
Definition XrdEcObjCfg.hh:34
Definition XrdEcRedundancyProvider.hh:65
std::vector< unsigned char > table
the coding table
Definition XrdEcRedundancyProvider.hh:67
std::vector< unsigned int > blockIndices
array of nData size, containing stripe indices to input blocks
Definition XrdEcRedundancyProvider.hh:69
int nErrors
Number of errors this coding table is constructed for (maximum==nParity)
Definition XrdEcRedundancyProvider.hh:71