-
Notifications
You must be signed in to change notification settings - Fork 25
/
accept.go
69 lines (54 loc) · 1.14 KB
/
accept.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
67
68
69
package message
import (
"fmt"
)
type Accept struct {
ReplicaId uint8
InstanceId uint64
Cmds Commands
Deps Dependencies
Ballot *Ballot
From uint8
}
type AcceptReply struct {
ReplicaId uint8
InstanceId uint64
Ballot *Ballot
From uint8
}
func (a *Accept) Sender() uint8 {
return a.From
}
func (a *Accept) Type() uint8 {
return AcceptMsg
}
func (a *Accept) Content() interface{} {
return a
}
func (p *Accept) Replica() uint8 {
return p.ReplicaId
}
func (p *Accept) Instance() uint64 {
return p.InstanceId
}
func (p *Accept) String() string {
return fmt.Sprintf("Accept, Instance[%v][%v], Ballot[%v]", p.ReplicaId, p.InstanceId, p.Ballot.String())
}
func (a *AcceptReply) Sender() uint8 {
return a.From
}
func (a *AcceptReply) Type() uint8 {
return AcceptReplyMsg
}
func (a *AcceptReply) Content() interface{} {
return a
}
func (p *AcceptReply) Replica() uint8 {
return p.ReplicaId
}
func (p *AcceptReply) Instance() uint64 {
return p.InstanceId
}
func (p *AcceptReply) String() string {
return fmt.Sprintf("AcceptReply, Instance[%v][%v], Ballot[%v]", p.ReplicaId, p.InstanceId, p.Ballot.String())
}