Refactor LedgerEntrySet:

* Remove duplicate:
    This changes behavior to fix an apparent bug. The
    copy will now correctly inherit mParams instead
    of reverting to tapNONE

* Tidy up LedgerEntrySet declarations
* Tidy up TransactionEngine
* Tidy PathCursor declarations
* Add LedgerEntrySet::apply
* Add LedgerEntrySet ctor
* Add Keylet, keylet namespace
* Add defaulted copy members
* Use optional in TransactionEngine
* Use optional<LedgerEntrySet> in PathState
* Return shared_ptr in Ledger::fetch
* Don't call entryCache with zero
* Deprecate invalidate
* Remove default constructor
* Remove unused container API
* Remove CountedObject base class
* Remove insert, clear
* Remove entryCreate overload
* Remove unused and tidy up STLedgerEntry
* Make getEntry private and tidy
* Replace members with adjustOwnerCount free function
* Replace accountFunds with funds free function
This commit is contained in:
Vinnie Falco
2015-06-09 10:37:13 -04:00
committed by Nik Bougalis
parent aead038215
commit d21171b21e
32 changed files with 746 additions and 526 deletions

View File

@@ -21,6 +21,7 @@
#include <ripple/basics/SHA512Half.h>
#include <ripple/protocol/Indexes.h>
#include <beast/utility/static_initializer.h>
#include <cassert>
namespace ripple {
@@ -192,4 +193,118 @@ getSignerListIndex (Account const& account)
account);
}
//------------------------------------------------------------------------------
namespace keylet {
Keylet account_t::operator()(
Account const& id) const
{
return { ltACCOUNT_ROOT,
getAccountRootIndex(id) };
}
Keylet account_t::operator()(
RippleAddress const& ra) const
{
return { ltACCOUNT_ROOT,
getAccountRootIndex(ra.getAccountID()) };
}
Keylet owndir_t::operator()(
Account const& id) const
{
return { ltDIR_NODE,
getOwnerDirIndex(id) };
}
Keylet skip_t::operator()() const
{
return { ltLEDGER_HASHES,
getLedgerHashIndex() };
}
Keylet skip_t::operator()(LedgerIndex ledger) const
{
return { ltLEDGER_HASHES,
getLedgerHashIndex(ledger) };
}
Keylet amendments_t::operator()() const
{
return { ltAMENDMENTS,
getLedgerAmendmentIndex() };
}
Keylet fee_t::operator()() const
{
return { ltFEE_SETTINGS,
getLedgerFeeIndex() };
}
Keylet book_t::operator()(Book const& b) const
{
return { ltDIR_NODE,
getBookBase(b) };
}
Keylet offer_t::operator()(Account const& id,
std::uint32_t seq) const
{
return { ltOFFER,
getOfferIndex(id, seq) };
}
Keylet item_t::operator()(Keylet const& k,
std::uint64_t index,
LedgerEntryType type) const
{
return { type,
getDirNodeIndex(k.key, index) };
}
Keylet quality_t::operator()(Keylet const& k,
std::uint64_t q) const
{
assert(k.type == ltDIR_NODE);
return { ltDIR_NODE,
getQualityIndex(k.key, q) };
}
Keylet next_t::operator()(Keylet const& k) const
{
assert(k.type == ltDIR_NODE);
return { ltDIR_NODE,
getQualityNext(k.key) };
}
Keylet ticket_t::operator()(Account const& id,
std::uint32_t seq) const
{
return { ltTICKET,
getTicketIndex(id, seq) };
}
Keylet trust_t::operator()(Account const& id0,
Account const& id1, Currency const& currency) const
{
return { ltRIPPLE_STATE,
getRippleStateIndex(id0, id1, currency) };
}
Keylet trust_t::operator()(Account const& id,
Issue const& issue) const
{
return { ltRIPPLE_STATE,
getRippleStateIndex(id, issue) };
}
Keylet signers_t::operator()(Account const& id) const
{
return { ltSIGNER_LIST,
getSignerListIndex(id) };
}
} // keylet
} // ripple