Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
etl::NetworkValidatedLedgers Class Reference

This datastructure is used to keep track of the sequence of the most recent ledger validated by the network. More...

#include <NetworkValidatedLedgers.hpp>

Inheritance diagram for etl::NetworkValidatedLedgers:
Collaboration diagram for etl::NetworkValidatedLedgers:

Public Member Functions

void push (uint32_t idx) final
 Notify the datastructure that idx has been validated by the network.
 
std::optional< uint32_t > getMostRecent () final
 Get most recently validated sequence.
 
bool waitUntilValidatedByNetwork (uint32_t sequence, std::optional< uint32_t > maxWaitMs={}) final
 Waits for the sequence to be validated by the network.
 
- Public Member Functions inherited from etl::NetworkValidatedLedgersInterface

Static Public Member Functions

static std::shared_ptr< NetworkValidatedLedgersmakeValidatedLedgers ()
 A factory function for NetworkValidatedLedgers.
 

Detailed Description

This datastructure is used to keep track of the sequence of the most recent ledger validated by the network.

There are two methods that will wait until certain conditions are met. This datastructure is able to be "stopped". When the datastructure is stopped, any threads currently waiting are unblocked. Any later calls to methods of this datastructure will not wait. Once the datastructure is stopped, the datastructure remains stopped for the rest of its lifetime.

Member Function Documentation

◆ getMostRecent()

std::optional< uint32_t > etl::NetworkValidatedLedgers::getMostRecent ( )
finalvirtual

Get most recently validated sequence.

If no ledgers are known to have been validated, this function waits until the next ledger is validated

Returns
Sequence of most recently validated ledger. empty optional if the datastructure has been stopped

Implements etl::NetworkValidatedLedgersInterface.

◆ makeValidatedLedgers()

std::shared_ptr< NetworkValidatedLedgers > etl::NetworkValidatedLedgers::makeValidatedLedgers ( )
static

A factory function for NetworkValidatedLedgers.

Returns
A shared pointer to a new instance of NetworkValidatedLedgers

◆ push()

void etl::NetworkValidatedLedgers::push ( uint32_t idx)
finalvirtual

Notify the datastructure that idx has been validated by the network.

Parameters
idxSequence validated by network

Implements etl::NetworkValidatedLedgersInterface.

◆ waitUntilValidatedByNetwork()

bool etl::NetworkValidatedLedgers::waitUntilValidatedByNetwork ( uint32_t sequence,
std::optional< uint32_t > maxWaitMs = {} )
finalvirtual

Waits for the sequence to be validated by the network.

Parameters
sequenceThe sequence to wait for
maxWaitMsMaximum time to wait for the sequence to be validated. If empty, wait indefinitely
Returns
true if sequence was validated, false otherwise a return value of false means the datastructure has been stopped

Implements etl::NetworkValidatedLedgersInterface.


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