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< CGovernanceVotevote_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_itvote_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< CGovernanceVoteGetVotes () const
 
void RemoveVotesFromMasternode (const COutPoint &outpointMasternode)
 
std::set< uint256RemoveInvalidVotes (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

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

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()

int CGovernanceObjectVoteFile::GetVoteCount ( )
inline

Definition at line 66 of file governance-votedb.h.

References nMemoryVotes.

Referenced by CGovernanceObject::SerializationOp().

◆ GetVotes()

std::vector< CGovernanceVote > CGovernanceObjectVoteFile::GetVotes ( ) const

◆ 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()

void CGovernanceObjectVoteFile::RebuildIndex ( )
private

◆ RemoveInvalidVotes()

std::set< uint256 > CGovernanceObjectVoteFile::RemoveInvalidVotes ( const COutPoint outpointMasternode,
bool  fProposal 
)

◆ RemoveOldVotes()

void CGovernanceObjectVoteFile::RemoveOldVotes ( const CGovernanceVote vote)
private

◆ 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()

template<typename Stream , typename Operation >
void CGovernanceObjectVoteFile::SerializationOp ( Stream &  s,
Operation  ser_action 
)
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

vote_l_t CGovernanceObjectVoteFile::listVotes
private

◆ mapVoteIndex

vote_m_t CGovernanceObjectVoteFile::mapVoteIndex
private

◆ nMemoryVotes

int CGovernanceObjectVoteFile::nMemoryVotes
private

The documentation for this class was generated from the following files:
Released under the MIT license