xrpld
Loading...
Searching...
No Matches
xrpl::SHAMapAddNode Class Reference

#include <SHAMapAddNode.h>

Public Member Functions

 SHAMapAddNode ()
void incInvalid ()
 Record one node that was rejected.
void incUseful ()
 Record one node that produced a good result.
void incDuplicate ()
 Record one node that was not needed: the map already held it, or the map or its acquisition was no longer taking nodes.
int getGood () const
int getBad () const
int getDuplicate () const
bool isGood () const
 Whether nodes that produced a good result or were not needed outnumber the ones rejected.
bool isInvalid () const
bool isUseful () const
void reset ()
 Clear every count back to zero.
std::string get () const
 Render the tally as a log line.
SHAMapAddNode & operator+= (SHAMapAddNode const &n)
 Add another verdict's counts into this one.

Static Public Member Functions

static SHAMapAddNode duplicate ()
static SHAMapAddNode useful ()
static SHAMapAddNode invalid ()

Private Member Functions

 SHAMapAddNode (int good, int bad, int duplicate)

Private Attributes

int good_
int bad_
int duplicate_

Detailed Description

Definition at line 8 of file SHAMapAddNode.h.

Constructor & Destructor Documentation

◆ SHAMapAddNode() [1/2]

xrpl::SHAMapAddNode::SHAMapAddNode ( )

Definition at line 127 of file SHAMapAddNode.h.

◆ SHAMapAddNode() [2/2]

xrpl::SHAMapAddNode::SHAMapAddNode ( int good,
int bad,
int duplicate )
private

Definition at line 131 of file SHAMapAddNode.h.

Member Function Documentation

◆ incInvalid()

void xrpl::SHAMapAddNode::incInvalid ( )

Record one node that was rejected.

Definition at line 137 of file SHAMapAddNode.h.

◆ incUseful()

void xrpl::SHAMapAddNode::incUseful ( )

Record one node that produced a good result.

Definition at line 143 of file SHAMapAddNode.h.

◆ incDuplicate()

void xrpl::SHAMapAddNode::incDuplicate ( )

Record one node that was not needed: the map already held it, or the map or its acquisition was no longer taking nodes.

isGood() counts it on the accepted side.

Definition at line 149 of file SHAMapAddNode.h.

◆ getGood()

int xrpl::SHAMapAddNode::getGood ( ) const
nodiscard
Returns
How many nodes produced a good result.

Definition at line 155 of file SHAMapAddNode.h.

◆ getBad()

int xrpl::SHAMapAddNode::getBad ( ) const
nodiscard
Returns
How many nodes this code rejected, which is not how many the batch was given: a batch that stops at its first bad node counts one, and a batch that carries on counts each.

Definition at line 161 of file SHAMapAddNode.h.

◆ getDuplicate()

int xrpl::SHAMapAddNode::getDuplicate ( ) const
nodiscard
Returns
How many nodes were not needed, whether already held or offered to a map no longer taking nodes, tallied apart from the good and bad counts.

Definition at line 167 of file SHAMapAddNode.h.

◆ isGood()

bool xrpl::SHAMapAddNode::isGood ( ) const
nodiscard

Whether nodes that produced a good result or were not needed outnumber the ones rejected.

Returns
Whether the batch was good.

Definition at line 173 of file SHAMapAddNode.h.

◆ isInvalid()

bool xrpl::SHAMapAddNode::isInvalid ( ) const
nodiscard
Returns
Whether at least one node in the batch was rejected.

Definition at line 179 of file SHAMapAddNode.h.

◆ isUseful()

bool xrpl::SHAMapAddNode::isUseful ( ) const
nodiscard
Returns
Whether at least one node in the batch produced a good result.

Definition at line 185 of file SHAMapAddNode.h.

◆ duplicate()

SHAMapAddNode xrpl::SHAMapAddNode::duplicate ( )
static
Returns
A verdict recording one node that was not needed.

Definition at line 191 of file SHAMapAddNode.h.

◆ useful()

SHAMapAddNode xrpl::SHAMapAddNode::useful ( )
static
Returns
A verdict recording one useful node.

Definition at line 197 of file SHAMapAddNode.h.

◆ invalid()

SHAMapAddNode xrpl::SHAMapAddNode::invalid ( )
static
Returns
A verdict recording one invalid node.

Definition at line 203 of file SHAMapAddNode.h.

◆ reset()

void xrpl::SHAMapAddNode::reset ( )

Clear every count back to zero.

Definition at line 209 of file SHAMapAddNode.h.

◆ get()

std::string xrpl::SHAMapAddNode::get ( ) const
nodiscard

Render the tally as a log line.

Returns
The tally, e.g. "good:2 bad:1 dupe:1", or "no nodes processed" if every count is zero.

Definition at line 215 of file SHAMapAddNode.h.

◆ operator+=()

SHAMapAddNode & xrpl::SHAMapAddNode::operator+= ( SHAMapAddNode const & n)

Add another verdict's counts into this one.

Parameters
nThe verdict to add.
Returns
This verdict, updated.

Definition at line 243 of file SHAMapAddNode.h.

Member Data Documentation

◆ good_

int xrpl::SHAMapAddNode::good_
private

Definition at line 11 of file SHAMapAddNode.h.

◆ bad_

int xrpl::SHAMapAddNode::bad_
private

Definition at line 12 of file SHAMapAddNode.h.

◆ duplicate_

int xrpl::SHAMapAddNode::duplicate_
private

Definition at line 13 of file SHAMapAddNode.h.