Files
xahaud/src/cpp/ripple/LedgerHistory.h
JoelKatz e8ac00e1a3 Allow tunable node sizes to adjust cache sizes, sweep timing, fetch
timing, and so on. Node size defaults to "tiny", which converves
memory and bandwidth.
2013-01-27 13:55:59 -08:00

27 lines
660 B
C++

#ifndef __LEDGERHISTORY__
#define __LEDGERHISTORY__
#include "TaggedCache.h"
#include "Ledger.h"
class LedgerHistory
{
TaggedCache<uint256, Ledger> mLedgersByHash;
std::map<uint32, uint256> mLedgersByIndex; // accepted ledgers
public:
LedgerHistory();
void addLedger(Ledger::pointer ledger);
void addAcceptedLedger(Ledger::pointer ledger, bool fromConsensus);
uint256 getLedgerHash(uint32 index);
Ledger::pointer getLedgerBySeq(uint32 index);
Ledger::pointer getLedgerByHash(const uint256& hash);
Ledger::pointer canonicalizeLedger(Ledger::pointer, bool cache);
void tune(int size, int age);
void sweep() { mLedgersByHash.sweep(); }
};
#endif