Track uptime. Update local fee schedule based on load manager.

This commit is contained in:
JoelKatz
2013-02-05 21:33:42 -08:00
parent 1b2c0b9242
commit 5aa810404b
8 changed files with 128 additions and 3 deletions

View File

@@ -86,6 +86,9 @@ protected:
int mDebitWarn; // when a source drops below this, we warn
int mDebitLimit; // when a source drops below this, we cut it off (should be negative)
bool mShutdown;
int mUptime;
mutable boost::mutex mLock;
void canonicalize(LoadSource&, const time_t now) const;
@@ -94,9 +97,13 @@ protected:
void addLoadCost(const LoadCost& c) { mCosts[static_cast<int>(c.mType)] = c; }
void threadEntry();
public:
LoadManager(int creditRate = 10, int creditLimit = 50, int debitWarn = -50, int debitLimit = -100);
~LoadManager();
void init();
int getCreditRate() const;
int getCreditLimit() const;
@@ -113,6 +120,7 @@ public:
bool adjust(LoadSource&, LoadType l) const;
int getCost(LoadType t) { return mCosts[static_cast<int>(t)].mCost; }
int getUptime();
};
class LoadFeeTrack