Tidy up and annotate

This commit is contained in:
Vinnie Falco
2013-06-09 18:08:24 -07:00
parent 0b7e0b132a
commit cf3593b01b
18 changed files with 197 additions and 52 deletions

View File

@@ -8,6 +8,7 @@
DEFINE_INSTANCE(LedgerConsensus);
DEFINE_INSTANCE(TransactionAcquire);
// VFALCO TODO rename to PeerTxRequest
// A transaction set we are trying to acquire
class TransactionAcquire
: private IS_INSTANCE (TransactionAcquire)
@@ -18,7 +19,7 @@ public:
typedef boost::shared_ptr<TransactionAcquire> pointer;
public:
TransactionAcquire(uint256 const& hash);
explicit TransactionAcquire(uint256 const& hash);
virtual ~TransactionAcquire() { ; }
SHAMap::ref getMap() { return mMap; }

View File

@@ -132,7 +132,9 @@ Ledger::pointer LedgerMaster::closeLedger(bool recover)
}
}
CondLog (recovers != 0, lsINFO, LedgerMaster) << "Recovered " << recovers << " held transactions";
mHeldTransactions.reset(closingLedger->getHash());
// VFALCO TODO recreate the CanonicalTxSet object instead of resetting it
mHeldTransactions.reset(closingLedger->getHash());
}
mCurrentLedger = boost::make_shared<Ledger>(boost::ref(*closingLedger), true);

View File

@@ -14,10 +14,17 @@ public:
typedef FUNCTION_TYPE<void(Ledger::ref)> callback;
public:
LedgerMaster() : mHeldTransactions(uint256()), mMissingSeq(0),
mMinValidations(0), mLastValidateSeq(0), mPubThread(false),
mPathFindThread(false), mPathFindNewLedger(false), mPathFindNewRequest(false)
{ ; }
LedgerMaster ()
: mHeldTransactions (uint256())
, mMissingSeq (0)
, mMinValidations (0)
, mLastValidateSeq (0)
, mPubThread (false)
, mPathFindThread (false)
, mPathFindNewLedger (false)
, mPathFindNewRequest (false)
{
}
uint32 getCurrentLedgerIndex();
@@ -133,6 +140,7 @@ private:
void pubThread();
void updatePaths();
private:
boost::recursive_mutex mLock;
TransactionEngine mEngine;

View File

@@ -2,7 +2,12 @@
#define ACCEPTED_LEDGER_H
/**
An accepted ledger is a ledger that has a sufficient number of
validations to convince the local server that it is irrevocable.
The existence of an accepted ledger implies all preceding ledgers
are accepted.
*/
class AcceptedLedger
{

View File

@@ -1,12 +1,20 @@
#ifndef RIPPLE_ACCEPTEDLEDGERTX_H
#define RIPPLE_ACCEPTEDLEDGERTX_H
/*============================================================================*/
//------------------------------------------------------------------------------
/**
A transaction that is in a closed ledger.
Description
An accepted ledger transaction contains additional information that the
server needs to tell clients about the transaction. For example,
- The transaction in JSON form
- Which accounts are affected
* This is used by InfoSub to report to clients
- Cached stuff
@code
@endcode
@@ -17,7 +25,7 @@
class AcceptedLedgerTx
{
public:
typedef boost::shared_ptr<AcceptedLedgerTx> pointer;
typedef boost::shared_ptr <AcceptedLedgerTx> pointer;
typedef const pointer& ref;
public:

View File

@@ -1,6 +1,14 @@
#ifndef RIPPLE_CANONICALTXSET_H
#define RIPPLE_CANONICALTXSET_H
/** Holds transactions which were deferred to the next pass of consensus.
"Canonical" refers to the order in which transactions are applied.
- Puts transactions from the same account in sequence order
*/
// VFALCO TODO rename to SortedTxSet
class CanonicalTXSet
{
public:
@@ -25,7 +33,8 @@ public:
uint256 const& getTXID() const { return mTXid; }
private:
uint256 mAccount, mTXid;
uint256 mAccount;
uint256 mTXid;
uint32 mSeq;
};
@@ -33,13 +42,14 @@ public:
typedef std::map <Key, SerializedTransaction::pointer>::const_iterator const_iterator;
public:
CanonicalTXSet (LedgerHash const& lastClosedLedgerHash)
explicit CanonicalTXSet (LedgerHash const& lastClosedLedgerHash)
: mSetHash (lastClosedLedgerHash)
{
}
void push_back (SerializedTransaction::ref txn);
// VFALCO TODO remove this function
void reset (LedgerHash const& newLastClosedLedgerHash)
{
mSetHash = newLastClosedLedgerHash;
@@ -57,6 +67,7 @@ public:
bool empty() const { return mMap.empty(); }
private:
// Used to salt the accounts so people can't mine for low account numbers
uint256 mSetHash;
std::map <Key, SerializedTransaction::pointer> mMap;

View File

@@ -3,7 +3,7 @@
DEFINE_INSTANCE(LedgerAcquire);
// VFALCO TODO Rename to IncomingLedger
// VFALCO TODO Rename to InboundLedger
// A ledger we are trying to acquire
class LedgerAcquire : private IS_INSTANCE(LedgerAcquire)
, public PeerSet

View File

@@ -1,9 +1,9 @@
#ifndef RIPPLE_LEDGERACQUIREMASTER_H
#define RIPPLE_LEDGERACQUIREMASTER_H
/** Manages the acquisition of ledgers.
/** Manages the lifetime of inbound ledgers.
*/
// VFALCO TODO Rename to IncomingLedgerManager
// VFALCO TODO Rename to InboundLedgerManager
// VFALCO TODO Create abstract interface
class LedgerAcquireMaster
{

View File

@@ -24,8 +24,8 @@ public:
public:
// build new map
SHAMap(SHAMapType t, uint32 seq = 1);
SHAMap(SHAMapType t, uint256 const& hash);
explicit SHAMap (SHAMapType t, uint32 seq = 1);
SHAMap (SHAMapType t, uint256 const& hash);
~SHAMap() { mState = smsInvalid; }