LCOV - code coverage report
Current view: top level - src - txdb.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 2 2 100.0 %
Date: 2015-10-12 22:39:14 Functions: 1 3 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2014 The Bitcoin Core developers
       3             : // Distributed under the MIT software license, see the accompanying
       4             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5             : 
       6             : #ifndef BITCOIN_TXDB_H
       7             : #define BITCOIN_TXDB_H
       8             : 
       9             : #include "coins.h"
      10             : #include "leveldbwrapper.h"
      11             : 
      12             : #include <map>
      13             : #include <string>
      14             : #include <utility>
      15             : #include <vector>
      16             : 
      17             : class CBlockFileInfo;
      18             : class CBlockIndex;
      19             : struct CDiskTxPos;
      20             : class uint256;
      21             : 
      22             : //! -dbcache default (MiB)
      23             : static const int64_t nDefaultDbCache = 100;
      24             : //! max. -dbcache in (MiB)
      25             : static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 16384 : 1024;
      26             : //! min. -dbcache in (MiB)
      27             : static const int64_t nMinDbCache = 4;
      28             : 
      29             : /** CCoinsView backed by the LevelDB coin database (chainstate/) */
      30         238 : class CCoinsViewDB : public CCoinsView
      31             : {
      32             : protected:
      33             :     CLevelDBWrapper db;
      34             : public:
      35             :     CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
      36             : 
      37             :     bool GetCoins(const uint256 &txid, CCoins &coins) const;
      38             :     bool HaveCoins(const uint256 &txid) const;
      39             :     uint256 GetBestBlock() const;
      40             :     bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
      41             :     bool GetStats(CCoinsStats &stats) const;
      42             : };
      43             : 
      44             : /** Access to the block database (blocks/index/) */
      45         119 : class CBlockTreeDB : public CLevelDBWrapper
      46             : {
      47             : public:
      48             :     CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
      49             : private:
      50             :     CBlockTreeDB(const CBlockTreeDB&);
      51             :     void operator=(const CBlockTreeDB&);
      52             : public:
      53             :     bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
      54             :     bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
      55             :     bool ReadLastBlockFile(int &nFile);
      56             :     bool WriteReindexing(bool fReindex);
      57             :     bool ReadReindexing(bool &fReindex);
      58             :     bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos);
      59             :     bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list);
      60             :     bool WriteFlag(const std::string &name, bool fValue);
      61             :     bool ReadFlag(const std::string &name, bool &fValue);
      62             :     bool LoadBlockIndexGuts();
      63             : };
      64             : 
      65             : #endif // BITCOIN_TXDB_H

Generated by: LCOV version 1.11