Electroneum
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
cryptonote::block_queue Class Reference

#include <block_queue.h>

Classes

struct  span
 

Public Types

typedef std::set< spanblock_map
 

Public Member Functions

void add_blocks (uint64_t height, std::vector< cryptonote::block_complete_entry > bcel, const boost::uuids::uuid &connection_id, float rate, size_t size)
 
void add_blocks (uint64_t height, uint64_t nblocks, const boost::uuids::uuid &connection_id, boost::posix_time::ptime time=boost::date_time::min_date_time)
 
void flush_spans (const boost::uuids::uuid &connection_id, bool all=false)
 
void flush_stale_spans (const std::set< boost::uuids::uuid > &live_connections)
 
bool remove_span (uint64_t start_block_height, std::vector< crypto::hash > *hashes=NULL)
 
void remove_spans (const boost::uuids::uuid &connection_id, uint64_t start_block_height)
 
uint64_t get_max_block_height () const
 
void print () const
 
std::string get_overview (uint64_t blockchain_height) const
 
bool has_unpruned_height (uint64_t block_height, uint64_t blockchain_height, uint32_t pruning_seed) const
 
std::pair< uint64_t, uint64_t > reserve_span (uint64_t first_block_height, uint64_t last_block_height, uint64_t max_blocks, const boost::uuids::uuid &connection_id, uint32_t pruning_seed, uint64_t blockchain_height, const std::vector< crypto::hash > &block_hashes, boost::posix_time::ptime time=boost::posix_time::microsec_clock::universal_time())
 
uint64_t get_next_needed_height (uint64_t blockchain_height) const
 
std::pair< uint64_t, uint64_t > get_next_span_if_scheduled (std::vector< crypto::hash > &hashes, boost::uuids::uuid &connection_id, boost::posix_time::ptime &time) const
 
void reset_next_span_time (boost::posix_time::ptime t=boost::posix_time::microsec_clock::universal_time())
 
void set_span_hashes (uint64_t start_height, const boost::uuids::uuid &connection_id, std::vector< crypto::hash > hashes)
 
bool get_next_span (uint64_t &height, std::vector< cryptonote::block_complete_entry > &bcel, boost::uuids::uuid &connection_id, bool filled=true) const
 
bool has_next_span (const boost::uuids::uuid &connection_id, bool &filled, boost::posix_time::ptime &time) const
 
bool has_next_span (uint64_t height, bool &filled, boost::posix_time::ptime &time, boost::uuids::uuid &connection_id) const
 
size_t get_data_size () const
 
size_t get_num_filled_spans_prefix () const
 
size_t get_num_filled_spans () const
 
crypto::hash get_last_known_hash (const boost::uuids::uuid &connection_id) const
 
bool has_spans (const boost::uuids::uuid &connection_id) const
 
float get_speed (const boost::uuids::uuid &connection_id) const
 
float get_download_rate (const boost::uuids::uuid &connection_id) const
 
bool foreach (std::function< bool(const span &)> f) const
 
bool requested (const crypto::hash &hash) const
 
bool have (const crypto::hash &hash) const
 

Private Member Functions

void erase_block (block_map::iterator j)
 
bool requested_internal (const crypto::hash &hash) const
 

Private Attributes

block_map blocks
 
boost::recursive_mutex mutex
 
std::unordered_set< crypto::hashrequested_hashes
 
std::unordered_set< crypto::hashhave_blocks
 

Member Typedef Documentation

◆ block_map

Member Function Documentation

◆ add_blocks() [1/2]

void cryptonote::block_queue::add_blocks ( uint64_t  height,
std::vector< cryptonote::block_complete_entry bcel,
const boost::uuids::uuid &  connection_id,
float  rate,
size_t  size 
)

◆ add_blocks() [2/2]

void cryptonote::block_queue::add_blocks ( uint64_t  height,
uint64_t  nblocks,
const boost::uuids::uuid &  connection_id,
boost::posix_time::ptime  time = boost::date_time::min_date_time 
)

◆ erase_block()

void cryptonote::block_queue::erase_block ( block_map::iterator  j)
private

◆ flush_spans()

void cryptonote::block_queue::flush_spans ( const boost::uuids::uuid &  connection_id,
bool  all = false 
)

◆ flush_stale_spans()

void cryptonote::block_queue::flush_stale_spans ( const std::set< boost::uuids::uuid > &  live_connections)

◆ foreach()

