forked from FactomProject/factomd
/
elections.go
66 lines (55 loc) · 1.68 KB
/
elections.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package interfaces
type IElections interface {
GetFedID() IHash
GetElecting() int
GetVMIndex() int
GetRound() []int
GetFederatedServers() []IServer
GetAuditServers() []IServer
GetAdapter() IElectionAdapter
String() string
}
type IElectionAdapter interface {
Execute(IMsg) IMsg
GetDBHeight() int
GetMinute() int
GetElecting() int
GetVMIndex() int
MessageLists() string
Status() string
VolunteerControlsStatus() string
// An observer does not participate in election voting
IsObserver() bool
SetObserver(o bool)
// Processed indicates the election swap happened
IsElectionProcessed() bool
SetElectionProcessed(swapped bool)
IsStateProcessed() bool
SetStateProcessed(swapped bool)
GetAudits() []IHash
}
type IElectionMsg interface {
IMsg
ElectionProcess(IState, IElections)
ElectionValidate(IElections) int
}
type IFedVoteMsg interface {
ComparisonMinute() int
}
type ISignableElectionMsg interface {
IElectionMsg
Signable
GetVolunteerMessage() ISignableElectionMsg
}
type IElectionsFactory interface {
// Messages
NewAddLeaderInternal(Name string, dbheight uint32, serverID IHash) IMsg
NewAddAuditInternal(name string, dbheight uint32, serverID IHash) IMsg
NewRemoveLeaderInternal(name string, dbheight uint32, serverID IHash) IMsg
NewRemoveAuditInternal(name string, dbheight uint32, serverID IHash) IMsg
NewEomSigInternal(name string, dbheight uint32, minute uint32, vmIndex int, height uint32, serverID IHash) IMsg
NewDBSigSigInternal(name string, dbheight uint32, minute uint32, vmIndex int, height uint32, serverID IHash) IMsg
NewAuthorityListInternal(feds []IServer, auds []IServer, height uint32) IMsg
//
// NewElectionAdapter(el IElections) IElectionAdapter
}