Documentation
¶
Index ¶
- Constants
- Variables
- func Color(colorString string) func(...interface{}) string
- func Dlog(format string, a ...interface{}) (n int, err error)
- func MicroSecondNow() int64
- type Clerk
- type Config
- type Err
- type JoinArgs
- type JoinLeaveMoveReply
- type LeaveArgs
- type MoveArgs
- type Op
- type QueryArgs
- type QueryReply
- type Record
- type ShardMaster
- func (sm *ShardMaster) Join(args *JoinArgs, reply *JoinLeaveMoveReply)
- func (sm *ShardMaster) Kill()
- func (sm *ShardMaster) Killed() bool
- func (sm *ShardMaster) Leave(args *LeaveArgs, reply *JoinLeaveMoveReply)
- func (sm *ShardMaster) Move(args *MoveArgs, reply *JoinLeaveMoveReply)
- func (sm *ShardMaster) Persiste()
- func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply)
- func (sm *ShardMaster) Raft() *raft.Raft
Constants ¶
View Source
const ( OK = "OK" ErrNoKey = "ErrNoKey" ErrDupCommand = "ErrDupCommand" ErrStaleLeader = "ErrStaleLeader" ErrWrongLeader = "ErrWrongLeader" ErrNoNewGids = "ErrNoNewGids" ErrInvalidShard = "ErrInvalidShard" ErrGidNotFound = "ErrGidNotFound" ErrConfigNum = "ErrConfigNum" JoinOp = "JoinOp" LeaveOp = "LeaveOp" MoveOp = "MoveOp" QueryOp = "QueryOp" // OpInterval = 100 * time.Millisecond INIT_GID = 0 )
View Source
const NShards = 10
The number of shards.
Variables ¶
View Source
var ( NANO_TO_MILLI = int64(1000000) Black = Color("\033[1;30m%s\033[0m") Red = Color("\033[1;31m%s\033[0m") Blue = Color("\033[0;31m%s\033[0m") Green = Color("\033[1;32m%s\033[0m") Yellow = Color("\033[1;33m%s\033[0m") Purple = Color("\033[1;34m%s\033[0m") Magenta = Color("\033[1;35m%s\033[0m") Teal = Color("\033[1;36m%s\033[0m") White = Color("\033[1;37m%s\033[0m") )
Functions ¶
func MicroSecondNow ¶
func MicroSecondNow() int64
Types ¶
type Clerk ¶
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 JoinLeaveMoveReply ¶
type JoinLeaveMoveReply struct {
Err Err
}
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 *JoinLeaveMoveReply)
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) Killed ¶
func (sm *ShardMaster) Killed() bool
func (*ShardMaster) Leave ¶
func (sm *ShardMaster) Leave(args *LeaveArgs, reply *JoinLeaveMoveReply)
func (*ShardMaster) Move ¶
func (sm *ShardMaster) Move(args *MoveArgs, reply *JoinLeaveMoveReply)
func (*ShardMaster) Persiste ¶
func (sm *ShardMaster) Persiste()
func (*ShardMaster) Query ¶
func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply)
Click to show internal directories.
Click to hide internal directories.