Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::block_status_monitor Class Reference

Public Member Functions

 block_status_monitor (fc::microseconds window_size=fc::microseconds(2 *1000), uint32_t max_rejected_windows=13)
 
 block_status_monitor (const block_status_monitor &)=delete
 
 block_status_monitor (block_status_monitor &&)=delete
 
 ~block_status_monitor ()=default
 
void reset ()
 reset to initial state
 
void accepted ()
 called when a block is accepted (sync_recv_block)
 
void rejected ()
 called when a block is rejected
 
auto events () const
 returns number of consecutive rbws
 
bool max_events_violated () const
 indicates if the max number of consecutive rbws has been reached or exceeded
 
block_status_monitoroperator= (const block_status_monitor &)=delete
 assignment not allowed
 
block_status_monitoroperator= (block_status_monitor &&)=delete
 

Detailed Description

monitors the status of blocks as to whether a block is accepted (sync'd) or rejected. It groups consecutive rejected blocks in a (configurable) time window (rbw) and maintains a metric of the number of consecutive rejected block time windows (rbws).

Definition at line 546 of file net_plugin.cpp.

Constructor & Destructor Documentation

◆ block_status_monitor() [1/3]

sysio::block_status_monitor::block_status_monitor ( fc::microseconds window_size = fc::microseconds(2*1000),
uint32_t max_rejected_windows = 13 )
inlineexplicit

ctor

Parameters
[in]window_sizeThe time, in microseconds, of the rejected block window
[in]max_rejected_windowsThe max consecutive number of rejected block windows
Note
Copy ctor is not allowed

Definition at line 560 of file net_plugin.cpp.

561 :
562 window_size_(window_size) {}

◆ block_status_monitor() [2/3]

sysio::block_status_monitor::block_status_monitor ( const block_status_monitor & )
delete

◆ block_status_monitor() [3/3]

sysio::block_status_monitor::block_status_monitor ( block_status_monitor && )
delete

◆ ~block_status_monitor()

sysio::block_status_monitor::~block_status_monitor ( )
default

Member Function Documentation

◆ accepted()

void sysio::block_status_monitor::accepted ( )
inline

Definition at line 569 of file net_plugin.cpp.

569{ reset(); }
void reset()
reset to initial state
Here is the call graph for this function:

◆ events()

auto sysio::block_status_monitor::events ( ) const
inline

Definition at line 573 of file net_plugin.cpp.

573{ return events_; }

◆ max_events_violated()

bool sysio::block_status_monitor::max_events_violated ( ) const
inline

Definition at line 575 of file net_plugin.cpp.

575{ return events_ >= max_consecutive_rejected_windows_; }

◆ operator=() [1/2]

block_status_monitor & sysio::block_status_monitor::operator= ( block_status_monitor && )
delete

◆ operator=() [2/2]

block_status_monitor & sysio::block_status_monitor::operator= ( const block_status_monitor & )
delete

◆ rejected()

void sysio::block_status_monitor::rejected ( )

Definition at line 1516 of file net_plugin.cpp.

1516 {
1517 const auto now = fc::time_point::now();
1518
1519 // in rejected state
1520 if(!in_accepted_state_) {
1521 const auto elapsed = now - window_start_;
1522 if( elapsed < window_size_ ) {
1523 return;
1524 }
1525 ++events_;
1526 window_start_ = now;
1527 return;
1528 }
1529
1530 // switching to rejected state
1531 in_accepted_state_ = false;
1532 window_start_ = now;
1533 events_ = 0;
1534 }
static time_point now()
Definition time.cpp:14
Here is the call graph for this function:

◆ reset()

void sysio::block_status_monitor::reset ( )

Definition at line 1511 of file net_plugin.cpp.

1511 {
1512 in_accepted_state_ = true;
1513 events_ = 0;
1514 }
Here is the caller graph for this function:

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