Documentation
¶
Index ¶
Constants ¶
View Source
const ( OK = "OK" ErrNoKey = "ErrNoKey" ErrWrongServer = "ErrWrongServer" )
View Source
const ( PUT = "Put" APPEND = "Append" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clerk ¶
type Clerk struct {
// Your declarations here
Primary string
// contains filtered or unexported fields
}
func (*Clerk) Append ¶
tell the primary to append to key's value. must keep trying until it succeeds.
func (*Clerk) Get ¶
fetch a key's value from the current primary; if they key has never been set, return "". Get() must keep trying until it either the primary replies with the value or the primary says the key doesn't exist (has never been Put().
func (*Clerk) RefreshPrimary ¶
func (ck *Clerk) RefreshPrimary()
type PBServer ¶
type PBServer struct {
// contains filtered or unexported fields
}
func StartServer ¶
func (*PBServer) PutAppend ¶
func (pb *PBServer) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error
func (*PBServer) TransferAll ¶
func (pb *PBServer) TransferAll(args *TransferAllArgs, reply *TransferAllReply) error
func (*PBServer) TransferToBackup ¶
func (pb *PBServer) TransferToBackup()
type PutAppendArgs ¶
type PutAppendArgs struct {
Key string
Value string
// You'll have to add definitions here.
Type string //PUT/APPEND
RandID int64 //随机数
Direct bool //primary转发or直接请求
}
Put or Append
type PutAppendReply ¶
type PutAppendReply struct {
Err Err
}
type TransferAllReply ¶
type TransferAllReply struct {
Err Err
}
Click to show internal directories.
Click to hide internal directories.