Documentation ¶
Index ¶
- Constants
- type Clerk
- type ClerkMsgId
- type Config
- type Err
- type ExeResult
- type JoinArgs
- type JoinReply
- type LeaveArgs
- type LeaveReply
- type Method
- 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 TypeClientId
- type TypeOpId
Constants ¶
View Source
const ( OK = "OK" ErrWrongLeader = "ErrWrongLeader" ErrTimeout = "ErrTimeout" InvalidConfigNum = 0 InvalidGID = 0 )
View Source
const ( JOIN = "Join" LEAVE = "Leave" MOVE = "Move" QUERY = "Query" )
View Source
const NShards = 10
The number of shards.
View Source
const TryNextServerInterval = 20 * time.Millisecond
View Source
const WaitOpTimeOut = time.Millisecond * 500
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClerkMsgId ¶
type ClerkMsgId int64
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.
type JoinArgs ¶
type JoinArgs struct { Servers map[int][]string // new GID -> servers mappings ClientId TypeClientId MsgId ClerkMsgId }
type LeaveArgs ¶
type LeaveArgs struct { GIDs []int ClientId TypeClientId MsgId ClerkMsgId }
type LeaveReply ¶
type MoveArgs ¶
type MoveArgs struct { Shard int GID int ClientId TypeClientId MsgId ClerkMsgId }
type MoveReply ¶
type MoveReply struct { WrongLeader bool Err Err ClientId TypeClientId MsgId ClerkMsgId }
type Op ¶
type Op struct { // Your data here. Method Method JoinArgs JoinArgs LeaveArgs LeaveArgs MoveArgs MoveArgs QueryArgs QueryArgs ClientId TypeClientId MsgId ClerkMsgId // ServerId + OpId is unique for each op ServerId int OpId TypeOpId }
type QueryArgs ¶
type QueryArgs struct { Num int // desired config number ClientId TypeClientId MsgId ClerkMsgId }
type QueryReply ¶
type ShardMaster ¶
type ShardMaster struct {
// contains filtered or unexported fields
}
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)
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)
type TypeClientId ¶
type TypeClientId int64
Click to show internal directories.
Click to hide internal directories.