Bitcoin
Classes | Namespaces | Functions | Variables
blockfilterindex.cpp File Reference
#include <map>
#include <dbwrapper.h>
#include <index/blockfilterindex.h>
#include <util/system.h>
#include <validation.h>

Classes

struct  anonymous_namespace{blockfilterindex.cpp}::DBVal
 
struct  anonymous_namespace{blockfilterindex.cpp}::DBHeightKey
 
struct  anonymous_namespace{blockfilterindex.cpp}::DBHashKey
 

Namespaces

 anonymous_namespace{blockfilterindex.cpp}
 

Functions

static bool CopyHeightIndexToHashIndex (CDBIterator &db_it, CDBBatch &batch, const std::string &index_name, int start_height, int stop_height)
 
static bool LookupOne (const CDBWrapper &db, const CBlockIndex *block_index, DBVal &result)
 
static bool LookupRange (CDBWrapper &db, const std::string &index_name, int start_height, const CBlockIndex *stop_index, std::vector< DBVal > &results)
 
BlockFilterIndexGetBlockFilterIndex (BlockFilterType filter_type)
 
void ForEachBlockFilterIndex (std::function< void(BlockFilterIndex &)> fn)
 
bool InitBlockFilterIndex (BlockFilterType filter_type, size_t n_cache_size, bool f_memory, bool f_wipe)
 
bool DestroyBlockFilterIndex (BlockFilterType filter_type)
 
void DestroyAllBlockFilterIndexes ()
 

Variables

constexpr char DB_BLOCK_HASH = 's'
 
constexpr char DB_BLOCK_HEIGHT = 't'
 
constexpr char DB_FILTER_POS = 'P'
 
constexpr unsigned int MAX_FLTR_FILE_SIZE = 0x1000000
 
constexpr unsigned int FLTR_FILE_CHUNK_SIZE = 0x100000
 
static std::map< BlockFilterType, BlockFilterIndexg_filter_indexes
 

Function Documentation

◆ CopyHeightIndexToHashIndex()

static bool CopyHeightIndexToHashIndex ( CDBIterator db_it,
CDBBatch batch,
const std::string &  index_name,
int  start_height,
int  stop_height 
)
static

◆ DestroyAllBlockFilterIndexes()

void DestroyAllBlockFilterIndexes ( )

Destroy all open block filter indexes.

◆ DestroyBlockFilterIndex()

bool DestroyBlockFilterIndex ( BlockFilterType  filter_type)

Destroy the block filter index with the given type. Returns false if no such index exists. This just releases the allocated memory and closes the database connection, it does not delete the index data.

◆ ForEachBlockFilterIndex()

void ForEachBlockFilterIndex ( std::function< void(BlockFilterIndex &)>  fn)

Iterate over all running block filter indexes, invoking fn on each.

◆ GetBlockFilterIndex()

BlockFilterIndex* GetBlockFilterIndex ( BlockFilterType  filter_type)

Get a block filter index by type. Returns nullptr if index has not been initialized or was already destroyed.

◆ InitBlockFilterIndex()

bool InitBlockFilterIndex ( BlockFilterType  filter_type,
size_t  n_cache_size,
bool  f_memory = false,
bool  f_wipe = false 
)

Initialize a block filter index for the given type if one does not already exist. Returns true if a new index is created and false if one has already been initialized.

◆ LookupOne()

static bool LookupOne ( const CDBWrapper db,
const CBlockIndex block_index,
DBVal &  result 
)
static

◆ LookupRange()

static bool LookupRange ( CDBWrapper db,
const std::string &  index_name,
int  start_height,
const CBlockIndex stop_index,
std::vector< DBVal > &  results 
)
static

Variable Documentation

◆ DB_BLOCK_HASH

constexpr char DB_BLOCK_HASH = 's'

◆ DB_BLOCK_HEIGHT

constexpr char DB_BLOCK_HEIGHT = 't'

◆ DB_FILTER_POS

constexpr char DB_FILTER_POS = 'P'

◆ FLTR_FILE_CHUNK_SIZE

constexpr unsigned int FLTR_FILE_CHUNK_SIZE = 0x100000

The pre-allocation chunk size for fltr?????.dat files

◆ g_filter_indexes

std::map<BlockFilterType, BlockFilterIndex> g_filter_indexes
static

◆ MAX_FLTR_FILE_SIZE

constexpr unsigned int MAX_FLTR_FILE_SIZE = 0x1000000