mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Efficiently save validations.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef __VALIDATION_COLLECTION__
|
||||
#define __VALIDATION_COLLECTION__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
@@ -12,14 +14,19 @@ typedef boost::unordered_map<uint160, SerializedValidation::pointer> ValidationS
|
||||
|
||||
class ValidationCollection
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
|
||||
boost::mutex mValidationLock;
|
||||
boost::unordered_map<uint256, ValidationSet> mValidations;
|
||||
boost::unordered_map<uint160, SerializedValidation::pointer> mCurrentValidations;
|
||||
std::vector<SerializedValidation::pointer> mStaleValidations;
|
||||
bool mWriting;
|
||||
|
||||
void doWrite();
|
||||
void condWrite();
|
||||
|
||||
public:
|
||||
ValidationCollection() { ; }
|
||||
ValidationCollection() : mWriting(false) { ; }
|
||||
|
||||
bool addValidation(SerializedValidation::pointer);
|
||||
ValidationSet getValidations(const uint256& ledger);
|
||||
@@ -27,6 +34,7 @@ public:
|
||||
int getTrustedValidationCount(const uint256& ledger);
|
||||
int getCurrentValidationCount(uint32 afterTime);
|
||||
boost::unordered_map<uint256, int> getCurrentValidations();
|
||||
void flush();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user