Documentation ¶
Index ¶
- func BubbleSortLeaderLevelMsg(arr []*messages.LeaderLevelMessage)
- type DepthLeaderLevel
- type Display
- func (a *Display) Copy(be *Election) *Display
- func (d *Display) DetectIllegalVote(leader primitives.Identity) bool
- func (d *Display) DetectIllegalVotes() (loops int)
- func (d *Display) DetectLoopForLeader(leader primitives.Identity) bool
- func (d *Display) DetectLoops() (loops int)
- func (d *Display) DetectVerticalLoop(leader primitives.Identity) bool
- func (d *Display) Execute(msg imessage.IMessage)
- func (d *Display) FormatLeaderLevelMsg(msg *messages.LeaderLevelMessage) string
- func (d *Display) FormatLeaderLevelMsgShort(msg *messages.LeaderLevelMessage) string
- func (d *Display) FormatMessage(msg imessage.IMessage) string
- func (d *Display) FormatVolunteerMsg(msg *messages.VolunteerMessage) string
- func (d *Display) FormatVoteMsg(msg *messages.VoteMessage) string
- func (d *Display) Lock()
- func (d *Display) RLock()
- func (d *Display) RUnlock()
- func (d *Display) ResetIdentifier(ele *Election)
- func (d *Display) String() string
- func (d *Display) Unlock()
- type Election
- func (e *Election) AddDisplay(global *Display) *Display
- func (a *Election) Copy() *Election
- func (e *Election) Execute(msg imessage.IMessage, depth int) (imessage.IMessage, bool)
- func (e *Election) NormalizedString() []byte
- func (e *Election) PrintMessages() string
- func (e *Election) SetObserver(o bool)
- func (e *Election) StateString() []byte
- func (e *Election) StateVCDataset() [][]messages.LeaderLevelMessage
- func (e *Election) StateVotes() []int
- func (e *Election) VolunteerControlString() string
- type RoutingElection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BubbleSortLeaderLevelMsg ¶
func BubbleSortLeaderLevelMsg(arr []*messages.LeaderLevelMessage)
***************
***************
Types ¶
type DepthLeaderLevel ¶
type DepthLeaderLevel struct { Msg *messages.LeaderLevelMessage VoteMsg *messages.VoteMessage Depth int }
func NewDepthLeaderLevel ¶
func NewDepthLeaderLevel(ll *messages.LeaderLevelMessage, depth int) *DepthLeaderLevel
func (*DepthLeaderLevel) Copy ¶
func (d *DepthLeaderLevel) Copy() *DepthLeaderLevel
type Display ¶
type Display struct { Identifier string Votes [][]string FedList []primitives.Identity primitives.AuthSet Global *Display // contains filtered or unexported fields }
Display is a 2D array containing all the votes seen by all leaders
func NewDisplay ¶
func (*Display) DetectIllegalVote ¶
func (d *Display) DetectIllegalVote(leader primitives.Identity) bool
DetectIllegalVote will detect if the vote sequence is valid
true ==> Illegal vote
func (*Display) DetectIllegalVotes ¶
func (*Display) DetectLoopForLeader ¶
func (d *Display) DetectLoopForLeader(leader primitives.Identity) bool
func (*Display) DetectVerticalLoop ¶
func (d *Display) DetectVerticalLoop(leader primitives.Identity) bool
detectVerticalLoop detects if leader # is looping vertically
func (*Display) FormatLeaderLevelMsg ¶
func (d *Display) FormatLeaderLevelMsg(msg *messages.LeaderLevelMessage) string
func (*Display) FormatLeaderLevelMsgShort ¶
func (d *Display) FormatLeaderLevelMsgShort(msg *messages.LeaderLevelMessage) string
func (*Display) FormatVolunteerMsg ¶
func (d *Display) FormatVolunteerMsg(msg *messages.VolunteerMessage) string
func (*Display) FormatVoteMsg ¶
func (d *Display) FormatVoteMsg(msg *messages.VoteMessage) string
func (*Display) ResetIdentifier ¶
type Election ¶
type Election struct { // Level 0 volunteer votes map[vol]map[leader]msg VolunteerVotes map[Identity]map[Identity]*messages.VoteMessage // Indexed by volunteer VolunteerControls map[Identity]*volunteercontrol.VolunteerControl CurrentLevel int CurrentVote messages.LeaderLevelMessage Self Identity AuthSet // Used for debugging and seeing history MsgListIn []*DepthLeaderLevel MsgListOut []*DepthLeaderLevel Display *Display // If I have committed to an answer and found enough to finish Election Committed bool // Some statistical info TotalMessages int // Each time I vote for the same vol in the next level CommitmentTally int // An observer never participates in an election, but can watch (audit or follower) Observer bool }
func NewElection ¶
func NewElection(self Identity, authset AuthSet) *Election
func (*Election) AddDisplay ¶
AddDisplay takes a global tracker. Send nil if you don't care about a global state
func (*Election) NormalizedString ¶
func (*Election) PrintMessages ¶
func (*Election) SetObserver ¶
func (*Election) StateString ¶
func (*Election) StateVCDataset ¶
func (e *Election) StateVCDataset() [][]messages.LeaderLevelMessage
func (*Election) StateVotes ¶
func (*Election) VolunteerControlString ¶
type RoutingElection ¶
type RoutingElection struct {
*Election
}
RoutingElection is just an election that returns msgs for broadcasting
func NewRoutingElection ¶
func NewRoutingElection(e *Election) *RoutingElection
Click to show internal directories.
Click to hide internal directories.