bool cryptonote::block_queue::foreach ( std::function< bool(const span &)>  f) const

◆ get_data_size()

size_t cryptonote::block_queue::get_data_size ( ) const

◆ get_download_rate()

float cryptonote::block_queue::get_download_rate ( const boost::uuids::uuid &  connection_id) const

◆ get_last_known_hash()

crypto::hash cryptonote::block_queue::get_last_known_hash ( const boost::uuids::uuid &  connection_id) const

◆ get_max_block_height()

uint64_t cryptonote::block_queue::get_max_block_height ( ) const

◆ get_next_needed_height()

uint64_t cryptonote::block_queue::get_next_needed_height ( uint64_t  blockchain_height) const

◆ get_next_span()

bool cryptonote::block_queue::get_next_span ( uint64_t &  height,
std::vector< cryptonote::block_complete_entry > &  bcel,
boost::uuids::uuid &  connection_id,
bool  filled = true 
) const

◆ get_next_span_if_scheduled()

std::pair< uint64_t, uint64_t > cryptonote::block_queue::get_next_span_if_scheduled ( std::vector< crypto::hash > &  hashes,
boost::uuids::uuid &  connection_id,
boost::posix_time::ptime &  time 
) const

◆ get_num_filled_spans()

size_t cryptonote::block_queue::get_num_filled_spans ( ) const

◆ get_num_filled_spans_prefix()

size_t cryptonote::block_queue::get_num_filled_spans_prefix ( ) const

◆ get_overview()

std::string cryptonote::block_queue::get_overview ( uint64_t  blockchain_height) const

◆ get_speed()

float cryptonote::block_queue::get_speed ( const boost::uuids::uuid &  connection_id) const

◆ has_next_span() [1/2]

bool cryptonote::block_queue::has_next_span ( const boost::uuids::uuid &  connection_id,
bool filled,
boost::posix_time::ptime &  time 
) const

◆ has_next_span() [2/2]

bool cryptonote::block_queue::has_next_span ( uint64_t  height,
bool filled,
boost::posix_time::ptime &  time,
boost::uuids::uuid &  connection_id 
) const

◆ has_spans()

bool cryptonote::block_queue::has_spans ( const boost::uuids::uuid &  connection_id) const

◆ has_unpruned_height()

bool cryptonote::block_queue::has_unpruned_height ( uint64_t  block_height,
uint64_t  blockchain_height,
uint32_t  pruning_seed 
) const

◆ have()

bool cryptonote::block_queue::have ( const crypto::hash hash) const

◆ print()

void cryptonote::block_queue::print ( ) const

◆ remove_span()

bool cryptonote::block_queue::remove_span ( uint64_t  start_block_height,
std::vector< crypto::hash > *  hashes = NULL 
)

◆ remove_spans()

void cryptonote::block_queue::remove_spans ( const boost::uuids::uuid &  connection_id,
uint64_t  start_block_height 
)

◆ requested()

bool cryptonote::block_queue::requested ( const crypto::hash hash) const

◆ requested_internal()

bool cryptonote::block_queue::requested_internal ( const crypto::hash hash) const
inlineprivate

◆ reserve_span()

std::pair< uint64_t, uint64_t > cryptonote::block_queue::reserve_span ( uint64_t  first_block_height,
uint64_t  last_block_height,
uint64_t  max_blocks,
const boost::uuids::uuid &  connection_id,
uint32_t  pruning_seed,
uint64_t  blockchain_height,
const std::vector< crypto::hash > &  block_hashes,
boost::posix_time::ptime  time = boost::posix_time::microsec_clock::universal_time() 
)

◆ reset_next_span_time()

void cryptonote::block_queue::reset_next_span_time ( boost::posix_time::ptime  t = boost::posix_time::microsec_clock::universal_time())

◆ set_span_hashes()

void cryptonote::block_queue::set_span_hashes ( uint64_t  start_height,
const boost::uuids::uuid &  connection_id,
std::vector< crypto::hash hashes 
)

Member Data Documentation

◆ blocks

block_map cryptonote::block_queue::blocks
private

◆ have_blocks

std::unordered_set<crypto::hash> cryptonote::block_queue::have_blocks
private

◆ mutex

boost::recursive_mutex cryptonote::block_queue::mutex
mutableprivate

◆ requested_hashes

std::unordered_set<crypto::hash> cryptonote::block_queue::requested_hashes
private

The documentation for this class was generated from the following files: