github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/fs/ir_manager/ir_manager.h (about)

     1  // Copyright (C) 2018 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or
     6  // modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // the go-nebulas library is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with the go-nebulas library.  If not, see
    18  // <http://www.gnu.org/licenses/>.
    19  //
    20  
    21  #pragma once
    22  #include "common/address.h"
    23  #include "common/common.h"
    24  #include "core/net_ipc/nipc_pkg.h"
    25  #include "fs/ir_manager/ir_manager_helper.h"
    26  #include "util/wakeable_queue.h"
    27  
    28  namespace neb {
    29  namespace fs {
    30  
    31  class ir_manager {
    32  public:
    33    ir_manager();
    34    ~ir_manager();
    35    ir_manager(const ir_manager &im) = delete;
    36    ir_manager &operator=(const ir_manager &im) = delete;
    37  
    38    std::unique_ptr<nbre::NBREIR> read_ir(const std::string &name,
    39                                          version_t version);
    40    std::unique_ptr<std::vector<nbre::NBREIR>>
    41    read_irs(const std::string &name, block_height_t height, bool depends);
    42  
    43    void parse_irs(
    44        util::wakeable_queue<std::shared_ptr<nbre_ir_transactions_req>> &q_txs);
    45  
    46  private:
    47    void read_ir_depends(const std::string &name, version_t version,
    48                         block_height_t height, bool depends,
    49                         std::vector<nbre::NBREIR> &irs);
    50  
    51    void parse_next_block(block_height_t height,
    52                          const std::vector<std::string> &txs_seri);
    53    void parse_when_missing_block(block_height_t start_block,
    54                                  block_height_t end_height);
    55  
    56    void parse_irs_by_height(block_height_t height,
    57                             const std::vector<corepb::Transaction> &txs);
    58    void parse_with_height(block_height_t height,
    59                           const std::vector<corepb::Transaction> &txs);
    60  
    61    void deploy_if_dip(const std::string &name, version_t version,
    62                       block_height_t available_height);
    63  
    64  private:
    65    rocksdb_storage *m_storage;
    66    std::map<auth_key_t, auth_val_t> m_auth_table;
    67  };
    68  } // namespace fs
    69  } // namespace neb