Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Represents the collection of votes associated with a given CGovernanceObject Recently received votes are held in memory until a maximum size is reached after which older votes a flushed to a disk file. More...
#include <governance-votedb.h>
Public Types | |
typedef std::list< CGovernanceVote > | vote_l_t |
typedef vote_l_t::iterator | vote_l_it |
typedef vote_l_t::const_iterator | vote_l_cit |
typedef std::map< uint256, vote_l_it > | vote_m_t |
typedef vote_m_t::iterator | vote_m_it |
typedef vote_m_t::const_iterator | vote_m_cit |
Public Member Functions | |
CGovernanceObjectVoteFile () | |
CGovernanceObjectVoteFile (const CGovernanceObjectVoteFile &other) | |
void | AddVote (const CGovernanceVote &vote) |
Add a vote to the file. More... | |
bool | HasVote (const uint256 &nHash) const |
Return true if the vote with this hash is currently cached in memory. More... | |
bool | SerializeVoteToStream (const uint256 &nHash, CDataStream &ss) const |
Retrieve a vote cached in memory. More... | |
int | GetVoteCount () |
std::vector< CGovernanceVote > | GetVotes () const |
void | RemoveVotesFromMasternode (const COutPoint &outpointMasternode) |
std::set< uint256 > | RemoveInvalidVotes (const COutPoint &outpointMasternode, bool fProposal) |
template<typename Stream , typename Operation > | |
void | SerializationOp (Stream &s, Operation ser_action) |
Public Attributes | |
ADD_SERIALIZE_METHODS | |
Private Member Functions | |
void | RemoveOldVotes (const CGovernanceVote &vote) |
void | RebuildIndex () |
Private Attributes | |
int | nMemoryVotes |
vote_l_t | listVotes |
vote_m_t | mapVoteIndex |
Detailed Description
Represents the collection of votes associated with a given CGovernanceObject Recently received votes are held in memory until a maximum size is reached after which older votes a flushed to a disk file.
Note: This is a stub implementation that doesn't limit the number of votes held in memory and doesn't flush to disk.
Definition at line 24 of file governance-votedb.h.
Member Typedef Documentation
◆ vote_l_cit
typedef vote_l_t::const_iterator CGovernanceObjectVoteFile::vote_l_cit |
Definition at line 31 of file governance-votedb.h.
◆ vote_l_it
typedef vote_l_t::iterator CGovernanceObjectVoteFile::vote_l_it |
Definition at line 29 of file governance-votedb.h.
◆ vote_l_t
typedef std::list<CGovernanceVote> CGovernanceObjectVoteFile::vote_l_t |
Definition at line 27 of file governance-votedb.h.
◆ vote_m_cit
typedef vote_m_t::const_iterator CGovernanceObjectVoteFile::vote_m_cit |
Definition at line 37 of file governance-votedb.h.
◆ vote_m_it
typedef vote_m_t::iterator CGovernanceObjectVoteFile::vote_m_it |
Definition at line 35 of file governance-votedb.h.
◆ vote_m_t
typedef std::map<uint256, vote_l_it> CGovernanceObjectVoteFile::vote_m_t |
Definition at line 33 of file governance-votedb.h.
Constructor & Destructor Documentation
◆ CGovernanceObjectVoteFile() [1/2]
CGovernanceObjectVoteFile::CGovernanceObjectVoteFile | ( | ) |
Definition at line 7 of file governance-votedb.cpp.
◆ CGovernanceObjectVoteFile() [2/2]
CGovernanceObjectVoteFile::CGovernanceObjectVoteFile | ( | const CGovernanceObjectVoteFile & | other | ) |
Definition at line 14 of file governance-votedb.cpp.
References RebuildIndex().
Member Function Documentation
◆ AddVote()
void CGovernanceObjectVoteFile::AddVote | ( | const CGovernanceVote & | vote | ) |
Add a vote to the file.
Definition at line 22 of file governance-votedb.cpp.
References CGovernanceVote::GetHash(), HasVote(), listVotes, mapVoteIndex, nMemoryVotes, and RemoveOldVotes().
Referenced by CGovernanceObject::ProcessVote().
◆ GetVoteCount()
|
inline |
Definition at line 66 of file governance-votedb.h.
References nMemoryVotes.
Referenced by CGovernanceObject::SerializationOp().
◆ GetVotes()
std::vector< CGovernanceVote > CGovernanceObjectVoteFile::GetVotes | ( | ) | const |
Definition at line 49 of file governance-votedb.cpp.
References listVotes.
Referenced by CGovernanceManager::RebuildIndexes(), and CGovernanceManager::RequestGovernanceObject().
◆ HasVote()
bool CGovernanceObjectVoteFile::HasVote | ( | const uint256 & | nHash | ) | const |
Return true if the vote with this hash is currently cached in memory.
Definition at line 34 of file governance-votedb.cpp.
References mapVoteIndex.
Referenced by AddVote(), CGovernanceManager::HaveVoteForHash(), and CGovernanceObject::ProcessVote().
◆ RebuildIndex()
|
private |
Definition at line 112 of file governance-votedb.cpp.
References CGovernanceVote::GetHash(), listVotes, mapVoteIndex, and nMemoryVotes.
Referenced by CGovernanceObjectVoteFile(), and SerializationOp().
◆ RemoveInvalidVotes()
std::set< uint256 > CGovernanceObjectVoteFile::RemoveInvalidVotes | ( | const COutPoint & | outpointMasternode, |
bool | fProposal | ||
) |
Definition at line 72 of file governance-votedb.cpp.
References listVotes, mapVoteIndex, nMemoryVotes, and VOTE_SIGNAL_FUNDING.
Referenced by CGovernanceObject::RemoveInvalidVotes().
◆ RemoveOldVotes()
|
private |
Definition at line 94 of file governance-votedb.cpp.
References CGovernanceVote::GetMasternodeOutpoint(), CGovernanceVote::GetParentHash(), CGovernanceVote::GetSignal(), CGovernanceVote::GetTimestamp(), listVotes, mapVoteIndex, and nMemoryVotes.
Referenced by AddVote().
◆ RemoveVotesFromMasternode()
void CGovernanceObjectVoteFile::RemoveVotesFromMasternode | ( | const COutPoint & | outpointMasternode | ) |
Definition at line 58 of file governance-votedb.cpp.
References listVotes, mapVoteIndex, and nMemoryVotes.
Referenced by CGovernanceObject::ClearMasternodeVotes().
◆ SerializationOp()
|
inline |
Definition at line 79 of file governance-votedb.h.
References listVotes, nMemoryVotes, READWRITE, and RebuildIndex().
◆ SerializeVoteToStream()
bool CGovernanceObjectVoteFile::SerializeVoteToStream | ( | const uint256 & | nHash, |
CDataStream & | ss | ||
) | const |
Retrieve a vote cached in memory.
Definition at line 39 of file governance-votedb.cpp.
References mapVoteIndex.
Referenced by CGovernanceManager::SerializeVoteForHash().
Member Data Documentation
◆ ADD_SERIALIZE_METHODS
CGovernanceObjectVoteFile::ADD_SERIALIZE_METHODS |
Definition at line 76 of file governance-votedb.h.
◆ listVotes
|
private |
Definition at line 42 of file governance-votedb.h.
Referenced by AddVote(), GetVotes(), RebuildIndex(), RemoveInvalidVotes(), RemoveOldVotes(), RemoveVotesFromMasternode(), and SerializationOp().
◆ mapVoteIndex
|
private |
Definition at line 44 of file governance-votedb.h.
Referenced by AddVote(), HasVote(), RebuildIndex(), RemoveInvalidVotes(), RemoveOldVotes(), RemoveVotesFromMasternode(), and SerializeVoteToStream().
◆ nMemoryVotes
|
private |
Definition at line 40 of file governance-votedb.h.
Referenced by AddVote(), GetVoteCount(), RebuildIndex(), RemoveInvalidVotes(), RemoveOldVotes(), RemoveVotesFromMasternode(), and SerializationOp().
The documentation for this class was generated from the following files:
- src/governance/governance-votedb.h
- src/governance/governance-votedb.cpp