Loading...
Searching...
No Matches
XrdEcRedundancyProvider.hh
Go to the documentation of this file.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/************************************************************************
* KineticIo - a file io interface library to kinetic devices. *
* *
* This Source Code Form is subject to the terms of the Mozilla *
* Public License, v. 2.0. If a copy of the MPL was not *
* distributed with this file, You can obtain one at *
* https://mozilla.org/MP:/2.0/. *
* *
* This program is distributed in the hope that it will be useful, *
* but is provided AS-IS, WITHOUT ANY WARRANTY; including without *
* the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or *
* FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public *
* License for more details. *
************************************************************************/
#ifndef KINETICIO_REDUNDANCYPROVIDER_HH
#define KINETICIO_REDUNDANCYPROVIDER_HH
#include "XrdEc/XrdEcObjCfg.hh"
#include "XrdEc/XrdEcUtilities.hh"
#include <memory>
#include <vector>
#include <string>
#include <unordered_map>
#include <mutex>
namespace XrdEc
{
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
class RedundancyProvider {
public:
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
void compute( stripes_t &stripes );
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
RedundancyProvider( const ObjCfg &objcfg );
private:
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
struct CodingTable {
std::vector<unsigned char> table;
std::vector<unsigned int> blockIndices;
int nErrors;
};
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
std::string getErrorPattern( stripes_t &stripes ) const;
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
CodingTable& getCodingTable(
const std::string& pattern
);
private:
void replication( stripes_t &stripes );
ObjCfg objcfg;
std::vector<unsigned char> encode_matrix;
std::unordered_map<std::string, CodingTable> cache;
std::mutex mutex;
};
}
#endif /* ERASURECODING_HH */
XrdEcObjCfg.hh
XrdEcUtilities.hh
XrdEc::RedundancyProvider::RedundancyProvider
RedundancyProvider(const ObjCfg &objcfg)
Definition XrdEcRedundancyProvider.cc:151
XrdEc::RedundancyProvider::compute
void compute(stripes_t &stripes)
Definition XrdEcRedundancyProvider.cc:233
XrdEc
Definition XrdClZipArchive.hh:45
XrdEc::stripes_t
std::vector< stripe_t > stripes_t
All stripes in a block.
Definition XrdEcUtilities.hh:64
XrdEc::ObjCfg
Definition XrdEcObjCfg.hh:34