Merge branch 'develop' into feature-keyvadb

Conflicts:
	src/cpp/ripple/ripple_TransactionAcquire.cpp
This commit is contained in:
JoelKatz
2013-07-22 13:32:10 -07:00
15 changed files with 82 additions and 63 deletions

View File

@@ -40,15 +40,9 @@ JobType Job::getType () const
void Job::doJob ()
{
m_loadEvent->start ();
m_loadEvent->reName (mName);
mJob (*this);
// VFALCO TODO Isn't there a way to construct the load event with
// the proper name? This way the load event object
// can have the invariant "name is always set"
//
m_loadEvent->reName (mName);
}
void Job::rename (std::string const& newName)
@@ -61,6 +55,11 @@ int Job::getLimit () const
return m_limit;
}
LoadEvent& Job::peekEvent() const
{
return *m_loadEvent;
}
const char* Job::toString (JobType t)
{
switch (t)
@@ -131,6 +130,9 @@ const char* Job::toString (JobType t)
case jtTXN_PROC:
return "processTransaction";
case jtTXN_DATA:
return "fetchTxnData";
case jtOB_SETUP:
return "orderBookSetup";
@@ -143,6 +145,9 @@ const char* Job::toString (JobType t)
case jtHO_WRITE:
return "nodeWrite";
case jtSWEEP:
return "sweep";
default:
assert (false);
return "unknown";

View File

@@ -17,20 +17,21 @@ enum JobType
jtPUBOLDLEDGER = 2, // An old ledger has been accepted
jtVALIDATION_ut = 3, // A validation from an untrusted source
jtPROOFWORK = 4, // A proof of work demand from another server
jtPROPOSAL_ut = 5, // A proposal from an untrusted source
jtLEDGER_DATA = 6, // Received data for a ledger we're acquiring
jtUPDATE_PF = 7, // Update pathfinding requests
jtCLIENT = 8, // A websocket command from the client
jtTRANSACTION = 9, // A transaction received from the network
jtPUBLEDGER = 10, // Publish a fully-accepted ledger
jtWAL = 11, // Write-ahead logging
jtVALIDATION_t = 12, // A validation from a trusted source
jtWRITE = 13, // Write out hashed objects
jtTRANSACTION_l = 14, // A local transaction
jtPROPOSAL_t = 15, // A proposal from a trusted source
jtSWEEP = 16, // Sweep for stale structures
jtADMIN = 17, // An administrative operation
jtDEATH = 18, // job of death, used internally
jtTRANSACTION_l = 5, // A local transaction
jtPROPOSAL_ut = 6, // A proposal from an untrusted source
jtLEDGER_DATA = 7, // Received data for a ledger we're acquiring
jtUPDATE_PF = 8, // Update pathfinding requests
jtCLIENT = 9, // A websocket command from the client
jtTRANSACTION = 10, // A transaction received from the network
jtPUBLEDGER = 11, // Publish a fully-accepted ledger
jtTXN_DATA = 12, // Fetch a proposed set
jtWAL = 13, // Write-ahead logging
jtVALIDATION_t = 14, // A validation from a trusted source
jtWRITE = 15, // Write out hashed objects
jtPROPOSAL_t = 16, // A proposal from a trusted source
jtSWEEP = 17, // Sweep for stale structures
jtADMIN = 18, // An administrative operation
jtDEATH = 19, // job of death, used internally
// special types not dispatched by the job pool
jtPEER = 24,
@@ -81,6 +82,8 @@ public:
int getLimit () const;
LoadEvent& peekEvent() const;
// These comparison operators make the jobs sort in priority order in the job set
bool operator< (const Job& j) const;
bool operator> (const Job& j) const;

View File

@@ -44,7 +44,9 @@ void JobQueue::addLimitJob (JobType type, const std::string& name, int limit, co
if (type != jtCLIENT) // FIXME: Workaround incorrect client shutdown ordering
assert (mThreadCount != 0); // do not add jobs to a queue with no threads
mJobSet.insert (Job (type, name, limit, ++mLastJob, mJobLoads[type], jobFunc));
std::pair< std::set <Job>::iterator, bool > it =
mJobSet.insert (Job (type, name, limit, ++mLastJob, mJobLoads[type], jobFunc));
it.first->peekEvent().start(); // start timing how long it stays in the queue
++mJobCounts[type].first;
mJobCond.notify_one ();
}