Documentation
¶
Index ¶
- type Ballots
- type Results
- func (r *Results) AddPossibleVote(v *Vote) bool
- func (r Results) Expressed() int
- func (r Results) GetPeriodID() uint64
- func (r *Results) GetPoll() (leaders Votes, scores ScoreMap, err error)
- func (r *Results) HasMajority(vote *Vote) bool
- func (r *Results) ProcessVoter(voter *peer.Peer, forBlockID model.Hash) bool
- func (r *Results) RegisterBallots(list Ballots, forPeriodID uint64) bool
- type Score
- type ScoreMap
- type Scores
- type Vote
- type Votes
- type Winner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Results ¶
type Results struct {
OwnVote *Vote
// contains filtered or unexported fields
}
Results holds the result of the vote
To vote for a specific period, you should prepare the results beforehand
results := NewResults(nil)
if results.RegisterBallots(list, onPeriodID) {
results.ProcessVoter(p1, bk1)
[...]
results.ProcessVoter(pN, bkN)
leaders, scores, err := results.GetPoll()
}
func (*Results) AddPossibleVote ¶
AddPossibleVote adds a vote after the results were prepared, returning `true` if the vote was actually added to the pool of already existing possible votes NB: Use with caution
func (*Results) ProcessVoter ¶
ProcessVoter casts a vote to the ballot
Click to show internal directories.
Click to hide internal directories.