Tidy up hardened containers (RIPD-380):

* Rename hardened containers for clarity
* Fixes https://ripplelabs.atlassian.net/browse/RIPD-380
This commit is contained in:
Howard Hinnant
2014-07-28 09:01:32 -07:00
committed by Vinnie Falco
parent e6f4eedb1e
commit 58547f6997
64 changed files with 179 additions and 170 deletions

View File

@@ -43,7 +43,7 @@ class SyncUnorderedMapType : public SyncUnorderedMap
public:
typedef c_Key key_type;
typedef c_Data data_type;
typedef ripple::unordered_map<c_Key, c_Data, c_Hash> map_type;
typedef hash_map<c_Key, c_Data, c_Hash> map_type;
class iterator
{

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_BASICS_LOG_H_INCLUDED
#define RIPPLE_BASICS_LOG_H_INCLUDED
#include <ripple/common/UnorderedContainers.h>
#include <beast/utility/Journal.h>
#include <beast/utility/noexcept.h>
#include <boost/filesystem.hpp>
@@ -139,7 +140,7 @@ private:
};
std::mutex mutable mutex_;
std::unordered_map <std::string, Sink> sinks_;
hardened_hash_map <std::string, Sink> sinks_;
beast::Journal::Severity level_;
File file_;

View File

@@ -21,7 +21,6 @@
#define RIPPLE_KEYCACHE_H_INCLUDED
#include <mutex>
#include <unordered_map>
#include <beast/chrono/abstract_clock.h>
#include <beast/chrono/chrono_io.h>
@@ -40,7 +39,7 @@ namespace ripple {
// VFALCO TODO Figure out how to pass through the allocator
template <
class Key,
class Hash = beast::hardened_hash <Key>,
class Hash = beast::hardened_hash <>,
class KeyEqual = std::equal_to <Key>,
//class Allocator = std::allocator <std::pair <Key const, Entry>>,
class Mutex = std::mutex
@@ -82,7 +81,7 @@ private:
clock_type::time_point last_access;
};
typedef ripple::unordered_map <key_type, Entry, Hash, KeyEqual> map_type;
typedef hardened_hash_map <key_type, Entry, Hash, KeyEqual> map_type;
typedef typename map_type::iterator iterator;
typedef std::lock_guard <Mutex> lock_guard;

View File

@@ -27,7 +27,6 @@
#include <beast/container/hardened_hash.h>
#include <functional>
#include <mutex>
#include <unordered_map>
#include <vector>
namespace ripple {
@@ -51,7 +50,7 @@ struct TaggedCacheLog;
template <
class Key,
class T,
class Hash = beast::hardened_hash <Key>,
class Hash = beast::hardened_hash <>,
class KeyEqual = std::equal_to <Key>,
//class Allocator = std::allocator <std::pair <Key const, Entry>>,
class Mutex = std::recursive_mutex
@@ -528,7 +527,7 @@ private:
};
typedef std::pair <key_type, Entry> cache_pair;
typedef ripple::unordered_map <key_type, Entry, Hash, KeyEqual> cache_type;
typedef hardened_hash_map <key_type, Entry, Hash, KeyEqual> cache_type;
typedef typename cache_type::iterator cache_iterator;
beast::Journal m_journal;

View File

@@ -20,23 +20,69 @@
#ifndef RIPPLE_UNORDERED_CONTAINERS_H
#define RIPPLE_UNORDERED_CONTAINERS_H
#include <beast/container/hardened_hash.h>
#include <beast/container/hash_append.h>
#include <unordered_map>
#include <unordered_set>
/**
* Use hash_* containers for keys that do not need a cryptographically secure
* hashing algorithm.
*
* Use hardened_hash_* containers for keys that do need a secure hashing algorithm.
*
* The cryptographic security of containers where a hash function is used as a
* template parameter depends entirely on that hash function and not at all on
* what container it is.
*/
namespace ripple
{
// hash containers
template <class Key, class Value, class Hash = beast::uhash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using unordered_map = std::unordered_map <Key, Value, Hash, Pred, Allocator>;
using hash_map = std::unordered_map <Key, Value, Hash, Pred, Allocator>;
template <class Key, class Value, class Hash = beast::uhash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using hash_multimap = std::unordered_multimap <Key, Value, Hash, Pred, Allocator>;
template <class Value, class Hash = beast::uhash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using unordered_set = std::unordered_set <Value, Hash, Pred, Allocator>;
using hash_set = std::unordered_set <Value, Hash, Pred, Allocator>;
template <class Value, class Hash = beast::uhash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using hash_multiset = std::unordered_multiset <Value, Hash, Pred, Allocator>;
// hardened_hash containers
template <class Key, class Value, class Hash = beast::hardened_hash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using hardened_hash_map = std::unordered_map <Key, Value, Hash, Pred, Allocator>;
template <class Key, class Value, class Hash = beast::hardened_hash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using hardened_hash_multimap = std::unordered_multimap <Key, Value, Hash, Pred, Allocator>;
template <class Value, class Hash = beast::hardened_hash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using hardened_hash_set = std::unordered_set <Value, Hash, Pred, Allocator>;
template <class Value, class Hash = beast::hardened_hash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using hardened_hash_multiset = std::unordered_multiset <Value, Hash, Pred, Allocator>;
} // ripple

