Move some operations from the I/O queue to the Job queue

This commit is contained in:
JoelKatz
2014-01-07 12:14:34 -08:00
committed by Vinnie Falco
parent e25a83bb39
commit 1e5963aeeb
5 changed files with 14 additions and 17 deletions

View File

@@ -847,7 +847,7 @@ public:
private:
/** We have a new last closed ledger, process it. Final accept logic
*/
void accept (SHAMap::ref set, LoadEvent::pointer)
void accept (SHAMap::pointer set)
{
if (set->getHash ().isNonZero ())
// put our set where others can get it later
@@ -1832,14 +1832,11 @@ private:
(mPeerPositions.size (), mCurrentMSeconds, mNewLedgerHash);
if (synchronous)
accept (consensusSet, LoadEvent::pointer ());
accept (consensusSet);
else
{ // FIXME: Post to JobQueue, not I/O service
getApp().getIOService ().post
(BIND_TYPE (&LedgerConsensusImp::accept
, shared_from_this (), consensusSet
, getApp().getJobQueue ().getLoadEvent
(jtACCEPTLEDGER, "LedgerConsensusImp::beginAccept")));
{
getApp().getJobQueue().addJob (jtACCEPT, "acceptLedger",
BIND_TYPE (&LedgerConsensusImp::accept, shared_from_this (), consensusSet));
}
}

View File

@@ -740,8 +740,7 @@ void NetworkOPsImp::submitTransaction (Job&, SerializedTransaction::pointer iTra
}
}
// FIXME: Should submit to job queue
getApp().getIOService ().post (boost::bind (&NetworkOPsImp::processTransaction, this,
getApp().getJobQueue().addJob (jtTRANSACTION, "submitTxn", boost::bind (&NetworkOPsImp::processTransaction, this,
boost::make_shared<Transaction> (trans, false), false, false, callback));
}

View File

@@ -58,7 +58,7 @@ void TransactionAcquire::done ()
map = mMap;
}
getApp().getIOService ().post (BIND_TYPE (&TACompletionHandler, mHash, map));
getApp().getJobQueue().addJob (jtTXN_DATA, "completeAcquire", BIND_TYPE (&TACompletionHandler, mHash, map));
}
void TransactionAcquire::onTimer (bool progress, ScopedLockType& psl)

View File

@@ -119,6 +119,7 @@ const char* Job::toString (JobType t)
case jtWAL: return "writeAhead";
case jtVALIDATION_t: return "trustedValidation";
case jtWRITE: return "writeObjects";
case jtACCEPT: return "acceptLedger";
case jtPROPOSAL_t: return "trustedProposal";
case jtSWEEP: return "sweep";
case jtNETOP_CLUSTER: return "clusterReport";
@@ -129,7 +130,6 @@ const char* Job::toString (JobType t)
// special types not dispatched by the job pool
case jtPEER: return "peerCommand";
case jtDISK: return "diskAccess";
case jtACCEPTLEDGER: return "acceptLedger";
case jtTXN_PROC: return "processTransaction";
case jtOB_SETUP: return "orderBookSetup";
case jtPATH_FIND: return "pathFind";

View File

@@ -44,11 +44,12 @@ enum JobType
jtWAL = 16, // Write-ahead logging
jtVALIDATION_t = 17, // A validation from a trusted source
jtWRITE = 18, // Write out hashed objects
jtPROPOSAL_t = 19, // A proposal from a trusted source
jtSWEEP = 20, // Sweep for stale structures
jtNETOP_CLUSTER = 21, // NetworkOPs cluster peer report
jtNETOP_TIMER = 22, // NetworkOPs net timer processing
jtADMIN = 23, // An administrative operation
jtACCEPT = 19, // Accept a consensus ledger
jtPROPOSAL_t = 20, // A proposal from a trusted source
jtSWEEP = 21, // Sweep for stale structures
jtNETOP_CLUSTER = 22, // NetworkOPs cluster peer report
jtNETOP_TIMER = 23, // NetworkOPs net timer processing
jtADMIN = 24, // An administrative operation
// special types not dispatched by the job pool
jtPEER = 30,