Track cluster load and local load separately.

This commit is contained in:
JoelKatz
2013-07-09 10:07:49 -07:00
parent e4c02aa122
commit cc8af2275d
7 changed files with 52 additions and 8 deletions

View File

@@ -43,9 +43,12 @@ public:
virtual Json::Value getJson (uint64 baseFee, uint32 referenceFeeUnits) = 0;
virtual void setClusterFee (uint32) = 0;
virtual uint32 getClusterFee () = 0;
virtual bool raiseLocalFee () = 0;
virtual bool lowerLocalFee () = 0;
virtual bool isLoaded () = 0;
virtual bool isLoadedLocal () = 0;
virtual bool isLoadedCluster () = 0;
};
#endif

View File

@@ -80,7 +80,19 @@ public:
return std::max (mLocalTxnLoadFee, mRemoteTxnLoadFee);
}
bool isLoaded ()
void setClusterFee (uint32 fee)
{
boost::mutex::scoped_lock sl (mLock);
mClusterTxnLoadFee = fee;
}
uint32 getClusterFee ()
{
boost::mutex::scoped_lock sl (mLock);
return mClusterTxnLoadFee;
}
bool isLoadedLocal ()
{
// VFALCO TODO This could be replaced with a SharedData and
// using a read/write lock instead of a critical section.
@@ -92,6 +104,18 @@ public:
return (raiseCount != 0) || (mLocalTxnLoadFee != lftNormalFee);
}
bool isLoadedCluster ()
{
// VFALCO TODO This could be replaced with a SharedData and
// using a read/write lock instead of a critical section.
//
// NOTE This applies to all the locking in this class.
//
//
boost::mutex::scoped_lock sl (mLock);
return (raiseCount != 0) || (mLocalTxnLoadFee != lftNormalFee) || (mClusterTxnLoadFee != lftNormalFee);
}
void setRemoteFee (uint32 f)
{
boost::mutex::scoped_lock sl (mLock);
@@ -181,6 +205,7 @@ private:
uint32 mLocalTxnLoadFee; // Scale factor, lftNormalFee = normal fee
uint32 mRemoteTxnLoadFee; // Scale factor, lftNormalFee = normal fee
uint32 mClusterTxnLoadFee; // Scale factor, lftNormalFee = normal fee
int raiseCount;
boost::mutex mLock;