View File

@@ -79,7 +79,7 @@ private:
bool mOurVote;
Serializer transaction;
ripple::unordered_map <NodeID, bool> mVotes;
hash_map <NodeID, bool> mVotes;
};
// How many total extra passes we make

View File

@@ -475,7 +475,7 @@ public:
// Get validators that are on our ledger, or "close" to being on
// our ledger.
ripple::unordered_map<uint256, ValidationCounter> vals =
hash_map<uint256, ValidationCounter> vals =
getApp().getValidations ().getCurrentValidations
(favoredLedger, priorLedger);
@@ -1687,7 +1687,7 @@ private:
}
// if any peers have taken a contrary position, process disputes
ripple::unordered_set<uint256> found;
hash_set<uint256> found;
for (auto& it : mPeerPositions)
{
@@ -2093,19 +2093,18 @@ private:
int mPreviousMSeconds;
// Convergence tracking, trusted peers indexed by hash of public key
ripple::unordered_map<NodeID, LedgerProposal::pointer> mPeerPositions;
hash_map<NodeID, LedgerProposal::pointer> mPeerPositions;
// Transaction Sets, indexed by hash of transaction tree
ripple::unordered_map<uint256, SHAMap::pointer> mAcquired;
ripple::unordered_map<uint256, TransactionAcquire::pointer> mAcquiring;
hash_map<uint256, SHAMap::pointer> mAcquired;
hash_map<uint256, TransactionAcquire::pointer> mAcquiring;
// Peer sets
ripple::unordered_map<uint256
, std::vector< std::weak_ptr<Peer> > > mPeerData;
hash_map<uint256, std::vector< std::weak_ptr<Peer> > > mPeerData;
// Disputed transactions
ripple::unordered_map<uint256, DisputedTx::pointer> mDisputes;
ripple::unordered_set<uint256> mCompares;
hash_map<uint256, DisputedTx::pointer> mDisputes;
hash_set<uint256> mCompares;
// Close time estimates
std::map<std::uint32_t, int> mCloseTimes;

View File

@@ -39,7 +39,7 @@ private:
typedef std::lock_guard <LockType> ScopedLockType;
LockType mLock;
ripple::unordered_map<std::uint64_t, InfoSub::wptr> mListeners;
hash_map<std::uint64_t, InfoSub::wptr> mListeners;
};
} // ripple

View File

