Changeset View
Changeset View
Standalone View
Standalone View
src/index/base.h
// Copyright (c) 2017-2018 The Bitcoin Core developers | // Copyright (c) 2017-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_INDEX_BASE_H | #ifndef BITCOIN_INDEX_BASE_H | ||||
#define BITCOIN_INDEX_BASE_H | #define BITCOIN_INDEX_BASE_H | ||||
#include <dbwrapper.h> | #include <dbwrapper.h> | ||||
#include <primitives/block.h> | #include <primitives/block.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <threadinterrupt.h> | #include <threadinterrupt.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
class CBlockIndex; | class CBlockIndex; | ||||
struct IndexSummary { | |||||
std::string name; | |||||
bool synced{false}; | |||||
int best_block_height{0}; | |||||
}; | |||||
/** | /** | ||||
* Base class for indices of blockchain data. This implements | * Base class for indices of blockchain data. This implements | ||||
* CValidationInterface and ensures blocks are indexed sequentially according | * CValidationInterface and ensures blocks are indexed sequentially according | ||||
* to their position in the active chain. | * to their position in the active chain. | ||||
*/ | */ | ||||
class BaseIndex : public CValidationInterface { | class BaseIndex : public CValidationInterface { | ||||
protected: | protected: | ||||
class DB : public CDBWrapper { | class DB : public CDBWrapper { | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | public: | ||||
void Interrupt(); | void Interrupt(); | ||||
/// Start initializes the sync state and registers the instance as a | /// Start initializes the sync state and registers the instance as a | ||||
/// ValidationInterface so that it stays in sync with blockchain updates. | /// ValidationInterface so that it stays in sync with blockchain updates. | ||||
void Start(); | void Start(); | ||||
/// Stops the instance from staying in sync with blockchain updates. | /// Stops the instance from staying in sync with blockchain updates. | ||||
void Stop(); | void Stop(); | ||||
/// Get a summary of the index and its state. | |||||
IndexSummary GetSummary() const; | |||||
}; | }; | ||||
#endif // BITCOIN_INDEX_BASE_H | #endif // BITCOIN_INDEX_BASE_H |