-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconsensus_message_type.go
More file actions
39 lines (35 loc) · 965 Bytes
/
consensus_message_type.go
File metadata and controls
39 lines (35 loc) · 965 Bytes
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
package dbft
import "fmt"
// MessageType is a type for dBFT consensus messages.
type MessageType byte
// 7 following constants enumerate all possible type of consensus message.
const (
ChangeViewType MessageType = 0x00
PrepareRequestType MessageType = 0x20
PrepareResponseType MessageType = 0x21
PreCommitType MessageType = 0x31
CommitType MessageType = 0x30
RecoveryRequestType MessageType = 0x40
RecoveryMessageType MessageType = 0x41
)
// String implements fmt.Stringer interface.
func (m MessageType) String() string {
switch m {
case ChangeViewType:
return "ChangeView"
case PrepareRequestType:
return "PrepareRequest"
case PrepareResponseType:
return "PrepareResponse"
case CommitType:
return "Commit"
case PreCommitType:
return "PreCommit"
case RecoveryRequestType:
return "RecoveryRequest"
case RecoveryMessageType:
return "RecoveryMessage"
default:
return fmt.Sprintf("UNKNOWN(%02x)", byte(m))
}
}