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

Represents a ledger in RCLConsensus. More...

#include <RCLCxLedger.h>

Collaboration diagram for xrpl::RCLCxLedger:

Public Types

using ID = LedgerHash
 Unique identifier of a ledger.
using Seq = LedgerIndex
 Sequence number of a ledger.

Public Member Functions

 RCLCxLedger ()=default
 Default constructor.
 RCLCxLedger (std::shared_ptr< Ledger const > l)
 Constructor.
Seq const & seq () const
 Sequence number of the ledger.
ID const & id () const
 Unique identifier (hash) of this ledger.
ID const & parentID () const
 Unique identifier (hash) of this ledger's parent.
NetClock::duration closeTimeResolution () const
 Resolution used when calculating this ledger's close time.
bool closeAgree () const
 Whether consensus process agreed on close time of the ledger.
NetClock::time_point closeTime () const
 The close time of this ledger.
NetClock::time_point parentCloseTime () const
 The close time of this ledger's parent.
json::Value getJson () const
 JSON representation of this ledger.

Public Attributes

std::shared_ptr< Ledger const > ledger
 The ledger instance.

Detailed Description

Represents a ledger in RCLConsensus.

RCLCxLedger is a thin wrapper over std::shared_ptr<Ledger const>.

Definition at line 15 of file RCLCxLedger.h.

Member Typedef Documentation

◆ ID

Unique identifier of a ledger.

Definition at line 19 of file RCLCxLedger.h.

◆ Seq

Sequence number of a ledger.

Definition at line 21 of file RCLCxLedger.h.

Constructor & Destructor Documentation

◆ RCLCxLedger() [1/2]

xrpl::RCLCxLedger::RCLCxLedger ( )
default

Default constructor.

TODO: This may not be needed if we ensure RCLConsensus is handed a valid ledger in its constructor. Its bad now because other members are not checking whether the ledger is valid.

◆ RCLCxLedger() [2/2]

xrpl::RCLCxLedger::RCLCxLedger ( std::shared_ptr< Ledger const > l)

Constructor.

Parameters
lThe ledger to wrap.

Definition at line 35 of file RCLCxLedger.h.

Member Function Documentation

◆ seq()

Seq const & xrpl::RCLCxLedger::seq ( ) const
nodiscard

Sequence number of the ledger.

Definition at line 41 of file RCLCxLedger.h.

◆ id()

ID const & xrpl::RCLCxLedger::id ( ) const
nodiscard

Unique identifier (hash) of this ledger.

Definition at line 48 of file RCLCxLedger.h.

◆ parentID()

ID const & xrpl::RCLCxLedger::parentID ( ) const
nodiscard

Unique identifier (hash) of this ledger's parent.

Definition at line 55 of file RCLCxLedger.h.

◆ closeTimeResolution()

NetClock::duration xrpl::RCLCxLedger::closeTimeResolution ( ) const
nodiscard

Resolution used when calculating this ledger's close time.

Definition at line 62 of file RCLCxLedger.h.

◆ closeAgree()

bool xrpl::RCLCxLedger::closeAgree ( ) const
nodiscard

Whether consensus process agreed on close time of the ledger.

Definition at line 69 of file RCLCxLedger.h.

◆ closeTime()

NetClock::time_point xrpl::RCLCxLedger::closeTime ( ) const
nodiscard

The close time of this ledger.

Definition at line 76 of file RCLCxLedger.h.

◆ parentCloseTime()

NetClock::time_point xrpl::RCLCxLedger::parentCloseTime ( ) const
nodiscard

The close time of this ledger's parent.

Definition at line 83 of file RCLCxLedger.h.

◆ getJson()

json::Value xrpl::RCLCxLedger::getJson ( ) const
nodiscard

JSON representation of this ledger.

Definition at line 90 of file RCLCxLedger.h.

Member Data Documentation

◆ ledger

std::shared_ptr<Ledger const> xrpl::RCLCxLedger::ledger

The ledger instance.

TODO: Make this shared_ptr<ReadView const> .. requires ability to create a new ledger from a readView?

Definition at line 100 of file RCLCxLedger.h.