@@ -59,7 +59,7 @@ public:
{
if (mConsensusLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mConsensusLedger))
{
ripple::unordered_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mConsensusLedger);
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mConsensusLedger);
if (it != mLedgers.end ())
{
oldLedger = it->second;
@@ -72,7 +72,7 @@ public:
{
if (mValidationLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mValidationLedger))
{
ripple::unordered_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mValidationLedger);
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mValidationLedger);
if (it != mLedgers.end ())
{
oldLedger = it->second;
@@ -82,7 +82,7 @@ public:
mValidationLedger = hash;
}
ripple::unordered_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
if (it != mLedgers.end ())
{
ret = it->second;
@@ -111,7 +111,7 @@ public:
{
ScopedLockType sl (mLock);
ripple::unordered_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
if (it != mLedgers.end ())
{
ret = it->second;
@@ -376,7 +376,7 @@ public:
private:
clock_type& m_clock;
typedef ripple::unordered_map <uint256, InboundLedger::pointer> MapType;
typedef hash_map <uint256, InboundLedger::pointer> MapType;
typedef RippleRecursiveMutex LockType;
typedef std::unique_lock <LockType> ScopedLockType;

View File

@@ -292,7 +292,7 @@ private:
Ledger::pointer mLedger;
std::map<uint256, LedgerEntrySetEntry> mEntries; // cannot be unordered!
typedef ripple::unordered_map<uint256, SLE::pointer> NodeToLedgerEntry;
typedef hash_map<uint256, SLE::pointer> NodeToLedgerEntry;
TransactionMetaSet mSet;
TransactionEngineParams mParams;

View File

@@ -818,7 +818,7 @@ public:
};
// Count the number of current, trusted validations
ripple::unordered_map <uint256, valSeq> count;
hash_map <uint256, valSeq> count;
for (auto const& v : val)
{
valSeq& vs = count[v->getLedgerHash()];

View File

@@ -62,10 +62,10 @@ void OrderBookDB::setup (Ledger::ref ledger)
}
static void updateHelper (SLE::ref entry,
ripple::unordered_set< uint256 >& seen,
hash_set< uint256 >& seen,
OrderBookDB::IssueToOrderBook& destMap,
OrderBookDB::IssueToOrderBook& sourceMap,
ripple::unordered_set< Issue >& XRPBooks,
hash_set< Issue >& XRPBooks,
int& books)
{
if (entry->getType () == ltDIR_NODE &&
@@ -93,10 +93,10 @@ static void updateHelper (SLE::ref entry,
void OrderBookDB::update (Ledger::pointer ledger)
{
ripple::unordered_set< uint256 > seen;
hash_set< uint256 > seen;
OrderBookDB::IssueToOrderBook destMap;
OrderBookDB::IssueToOrderBook sourceMap;
ripple::unordered_set< Issue > XRPBooks;
hash_set< Issue > XRPBooks;
WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update>";

View File

@@ -51,7 +51,7 @@ public:
Ledger::ref ledger, const AcceptedLedgerTx& alTx,
Json::Value const& jvObj);
typedef ripple::unordered_map <Issue, OrderBook::List> IssueToOrderBook;
typedef hash_map <Issue, OrderBook::List> IssueToOrderBook;
private:
void rawAddBook(Book const&);
@@ -63,13 +63,13 @@ private:
IssueToOrderBook mDestMap;
// does an order book to XRP exist
ripple::unordered_set <Issue> mXRPBooks;
hash_set <Issue> mXRPBooks;
typedef RippleRecursiveMutex LockType;
typedef std::lock_guard <LockType> ScopedLockType;
LockType mLock;
typedef ripple::unordered_map <Book, BookListeners::pointer>
typedef hash_map <Book, BookListeners::pointer>
BookToListenersMap;
BookToListenersMap mListeners;

View File

@@ -30,7 +30,7 @@ class AmendmentSet
public:
std::uint32_t mCloseTime;
int mTrustedValidations; // number of trusted validations
ripple::unordered_map<uint256, int> mVotes; // yes votes by amendment
hash_map<uint256, int> mVotes; // yes votes by amendment
AmendmentSet (std::uint32_t ct) : mCloseTime (ct), mTrustedValidations (0)
{

View File

@@ -29,9 +29,9 @@ namespace ripple {
{
protected:
typedef ripple::unordered_map<uint256, AmendmentState> amendmentMap_t;
typedef hash_map<uint256, AmendmentState> amendmentMap_t;
typedef std::pair<const uint256, AmendmentState> amendmentIt_t;
typedef ripple::unordered_set<uint256> amendmentList_t;
typedef hash_set<uint256> amendmentList_t;
typedef RippleMutex LockType;
typedef std::lock_guard <LockType> ScopedLockType;

View File

@@ -107,7 +107,7 @@ private:
LockType mLock;
// Stores all suppressed hashes and their expiration time
ripple::unordered_map <uint256, Entry> mSuppressionMap;
hash_map <uint256, Entry> mSuppressionMap;
// Stores all expiration times and the hashes indexed for them
std::map< int, std::list<uint256> > mSuppressionTimes;
@@ -119,7 +119,7 @@ private:
HashRouter::Entry& HashRouter::findCreateEntry (uint256 const& index, bool& created)
{
ripple::unordered_map<uint256, Entry>::iterator fit = mSuppressionMap.find (index);
hash_map<uint256, Entry>::iterator fit = mSuppressionMap.find (index);
if (fit != mSuppressionMap.end ())
{

View File

@@ -427,11 +427,10 @@ public:
//
void subAccount (
InfoSub::ref ispListener,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
const hash_set<RippleAddress>& vnaAccountIDs,
std::uint32_t uLedgerIndex, bool rt);
void unsubAccount (
std::uint64_t uListener,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
std::uint64_t uListener, const hash_set<RippleAddress>& vnaAccountIDs,
bool rt);
bool subLedger (InfoSub::ref ispListener, Json::Value& jvResult);
@@ -492,8 +491,8 @@ private:
private:
clock_type& m_clock;
typedef ripple::unordered_map <Account, SubMapType> SubInfoMapType;
typedef ripple::unordered_map<std::string, InfoSub::pointer> subRpcMapType;
typedef hash_map <Account, SubMapType> SubInfoMapType;
typedef hash_map<std::string, InfoSub::pointer> subRpcMapType;
// XXX Split into more locks.
typedef RippleRecursiveMutex LockType;
@@ -1358,7 +1357,7 @@ bool NetworkOPsImp::checkLastClosedLedger (
m_journal.trace << "OurClosed: " << closedLedger;
m_journal.trace << "PrevClosed: " << prevClosedLedger;
ripple::unordered_map<uint256, ValidationCount> ledgers;
hash_map<uint256, ValidationCount> ledgers;
{
auto current = getApp().getValidations ().getCurrentValidations (
closedLedger, prevClosedLedger);
@@ -2615,7 +2614,7 @@ void NetworkOPsImp::pubValidatedTransaction (Ledger::ref alAccepted, const Accep
void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const AcceptedLedgerTx& alTx, bool bAccepted)
{
std::unordered_set<InfoSub::pointer> notify;
hash_set<InfoSub::pointer> notify;
int iProposed = 0;
int iAccepted = 0;
@@ -2702,7 +2701,7 @@ void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const Accepted
//
void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
const hash_set<RippleAddress>& vnaAccountIDs,
std::uint32_t uLedgerIndex, bool rt)
{
SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount;
@@ -2738,7 +2737,7 @@ void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
}
void NetworkOPsImp::unsubAccount (std::uint64_t uSeq,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
const hash_set<RippleAddress>& vnaAccountIDs,
bool rt)
{
SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount;

View File

@@ -81,7 +81,7 @@ public:
// VFALCO TODO Fix OrderBookDB to not need this unrelated type.
//
typedef ripple::unordered_map <std::uint64_t, InfoSub::wptr> SubMapType;
typedef hash_map <std::uint64_t, InfoSub::wptr> SubMapType;
public:
// VFALCO TODO Make LedgerMaster a SharedPtr or a reference.
@@ -264,8 +264,7 @@ public:
virtual Json::Value getLedgerFetchInfo () = 0;
virtual std::uint32_t acceptLedger () = 0;
typedef ripple::unordered_map <NodeID, std::list<LedgerProposal::pointer>>
Proposals;
typedef hash_map <NodeID, std::list<LedgerProposal::pointer>> Proposals;
virtual Proposals& peekStoredProposals () = 0;
virtual void storeProposal (LedgerProposal::ref proposal,

View File

@@ -25,10 +25,10 @@ namespace ripple {
// VFALCO TODO rename and move these typedefs into the Validations interface
// nodes validating and highest node ID validating
typedef unordered_map<NodeID, SerializedValidation::pointer> ValidationSet;
typedef hash_map<NodeID, SerializedValidation::pointer> ValidationSet;
typedef std::pair<int, NodeID> ValidationCounter;
typedef unordered_map<uint256, ValidationCounter> LedgerToValidationCounter;
typedef hash_map<uint256, ValidationCounter> LedgerToValidationCounter;
typedef std::vector<SerializedValidation::pointer> ValidationVector;
class Validations : beast::LeakChecked <Validations>

View File

@@ -50,7 +50,7 @@ public:
// unfunded offers.
//
// Offers that were found unfunded.
unordered_set<uint256> mUnfundedOffers;
hash_set<uint256> mUnfundedOffers;
RippleCalc (LedgerEntrySet& activeLedger, const bool bOpenLedger)
: mActiveLedger (activeLedger), mOpenLedger (bOpenLedger)

View File

@@ -146,7 +146,7 @@ private:
STPathSet mCompletePaths;
std::map< PathType_t, STPathSet > mPaths;
ripple::unordered_map<std::pair<Currency, Account>, int> mPOMap;
hash_map<std::pair<Currency, Account>, int> mPOMap;
// Add ripple paths
static const std::uint32_t afADD_ACCOUNTS = 0x001;

View File

@@ -45,7 +45,7 @@ private:
Ledger::pointer mLedger;
ripple::unordered_map <Account, AccountItems::pointer> mRLMap;
hash_map <Account, AccountItems::pointer> mRLMap;
};
} // ripple

View File

@@ -26,7 +26,7 @@ namespace ripple {
typedef std::tuple <Account, Currency, Account> AccountCurrencyIssuer;
// Map of account, currency, issuer to node index.
typedef ripple::unordered_map <AccountCurrencyIssuer, unsigned int>
typedef hash_map <AccountCurrencyIssuer, unsigned int>
AccountCurrencyIssuerToNodeIndex;
} // ripple

View File

@@ -155,7 +155,7 @@ protected:
// VFALCO TODO Verify that these are used in the way that the names suggest.
typedef Peer::ShortId PeerIdentifier;
typedef int ReceivedChunkCount;
typedef ripple::unordered_map <PeerIdentifier, ReceivedChunkCount> PeerSetMap;
typedef hash_map <PeerIdentifier, ReceivedChunkCount> PeerSetMap;
PeerSetMap mPeers;
};

View File

@@ -103,9 +103,9 @@ private:
std::vector<int> viReferrals;
} scoreNode;
typedef ripple::unordered_map<std::string, int> strIndex;
typedef hash_map<std::string, int> strIndex;
typedef std::pair<std::string, int> IPAndPortNumber;
typedef ripple::unordered_map<std::pair< std::string, int>, score> epScore;
typedef hash_map<std::pair< std::string, int>, score> epScore;
public:
explicit UniqueNodeListImp (Stoppable& parent)
@@ -1025,7 +1025,7 @@ private:
}
}
ripple::unordered_set<std::string> usUNL;
hash_set<std::string> usUNL;
if (!vsnNodes.empty ())
{
@@ -1058,7 +1058,7 @@ private:
mUNL.swap (usUNL);
}
ripple::unordered_map<std::string, int> umValidators;
hash_map<std::string, int> umValidators;
if (!vsnNodes.empty ())
{
@@ -1077,7 +1077,7 @@ private:
// map of pair<IP,Port> :: score
epScore umScore;
typedef ripple::unordered_map<std::string, int>::value_type vcType;
typedef hash_map<std::string, int>::value_type vcType;
BOOST_FOREACH (vcType & vc, umValidators)
{
std::string strValidator = vc.first;
@@ -2025,7 +2025,7 @@ private:
// XXX Make this faster, make this the contents vector unsigned char or raw public key.
// XXX Contents needs to based on score.
ripple::unordered_set<std::string> mUNL;
hash_set<std::string> mUNL;
boost::posix_time::ptime mtpScoreNext; // When to start scoring.
boost::posix_time::ptime mtpScoreStart; // Time currently started scoring.

View File

@@ -32,7 +32,7 @@ public:
tableItemsExtra = 20
};
typedef ripple::unordered_map <uint256, Blob> Map;
typedef hash_map <uint256, Blob> Map;
struct TestFilter : SHAMapSyncFilter
{

View File

@@ -1302,11 +1302,10 @@ void SHAMap::dump (bool hash)
WriteLog (lsINFO, SHAMap) << " MAP Contains";
ScopedWriteLockType sl (mLock);
for (ripple::unordered_map<SHAMapNodeID, SHAMapTreeNode::pointer, SHAMapNode_hash>::iterator it = mTNByID.peekMap().begin ();
it != mTNByID.peekMap().end (); ++it)
for (auto const& p : mTNByID.peekMap())
{
WriteLog (lsINFO, SHAMap) << it->second->getString (it->first);
CondLog (hash, lsINFO, SHAMap) << it->second->getNodeHash ();
WriteLog (lsINFO, SHAMap) << p.second->getString (p.first);
CondLog (hash, lsINFO, SHAMap) << p.second->getNodeHash ();
}
}

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_SHAMAP_H
#define RIPPLE_SHAMAP_H
#include <ripple/common/UnorderedContainers.h>
#include <ripple/module/app/main/FullBelowCache.h>
#include <ripple/nodestore/NodeObject.h>
#include <ripple/unity/radmap.h>
@@ -27,8 +28,6 @@
#include <boost/thread/shared_lock_guard.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <unordered_map>
namespace std {
template <>
@@ -114,8 +113,8 @@ public:
typedef std::pair<SHAMapItem::pointer, SHAMapItem::pointer> DeltaItem;
typedef std::pair<SHAMapItem::ref, SHAMapItem::ref> DeltaRef;
typedef std::map<uint256, DeltaItem> Delta;
typedef ripple::unordered_map<SHAMapNodeID, SHAMapTreeNode::pointer> NodeMap;
typedef std::unordered_set<SHAMapNodeID, SHAMapNode_hash> DirtySet;
typedef hash_map<SHAMapNodeID, SHAMapTreeNode::pointer, SHAMapNode_hash> NodeMap;
typedef hash_set<SHAMapNodeID, SHAMapNode_hash> DirtySet;
typedef boost::shared_mutex LockType;
typedef boost::shared_lock<LockType> ScopedReadLockType;

View File

@@ -22,8 +22,6 @@
#include <ripple/module/app/book/Amounts.h>
#include <unordered_set>
namespace ripple {
class CreateOfferBridged

View File

@@ -22,8 +22,6 @@
#include <ripple/module/app/book/Amounts.h>
#include <unordered_set>
namespace ripple {
class CreateOfferDirect

View File

@@ -74,8 +74,7 @@ private:
protected:
// For each connection maintain an associated object to track subscriptions.
typedef ripple::unordered_map <connection_ptr,
std::shared_ptr <WSConnectionType <endpoint_type> > > MapType;
typedef hash_map <connection_ptr, wsc_ptr> MapType;
MapType mMap;
bool const mPublic;
bool const mProxy;
@@ -148,7 +147,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
return;
@@ -178,7 +177,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
return;
@@ -213,7 +212,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
return;
@@ -247,7 +246,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
{
@@ -287,7 +286,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
return;
@@ -322,7 +321,7 @@ public:
wsc_ptr ptr;
{
ScopedLockType sl (mLock);
typename ripple::unordered_map<connection_ptr, wsc_ptr>::iterator it = mMap.find (cpClient);
auto it = mMap.find (cpClient);
if (it == mMap.end ())
return;

View File

@@ -623,7 +623,7 @@ private:
ScopedLock lock (m_mutex);
// Remove all jobs whose type is skipOnStop
typedef ripple::unordered_map <JobType, std::size_t> JobDataMap;
typedef hash_map <JobType, std::size_t> JobDataMap;
JobDataMap counts;
bool const report (m_journal.debug.active());

View File

@@ -318,7 +318,7 @@ typedef RippleMutex StaticLockType;
typedef std::lock_guard <StaticLockType> StaticScopedLockType;
static StaticLockType s_lock;
static ripple::unordered_map< Blob , std::string > rncMap;
static hash_map< Blob , std::string > rncMap;
std::string RippleAddress::humanAccountID () const
{

View File

@@ -55,11 +55,11 @@ public:
public:
// VFALCO TODO Rename the 'rt' parameters to something meaningful.
virtual void subAccount (ref ispListener,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
const hash_set<RippleAddress>& vnaAccountIDs,
std::uint32_t uLedgerIndex, bool rt) = 0;
virtual void unsubAccount (std::uint64_t uListener,
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
const hash_set<RippleAddress>& vnaAccountIDs,
bool rt) = 0;
// VFALCO TODO Document the bool return value
@@ -117,13 +117,12 @@ protected:
LockType mLock;
private:
Consumer m_consumer;
Source& m_source;
ripple::unordered_set <RippleAddress> mSubAccountInfo;
ripple::unordered_set <RippleAddress> mSubAccountTransaction;
std::shared_ptr <PathRequest> mPathRequest;
std::uint64_t mSeq;
Consumer m_consumer;
Source& m_source;
hash_set <RippleAddress> mSubAccountInfo;
hash_set <RippleAddress> mSubAccountTransaction;
std::shared_ptr <PathRequest> mPathRequest;
std::uint64_t mSeq;
};
} // ripple

View File

@@ -88,7 +88,7 @@ Json::Value doUnsubscribe (RPC::Context& context)
if (context.params_.isMember ("accounts_proposed") || context.params_.isMember ("rt_accounts"))
{
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (
hash_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (
context.params_.isMember ("accounts_proposed")
? context.params_["accounts_proposed"]
: context.params_["rt_accounts"]); // DEPRECATED
@@ -105,7 +105,7 @@ Json::Value doUnsubscribe (RPC::Context& context)
if (context.params_.isMember ("accounts"))
{
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
hash_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
if (usnaAccoundIds.empty ())
{

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <unordered_map>
#include <utility>
#include <ripple/module/rpc/ErrorCodes.h>
@@ -42,7 +41,7 @@ namespace detail {
class ErrorCategory
{
public:
typedef ripple::unordered_map <error_code_i, ErrorInfo> Map;
typedef hash_map <error_code_i, ErrorInfo> Map;
ErrorCategory ()
: m_unknown (rpcUNKNOWN, "unknown", "An unknown error code.")

View File

@@ -28,7 +28,7 @@ namespace RPC {
class ManagerImp : public Manager
{
public:
typedef ripple::unordered_map <std::string, handler_type> Map;
typedef hash_map <std::string, handler_type> Map;
beast::Journal m_journal;
Map m_map;

View File

@@ -22,9 +22,9 @@
namespace ripple {
namespace RPC {
ripple::unordered_set<RippleAddress> parseAccountIds (const Json::Value& jvArray)
hash_set<RippleAddress> parseAccountIds (const Json::Value& jvArray)
{
ripple::unordered_set<RippleAddress> usnaResult;
hash_set<RippleAddress> usnaResult;
for (Json::Value::const_iterator it = jvArray.begin (); it != jvArray.end (); it++)
{

View File

@@ -23,7 +23,7 @@
namespace ripple {
namespace RPC {
ripple::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
hash_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
} // RPC
} // ripple

View File

@@ -24,6 +24,7 @@
#include <ripple/common/Resolver.h>
#include <ripple/common/seconds_clock.h>
#include <ripple/common/UnorderedContainers.h>
#include <ripple/peerfinder/api/Callback.h>
#include <ripple/peerfinder/api/Manager.h>
#include <ripple/resource/api/Manager.h>
@@ -49,14 +50,12 @@ class OverlayImpl
private:
typedef boost::asio::ip::tcp::socket socket_type;
typedef std::unordered_map <PeerFinder::Slot::ptr,
std::weak_ptr <PeerImp>> PeersBySlot;
typedef hash_map <PeerFinder::Slot::ptr,
std::weak_ptr <PeerImp>> PeersBySlot;
typedef ripple::unordered_map <
RippleAddress, Peer::ptr> PeerByPublicKey;
typedef hash_map <RippleAddress, Peer::ptr> PeerByPublicKey;
typedef std::unordered_map <
Peer::ShortId, Peer::ptr> PeerByShortId;
typedef hash_map <Peer::ShortId, Peer::ptr> PeerByShortId;
std::recursive_mutex m_mutex;

View File

@@ -32,7 +32,6 @@
#include <functional>
#include <map>
#include <unordered_map>
namespace ripple {
namespace PeerFinder {

View File

@@ -38,8 +38,7 @@ class Network
public:
typedef std::list <Node> Peers;
typedef ripple::unordered_map <
IP::Endpoint, boost::reference_wrapper <Node>> Table;
typedef hash_map <IP::Endpoint, boost::reference_wrapper <Node>> Table;
explicit Network (Params const& params,
Journal journal = Journal());

View File

@@ -31,8 +31,8 @@ class Logic
{
private:
typedef beast::abstract_clock <std::chrono::seconds> clock_type;
typedef ripple::unordered_map <std::string, Import> Imports;
typedef ripple::unordered_map <Key, Entry, Key::hasher, Key::key_equal> Table;
typedef hash_map <std::string, Import> Imports;
typedef hash_map <Key, Entry, Key::hasher, Key::key_equal> Table;
typedef beast::List <Entry> EntryIntrusiveList;
struct State

View File

@@ -33,7 +33,7 @@ namespace SiteFiles {
class Section
{
public:
typedef ripple::unordered_map <std::string, std::string> MapType;
typedef hash_map <std::string, std::string> MapType;
typedef std::vector <std::string> DataType;
Section(int = 0); // dummy argument for emplace()

View File

@@ -24,7 +24,6 @@
#include <ripple/common/UnorderedContainers.h>
#include <string>
#include <unordered_map>
namespace ripple {
namespace SiteFiles {
@@ -34,7 +33,7 @@ class SiteFile
public:
SiteFile (int = 0); // dummy argument for emplace
typedef ripple::unordered_map <std::string, Section> SectionsType;
typedef hash_map <std::string, Section> SectionsType;
/** Retrieve a section by name. */
/** @{ */

View File

@@ -62,7 +62,7 @@ class Logic
{
public:
typedef std::set <Listener*> Listeners;
typedef ripple::unordered_map <beast::URL, SiteFile> SiteFiles;
typedef hash_map <beast::URL, SiteFile> SiteFiles;
struct State
{

View File

@@ -41,7 +41,7 @@ public:
typedef typename State::UniqueID UniqueID;
typedef std::vector <Message> Messages;
typedef ripple::unordered_set <UniqueID> MessageTable;
typedef hash_set <UniqueID> MessageTable;
/** Create the 'no connection' object. */
ConnectionType ()

View File

@@ -42,7 +42,7 @@ public:
typedef ConnectionType <Config> Connection;
typedef std::vector <Connection> Connections;
typedef ripple::unordered_set <UniqueID> MessageTable;
typedef hash_set <UniqueID> MessageTable;
explicit PeerType (Network& network)
: m_network (network)

View File

@@ -411,7 +411,7 @@ public:
}
};
typedef ripple::unordered_map <Peer, Logic> PeerMap;
typedef hash_map <Peer, Logic> PeerMap;
BasicNetwork()
{

View File

@@ -51,7 +51,7 @@ public:
/** Value hashing function.
The seed prevents crafted inputs from causing degenarate parent containers.
*/
typedef beast::hardened_hash <IdentifierStorage> hasher;
typedef beast::hardened_hash <> hasher;
/** Container equality testing function. */
class key_equal

View File

@@ -20,8 +20,7 @@
#ifndef RIPPLE_TYPES_BASICS
#define RIPPLE_TYPES_BASICS
#include <unordered_set>
#include <ripple/common/UnorderedContainers.h>
#include <ripple/types/api/base_uint.h>
namespace ripple {
@@ -47,8 +46,8 @@ typedef base_uint<160, detail::CurrencyTag> Currency;
/** NodeID is a 160-bit hash representing one node. */
typedef base_uint<160, detail::NodeIDTag> NodeID;
typedef std::unordered_set<Currency> CurrencySet;
typedef std::unordered_set<NodeID> NodeIDSet;
typedef hash_set<Currency> CurrencySet;
typedef hash_set<NodeID> NodeIDSet;
/** A special account that's used as the "issuer" for XRP. */
Account const& xrpAccount();

View File

@@ -98,7 +98,7 @@ public:
/** Value hashing function.
The seed prevents crafted inputs from causing degenarate parent containers.
*/
typedef beast::hardened_hash <base_uint> hasher;
typedef beast::hardened_hash <> hasher;
/** Container equality testing function. */
class key_equal
@@ -532,7 +532,7 @@ struct hash<ripple::base_uint<Bits, Tag>>
std::size_t
operator()(argument_type const& u) const
{
return beast::hardened_hash<argument_type>{}(u);
return beast::hardened_hash<>{}(u);
}
};

View File

@@ -21,8 +21,6 @@
#include <beast/unit_test/suite.h>
#include <boost/unordered_set.hpp>
#include <set>
#include <typeinfo>
#include <unordered_set>
@@ -222,11 +220,11 @@ public:
testIssueSet <std::unordered_set <IssueRef>> ();
#endif
testcase ("ripple::unordered_set <Issue>");
testIssueSet <ripple::unordered_set <Issue>> ();
testcase ("hash_set <Issue>");
testIssueSet <hash_set <Issue>> ();
testcase ("ripple::unordered_set <IssueRef>");
testIssueSet <ripple::unordered_set <IssueRef>> ();
testcase ("hash_set <IssueRef>");
testIssueSet <hash_set <IssueRef>> ();
}
void testIssueMaps ()
@@ -244,11 +242,11 @@ public:
testcase ("std::unordered_map <IssueRef, int>");
testIssueMap <std::unordered_map <IssueRef, int>> ();
testcase ("ripple::unordered_map <Issue, int>");
testIssueMap <ripple::unordered_map <Issue, int>> ();
testcase ("hash_map <Issue, int>");
testIssueMap <hash_map <Issue, int>> ();
testcase ("ripple::unordered_map <IssueRef, int>");
testIssueMap <ripple::unordered_map <IssueRef, int>> ();
testcase ("hash_map <IssueRef, int>");
testIssueMap <hash_map <IssueRef, int>> ();
#endif
}
@@ -425,11 +423,11 @@ public:
testBookSet <std::unordered_set <BookRef>> ();
#endif
testcase ("ripple::unordered_set <Book>");
testBookSet <ripple::unordered_set <Book>> ();
testcase ("hash_set <Book>");
testBookSet <hash_set <Book>> ();
testcase ("ripple::unordered_set <BookRef>");
testBookSet <ripple::unordered_set <BookRef>> ();
testcase ("hash_set <BookRef>");
testBookSet <hash_set <BookRef>> ();
}
void testBookMaps ()
@@ -447,11 +445,11 @@ public:
testcase ("std::unordered_map <BookRef, int>");
testBookMap <std::unordered_map <BookRef, int>> ();
testcase ("ripple::unordered_map <Book, int>");
testBookMap <ripple::unordered_map <Book, int>> ();
testcase ("hash_map <Book, int>");
testBookMap <hash_map <Book, int>> ();
testcase ("ripple::unordered_map <BookRef, int>");
testBookMap <ripple::unordered_map <BookRef, int>> ();
testcase ("hash_map <BookRef, int>");
testBookMap <hash_map <BookRef, int>> ();
#endif
}

View File

@@ -38,7 +38,6 @@
#include <boost/program_options.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/unordered_set.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/thread/shared_mutex.hpp>

View File

@@ -20,8 +20,6 @@
#ifndef RIPPLE_NET_H_INCLUDED
#define RIPPLE_NET_H_INCLUDED
#include <boost/unordered_set.hpp> // For InfoSub
#include <boost/asio.hpp>
#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER /**/

View File

@@ -29,7 +29,6 @@
#include <iomanip>
#include <random>
#include <set>
#include <unordered_set>
#include <boost/array.hpp>
#include <boost/optional.hpp>

View File

@@ -20,8 +20,6 @@
#ifndef RIPPLE_TESTOVERLAY_H_INCLUDED
#define RIPPLE_TESTOVERLAY_H_INCLUDED
#include <boost/unordered_set.hpp>
#include <beast/module/core/core.h>
#include <memory>

View File

@@ -35,9 +35,6 @@
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <boost/unordered_set.hpp>
#include <ripple/types/impl/Base58.cpp>
#include <ripple/types/impl/ByteOrder.cpp>

View File

@@ -26,7 +26,6 @@
#include <boost/utility/base_from_member.hpp>
#include <boost/functional/hash.hpp>
#include <boost/unordered_set.hpp>
// For ByteOrder
#if BEAST_WIN32

View File

@@ -22,7 +22,6 @@
#include <ripple/unity/validators.h>
#include <boost/regex.hpp>
#include <boost/unordered_set.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/key_extractors.hpp>

View File

@@ -37,8 +37,7 @@ public:
}
};
typedef ripple::unordered_map <RipplePublicKey, Info,
beast::hardened_hash<RipplePublicKey>> MapType;
typedef hardened_hash_map <RipplePublicKey, Info> MapType;
ChosenList (std::size_t expectedSize = 0)
{

View File

@@ -21,7 +21,6 @@
#define RIPPLE_VALIDATORS_LOGIC_H_INCLUDED
#include <memory>
#include <unordered_map>
namespace ripple {
namespace Validators {
@@ -68,9 +67,7 @@ public:
// Holds the internal list of trusted validators
//
typedef ripple::unordered_map <
RipplePublicKey, Validator,
beast::hardened_hash<RipplePublicKey>> ValidatorTable;
typedef hardened_hash_map <RipplePublicKey, Validator> ValidatorTable;
ValidatorTable m_validators;
// Filters duplicate validations

View File

@@ -67,8 +67,7 @@ template <class Key,
class CycledMap
{
private:
typedef ripple::unordered_map <
Key, T, Hash, KeyEqual, Allocator> ContainerType;
typedef hash_map <Key, T, Hash, KeyEqual, Allocator> ContainerType;
typedef typename ContainerType::iterator iterator;
public:

View File

@@ -42,9 +42,8 @@ private:
/** Holds the state of all recent ledgers for this validator. */
/** @{ */
typedef CycledMap <RippleLedgerHash, Ledger, Count,
beast::hardened_hash<RippleLedgerHash>,
RippleLedgerHash::key_equal> LedgerMap;
typedef CycledMap <RippleLedgerHash, Ledger, Count, beast::hardened_hash<>,
RippleLedgerHash::key_equal> LedgerMap;
LedgerMap m_ledgers;
/** @} */