elections

package
v6.3.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FaultTimeout int = 60 // This value only lasts till the command line is parse which will set it.
View Source
var RoundTimeout int = 20 // This value only lasts till the command line is parse which will set it.

Functions

func CheckAuthSetsMatch

func CheckAuthSetsMatch(caller string, e *Elections, s *state.State)

Check that the process list and Election Authority Sets match

func MaxIdx

func MaxIdx(priority []interfaces.IHash) (idx int)

Returns the index of the maximum priority entry

func Order

func Order(servers []interfaces.IServer, dbheight int, minute int, serverIdx int) (priority []interfaces.IHash)

Creates an order for all servers by using a certain hash function. The list of unordered hashes (in the same order as the slice of servers) is returned.

func Run

func Run(s *state.State)

Runs the main loop for elections for this instance of factomd

Types

type Elections

type Elections struct {
	FedID     interfaces.IHash
	Name      string
	Sync      []bool // List of servers that have Synced
	Federated []interfaces.IServer
	Audit     []interfaces.IServer
	FPriority []interfaces.IHash
	APriority []interfaces.IHash
	DBHeight  int               // Height of this election
	SigType   bool              // False for dbsig, true for EOM
	Minute    int               // Minute of this election (-1 for a DBSig)
	VMIndex   int               // VMIndex of this election
	Msgs      []interfaces.IMsg // Messages we are collecting in this election.  Look here for what's missing.
	Input     interfaces.IQueue
	Output    interfaces.IQueue
	Round     []int
	Electing  int // This is the federated Server index that we are looking to replace
	State     interfaces.IState

	VName string
	Msg   interfaces.IMsg // The missing message as supplied by the volunteer
	Ack   interfaces.IMsg // The missing ack for the message as supplied by the volunteer

	Sigs [][]interfaces.IHash // Signatures from the Federated Servers for a given round.

	Adapter interfaces.IElectionAdapter

	// Timeout period before we start the election
	Timeout time.Duration
	// Timeout for the next audit to volunteer
	RoundTimeout time.Duration

	FaultId atomic.AtomicInt // Incremented every time we launch a new timeout

	// Messages that are not valid. They can be processed when an election finishes
	Waiting chan interfaces.IElectionMsg
	// contains filtered or unexported fields
}

func (*Elections) AddAuditServer

func (e *Elections) AddAuditServer(server interfaces.IServer) int

func (*Elections) AddFederatedServer

func (e *Elections) AddFederatedServer(server interfaces.IServer) int

func (*Elections) AddSigs

func (e *Elections) AddSigs(round int, sigs []interfaces.IHash)

Add the given sig list to the list of signatures for the given round.

func (*Elections) AuditAdapterIndex

func (e *Elections) AuditAdapterIndex(server interfaces.IHash) int

func (*Elections) AuditIndex

func (e *Elections) AuditIndex(server interfaces.IHash) int

Returns the index of the given server. -1 if it isn't a Audit Server

func (*Elections) AuditPriority

func (e *Elections) AuditPriority() int

func (*Elections) ComparisonMinute

func (e *Elections) ComparisonMinute() int

func (*Elections) FeedBackStr

func (e *Elections) FeedBackStr(v string, fed bool, index int) string

func (*Elections) GetAdapter

func (e *Elections) GetAdapter() interfaces.IElectionAdapter

func (*Elections) GetAudServerIndex

func (e *Elections) GetAudServerIndex(server interfaces.IServer) int

func (*Elections) GetAuditServers

func (e *Elections) GetAuditServers() []interfaces.IServer

func (*Elections) GetElecting

func (e *Elections) GetElecting() int

func (*Elections) GetFedID

func (e *Elections) GetFedID() interfaces.IHash

func (*Elections) GetFedServerIndex

func (e *Elections) GetFedServerIndex(server interfaces.IServer) int

func (*Elections) GetFederatedServers

func (e *Elections) GetFederatedServers() []interfaces.IServer

func (*Elections) GetRound

func (e *Elections) GetRound() []int

func (*Elections) GetVMIndex

func (e *Elections) GetVMIndex() int

func (*Elections) LeaderIndex

func (e *Elections) LeaderIndex(server interfaces.IHash) int

Returns the index of the given server. -1 if it isn't a Federated Server

func (*Elections) LogMessage

func (e *Elections) LogMessage(logName string, comment string, msg interfaces.IMsg)

func (*Elections) LogPrintLeaders

func (e *Elections) LogPrintLeaders(log string)

func (*Elections) LogPrintf

func (e *Elections) LogPrintf(logName string, format string, more ...interface{})

func (*Elections) NewFeedback

func (e *Elections) NewFeedback()

func (*Elections) Print

func (e *Elections) Print()

func (*Elections) ProcessWaiting

func (e *Elections) ProcessWaiting()

ProcessWaiting drains all waiting messages into the input

func (*Elections) RemoveAuditServer

func (e *Elections) RemoveAuditServer(server interfaces.IServer)

func (*Elections) RemoveFederatedServer

func (e *Elections) RemoveFederatedServer(server interfaces.IServer)

func (*Elections) SetElections3

func (e *Elections) SetElections3()

func (*Elections) Sort

func (*Elections) Sort(serv []interfaces.IServer) bool

func (*Elections) String

func (e *Elections) String() string

type FaultId

type FaultId struct {
	Dbheight int
	Minute   int
	Round    int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL