rippled
|
A ledger is a set of observed transactions and a sequence number identifying the ledger. More...
Classes | |
struct | Instance |
struct | MakeGenesis |
Public Types | |
using | Seq = tagged_integer< std::uint32_t, SeqTag > |
using | ID = tagged_integer< std::uint32_t, IdTag > |
Public Member Functions | |
Ledger (MakeGenesis) | |
Ledger () | |
ID | id () const |
Seq | seq () const |
NetClock::duration | closeTimeResolution () const |
bool | closeAgree () const |
NetClock::time_point | closeTime () const |
NetClock::time_point | parentCloseTime () const |
ID | parentID () const |
TxSetType const & | txs () const |
bool | isAncestor (Ledger const &ancestor) const |
Determine whether ancestor is really an ancestor of this ledger. More... | |
ID | operator[] (Seq seq) const |
Return the id of the ancestor with the given seq (if exists/known) More... | |
Json::Value | getJson () const |
Private Member Functions | |
Ledger (ID id, Instance const *i) | |
Private Attributes | |
ID | id_ {0} |
Instance const * | instance_ |
Static Private Attributes | |
static const Instance | genesis |
Friends | |
class | LedgerOracle |
Ledger::Seq | mismatch (Ledger const &a, Ledger const &o) |
Return the sequence number of the first mismatching ancestor. More... | |
bool | operator< (Ledger const &a, Ledger const &b) |
A ledger is a set of observed transactions and a sequence number identifying the ledger.
Peers in the consensus process are trying to agree on a set of transactions to include in a ledger. For simulation, each transaction is a single integer and the ledger is the set of observed integers. This means future ledgers have prior ledgers as subsets, e.g.
Ledger 0 : {} Ledger 1 : {1,4,5} Ledger 2 : {1,2,4,5,10} ....
Ledgers are immutable value types. All ledgers with the same sequence number, transactions, close time, etc. will have the same ledger ID. The LedgerOracle class below manges ID assignments for a simulation and is the only way to close and create a new ledger. Since the parent ledger ID is part of type, this also means ledgers with distinct histories will have distinct ids, even if they have the same set of transactions, sequence number and close time.
using ripple::test::csf::Ledger::Seq = tagged_integer<std::uint32_t, SeqTag> |
using ripple::test::csf::Ledger::ID = tagged_integer<std::uint32_t, IdTag> |
ripple::test::csf::Ledger::Ledger | ( | MakeGenesis | ) |
NetClock::duration ripple::test::csf::Ledger::closeTimeResolution | ( | ) | const |
NetClock::time_point ripple::test::csf::Ledger::closeTime | ( | ) | const |
NetClock::time_point ripple::test::csf::Ledger::parentCloseTime | ( | ) | const |
bool ripple::test::csf::Ledger::isAncestor | ( | Ledger const & | ancestor | ) | const |
Determine whether ancestor is really an ancestor of this ledger.
Definition at line 40 of file ledgers.cpp.
Ledger::ID ripple::test::csf::Ledger::operator[] | ( | Seq | seq | ) | const |
Return the id of the ancestor with the given seq (if exists/known)
Definition at line 48 of file ledgers.cpp.
Json::Value ripple::test::csf::Ledger::getJson | ( | ) | const |
Definition at line 31 of file ledgers.cpp.
|
friend |
|
friend |
Return the sequence number of the first mismatching ancestor.
Definition at line 58 of file ledgers.cpp.
|
staticprivate |