mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Structure to charge and credit for load types.
This commit is contained in:
@@ -70,6 +70,7 @@ bool LoadManager::shouldWarn(LoadSource& source) const
|
||||
canonicalize(source, now);
|
||||
if (source.isPrivileged() || (source.mBalance < mDebitWarn) || (source.mLastWarning == now))
|
||||
return false;
|
||||
|
||||
source.mLastWarning = now;
|
||||
return true;
|
||||
}
|
||||
@@ -84,7 +85,7 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
|
||||
}
|
||||
|
||||
bool LoadManager::adjust(LoadSource& source, int credits) const
|
||||
{
|
||||
{ // return: true = need to warn/cutoff
|
||||
time_t now = time(NULL);
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
bool shouldWarn(LoadSource&) const;
|
||||
bool shouldCutoff(LoadSource&) const;
|
||||
bool adjust(LoadSource&, int credits) const; // return value: false = balance okay, true = warn/cutoff
|
||||
bool adjust(LoadSource&, int credits) const; // return value: false=balance okay, true=warn/cutoff
|
||||
};
|
||||
|
||||
class LoadFeeTrack
|
||||
@@ -73,14 +73,10 @@ protected:
|
||||
|
||||
uint32 mLocalTxnLoadFee; // Scale factor, lftNormalFee = normal fee
|
||||
uint32 mRemoteTxnLoadFee; // Scale factor, lftNormalFee = normal fee
|
||||
uint32 mPeerLoadSchedule; // Schedule setting, 0 = normal schedule
|
||||
uint32 mClientLoadSchedule; // Schedule setting, 0 = normal schedule
|
||||
|
||||
public:
|
||||
|
||||
LoadFeeTrack()
|
||||
: mLocalTxnLoadFee(lftNormalFee), mRemoteTxnLoadFee(lftNormalFee), mPeerLoadSchedule(0), mClientLoadSchedule(0)
|
||||
{ ; }
|
||||
LoadFeeTrack() : mLocalTxnLoadFee(lftNormalFee), mRemoteTxnLoadFee(lftNormalFee) { ; }
|
||||
|
||||
uint64 scaleFee(uint64 fee);
|
||||
|
||||
|
||||
27
src/cpp/ripple/LoadTypes.h
Normal file
27
src/cpp/ripple/LoadTypes.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef LOADTYPES__H
|
||||
#define LOADTYPES__H
|
||||
|
||||
enum LoadType
|
||||
{ // types of load that can be placed on the server
|
||||
|
||||
// Bad things
|
||||
LT_InvalidRequest, // A request that we can immediately tell is invalid
|
||||
LT_RequestNoReply, // A request that we cannot satisfy
|
||||
LT_InvalidSignature, // An object whose signature we had to check and it failed
|
||||
LT_UnwantedData, // Data we have no use for
|
||||
|
||||
// Good things
|
||||
LT_NewTrusted, // A new transaction/validation/proposal we trust
|
||||
LT_NewTransaction, // A new, valid transaction
|
||||
LT_NeededData, // Data we requested
|
||||
|
||||
// Requests
|
||||
LT_RequestData, // A request that is hard to satisfy, disk access
|
||||
LT_CheapQuery, // A query that is trivial, cached data
|
||||
};
|
||||
|
||||
static const int LoadCategoryDisk = 1;
|
||||
static const int LoadCategoryCPU = 2;
|
||||
static const int LoadCateogryNetwork = 4;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user