X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Ferasure-code%2Flrc%2FErasureCodeLrc.h;fp=src%2Fceph%2Fsrc%2Ferasure-code%2Flrc%2FErasureCodeLrc.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=3cd6c849e08f7776d31e1497fcf7f8d91d6f5769;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/erasure-code/lrc/ErasureCodeLrc.h b/src/ceph/src/erasure-code/lrc/ErasureCodeLrc.h deleted file mode 100644 index 3cd6c84..0000000 --- a/src/ceph/src/erasure-code/lrc/ErasureCodeLrc.h +++ /dev/null @@ -1,138 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2014 Cloudwatt - * Copyright (C) 2014 Red Hat - * - * Author: Loic Dachary - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - */ - -#ifndef CEPH_ERASURE_CODE_LRC_H -#define CEPH_ERASURE_CODE_LRC_H - -#include "include/err.h" -#include "json_spirit/json_spirit.h" -#include "erasure-code/ErasureCode.h" - -#define ERROR_LRC_ARRAY -(MAX_ERRNO + 1) -#define ERROR_LRC_OBJECT -(MAX_ERRNO + 2) -#define ERROR_LRC_INT -(MAX_ERRNO + 3) -#define ERROR_LRC_STR -(MAX_ERRNO + 4) -#define ERROR_LRC_PLUGIN -(MAX_ERRNO + 5) -#define ERROR_LRC_DESCRIPTION -(MAX_ERRNO + 6) -#define ERROR_LRC_PARSE_JSON -(MAX_ERRNO + 7) -#define ERROR_LRC_MAPPING -(MAX_ERRNO + 8) -#define ERROR_LRC_MAPPING_SIZE -(MAX_ERRNO + 9) -#define ERROR_LRC_FIRST_MAPPING -(MAX_ERRNO + 10) -#define ERROR_LRC_COUNT_CONSTRAINT -(MAX_ERRNO + 11) -#define ERROR_LRC_CONFIG_OPTIONS -(MAX_ERRNO + 12) -#define ERROR_LRC_LAYERS_COUNT -(MAX_ERRNO + 13) -#define ERROR_LRC_RULE_OP -(MAX_ERRNO + 14) -#define ERROR_LRC_RULE_TYPE -(MAX_ERRNO + 15) -#define ERROR_LRC_RULE_N -(MAX_ERRNO + 16) -#define ERROR_LRC_ALL_OR_NOTHING -(MAX_ERRNO + 17) -#define ERROR_LRC_GENERATED -(MAX_ERRNO + 18) -#define ERROR_LRC_K_M_MODULO -(MAX_ERRNO + 19) -#define ERROR_LRC_K_MODULO -(MAX_ERRNO + 20) -#define ERROR_LRC_M_MODULO -(MAX_ERRNO + 21) - -class ErasureCodeLrc : public ErasureCode { -public: - static const std::string DEFAULT_KML; - - struct Layer { - explicit Layer(std::string _chunks_map) : chunks_map(_chunks_map) { } - ErasureCodeInterfaceRef erasure_code; - std::vector data; - std::vector coding; - std::vector chunks; - std::set chunks_as_set; - std::string chunks_map; - ErasureCodeProfile profile; - }; - std::vector layers; - std::string directory; - unsigned int chunk_count; - unsigned int data_chunk_count; - std::string rule_root; - std::string rule_device_class; - struct Step { - Step(std::string _op, std::string _type, int _n) : - op(_op), - type(_type), - n(_n) {} - std::string op; - std::string type; - int n; - }; - std::vector rule_steps; - - explicit ErasureCodeLrc(const std::string &dir) - : directory(dir), - chunk_count(0), data_chunk_count(0), rule_root("default") - { - rule_steps.push_back(Step("chooseleaf", "host", 0)); - } - - ~ErasureCodeLrc() override {} - - std::set get_erasures(const std::set &need, - const std::set &available) const; - - int minimum_to_decode(const std::set &want_to_read, - const std::set &available, - std::set *minimum) override; - - int create_rule(const std::string &name, - CrushWrapper &crush, - std::ostream *ss) const override; - - unsigned int get_chunk_count() const override { - return chunk_count; - } - - unsigned int get_data_chunk_count() const override { - return data_chunk_count; - } - - unsigned int get_chunk_size(unsigned int object_size) const override; - - int encode_chunks(const std::set &want_to_encode, - std::map *encoded) override; - - int decode_chunks(const std::set &want_to_read, - const std::map &chunks, - std::map *decoded) override; - - int init(ErasureCodeProfile &profile, std::ostream *ss) override; - - virtual int parse(ErasureCodeProfile &profile, std::ostream *ss); - - int parse_kml(ErasureCodeProfile &profile, std::ostream *ss); - - int parse_rule(ErasureCodeProfile &profile, std::ostream *ss); - - int parse_rule_step(std::string description_string, - json_spirit::mArray description, - std::ostream *ss); - - int layers_description(const ErasureCodeProfile &profile, - json_spirit::mArray *description, - std::ostream *ss) const; - int layers_parse(std::string description_string, - json_spirit::mArray description, - std::ostream *ss); - int layers_init(std::ostream *ss); - int layers_sanity_checks(std::string description_string, - std::ostream *ss) const; -}; - -#endif