Documentation ¶
Index ¶
- Constants
- func DPrintf(format string, a ...interface{}) (n int, err error)
- type Clerk
- type Config
- type Err
- type JoinArgs
- type JoinReply
- type LeaveArgs
- type LeaveReply
- type MoveArgs
- type MoveReply
- type Op
- type QueryArgs
- type QueryReply
- type ShardMaster
- func (sm *ShardMaster) Join(args *JoinArgs, reply *JoinReply)
- func (sm *ShardMaster) Kill()
- func (sm *ShardMaster) Leave(args *LeaveArgs, reply *LeaveReply)
- func (sm *ShardMaster) Move(args *MoveArgs, reply *MoveReply)
- func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply)
- func (sm *ShardMaster) Raft() *raft.Raft
- type Type
Constants ¶
const ( OK = "OK" ErrTimeOut = "ErrTimeOut" )
const Debug = 0
Debugging
const NShards = 10
The number of shards.
const WaitCommandInterval = time.Millisecond * 500
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Num int // config number Shards [NShards]int // shard -> gid Groups map[int][]string // gid -> servers[] }
A configuration -- an assignment of shards to groups. Please don't change this. shard 和 gid是多对一的关系,gid 和 servers是一对多的关系
type LeaveReply ¶
type QueryReply ¶
type ShardMaster ¶
type ShardMaster struct {
// contains filtered or unexported fields
}
参考其他人的设计 Lab4换了一种风格,简化了RPC请求处理方面
func StartServer ¶
servers[] contains the ports of the set of servers that will cooperate via Paxos to form the fault-tolerant shardmaster service. me is the index of the current server in servers[].
func (*ShardMaster) Join ¶
func (sm *ShardMaster) Join(args *JoinArgs, reply *JoinReply)
bug修复4A:interface {} is *shardmaster.JoinArgs, not shardmaster.JoinArgs
func (*ShardMaster) Kill ¶
func (sm *ShardMaster) Kill()
the tester calls Kill() when a ShardMaster instance won't be needed again. you are not required to do anything in Kill(), but it might be convenient to (for example) turn off debug output from this instance.
func (*ShardMaster) Leave ¶
func (sm *ShardMaster) Leave(args *LeaveArgs, reply *LeaveReply)
func (*ShardMaster) Move ¶
func (sm *ShardMaster) Move(args *MoveArgs, reply *MoveReply)
func (*ShardMaster) Query ¶
func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply)
Query操作不会进行updateConfig,所以要单独处理