-
Notifications
You must be signed in to change notification settings - Fork 71
/
msg.go
65 lines (55 loc) · 1.17 KB
/
msg.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
package epaxos
import (
"encoding/gob"
"fmt"
"github.com/ailidani/paxi"
)
func init() {
gob.Register(PreAccept{})
gob.Register(PreAcceptReply{})
gob.Register(Accept{})
gob.Register(AcceptReply{})
gob.Register(Commit{})
}
type PreAccept struct {
Ballot paxi.Ballot
Replica paxi.ID
Slot int
Command paxi.Command
Seq int
Dep map[paxi.ID]int
}
func (m PreAccept) String() string {
return fmt.Sprintf("PreAccept {bal=%d id=%s s=%d cmd=%v seq=%d dep=%v}", m.Ballot, m.Replica, m.Slot, m.Command, m.Seq, m.Dep)
}
type PreAcceptReply struct {
Ballot paxi.Ballot
Replica paxi.ID
Slot int
Seq int
Dep map[paxi.ID]int
Committed map[paxi.ID]int
}
func (m PreAcceptReply) String() string {
return fmt.Sprintf("PreAcceptReply {bal=%d id=%s s=%d seq=%d dep=%v c=%v}", m.Ballot, m.Replica, m.Slot, m.Seq, m.Dep, m.Committed)
}
type Accept struct {
Ballot paxi.Ballot
Replica paxi.ID
Slot int
Seq int
Dep map[paxi.ID]int
}
type AcceptReply struct {
Ballot paxi.Ballot
Replica paxi.ID
Slot int
}
type Commit struct {
Ballot paxi.Ballot
Replica paxi.ID
Slot int
Command paxi.Command
Seq int
Dep map[paxi.ID]int
}