-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
42 lines (36 loc) · 781 Bytes
/
common.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
package kvraft
const (
OK = "OK"
ErrNoKey = "ErrNoKey"
ErrDupCommand = "ErrDupCommand"
ErrStaleLeader = "ErrStaleLeader"
ErrWrongLeader = "ErrWrongLeader"
GetOp = "GET"
PutOp = "Put"
AppendOp = "Append"
)
type Err string
// Put or Append
type PutAppendArgs struct {
Key string
Value string
Op string // "Put" or "Append"
SerialNumber int64
ClientID int
// You'll have to add definitions here.
// Field names must start with capital letters,
// otherwise RPC will break.
}
type PutAppendReply struct {
Err Err
}
type GetArgs struct {
Key string
ClientID int
SerialNumber int64
// You'll have to add definitions here.
}
type GetReply struct {
Err Err
Value string
}