Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fork_database.hpp
Go to the documentation of this file.
1#pragma once
3#include <boost/signals2/signal.hpp>
4
5namespace sysio { namespace chain {
6
7 using boost::signals2::signal;
8
9 struct fork_database_impl;
10
23 public:
24
25 explicit fork_database( const fc::path& data_dir );
27
28 void open( const std::function<void( block_timestamp_type,
29 const flat_set<digest_type>&,
30 const vector<digest_type>& )>& validator );
31 void close();
32
34 block_state_ptr get_block( const block_id_type& id )const;
35
40 void reset( const block_header_state& root_bhs );
41
46
50 void advance_root( const block_id_type& id );
51
56 void add( const block_state_ptr& next_block, bool ignore_duplicate = false );
57
58 void remove( const block_id_type& id );
59
60 block_state_ptr root()const;
61 block_state_ptr head()const;
63
72 branch_type fetch_branch( const block_id_type& h, uint32_t trim_after_block_num = std::numeric_limits<uint32_t>::max() )const;
73
74
79 block_state_ptr search_on_branch( const block_id_type& h, uint32_t block_num )const;
80
85 pair< branch_type, branch_type > fetch_branch_from( const block_id_type& first,
86 const block_id_type& second )const;
87
88
89 void mark_valid( const block_state_ptr& h );
90
91 static const uint32_t magic_number;
92
95
96 private:
98 };
99
100} }
wraps boost::filesystem::path to provide platform independent path manipulation.
manages light-weight state for all potential unconfirmed forks
static const uint32_t max_supported_version
block_state_ptr pending_head() const
block_state_ptr search_on_branch(const block_id_type &h, uint32_t block_num) const
branch_type fetch_branch(const block_id_type &h, uint32_t trim_after_block_num=std::numeric_limits< uint32_t >::max()) const
void remove(const block_id_type &id)
fetch_branch_from_impl
block_state_ptr root() const
void open(const std::function< void(block_timestamp_type, const flat_set< digest_type > &, const vector< digest_type > &)> &validator)
block_state_ptr head() const
static const uint32_t magic_number
block_header_state_ptr get_block_header(const block_id_type &id) const
void mark_valid(const block_state_ptr &h)
pair< branch_type, branch_type > fetch_branch_from(const block_id_type &first, const block_id_type &second) const
void reset(const block_header_state &root_bhs)
static const uint32_t min_supported_version
void add(const block_state_ptr &next_block, bool ignore_duplicate=false)
fork_database(const fc::path &data_dir)
void advance_root(const block_id_type &id)
block_state_ptr get_block(const block_id_type &id) const
deque< block_state_ptr > branch_type
std::shared_ptr< block_header_state > block_header_state_ptr
std::shared_ptr< block_state > block_state_ptr
unsigned int uint32_t
Definition stdint.h:126
defines the minimum state necessary to validate transaction headers