Documentation
¶
Index ¶
- Constants
- func Debug(topic logTopic, format string, a ...interface{})
- func GetRandomKey(mp map[int][]string) int
- type Clerk
- type Config
- type Err
- type JoinArgs
- type JoinReply
- type LeaveArgs
- type LeaveReply
- type MoveArgs
- type MoveReply
- type Op
- type OpResult
- type OpType
- type QueryArgs
- type QueryReply
- type ShardCtrler
- func (sc *ShardCtrler) Join(args *JoinArgs, reply *JoinReply)
- func (sc *ShardCtrler) Kill()
- func (sc *ShardCtrler) Leave(args *LeaveArgs, reply *LeaveReply)
- func (sc *ShardCtrler) Move(args *MoveArgs, reply *MoveReply)
- func (sc *ShardCtrler) Query(args *QueryArgs, reply *QueryReply)
- func (sc *ShardCtrler) Raft() *raft.Raft
Constants ¶
View Source
const NShards = 10
The number of shards.
View Source
const (
OK = "OK"
)
Variables ¶
This section is empty.
Functions ¶
func GetRandomKey ¶
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.
func CopyConfig ¶
type LeaveReply ¶
type QueryReply ¶
type ShardCtrler ¶
type ShardCtrler struct {
// contains filtered or unexported fields
}
func StartServer ¶
servers[] 数组包含一组服务器的端口号,这些服务器将通过 Raft 协作 形成容错的 shardctrler 服务。me 是当前服务器在 servers[] 数组中的索引。
func (*ShardCtrler) Join ¶
func (sc *ShardCtrler) Join(args *JoinArgs, reply *JoinReply)
func (*ShardCtrler) Kill ¶
func (sc *ShardCtrler) Kill()
当不再需要 ShardCtrler 实例时,测试程序会调用 Kill() 方法。 在 Kill() 方法中,您不需要执行任何操作,但可能会方便一些(例如) 关闭此实例的调试输出。
func (*ShardCtrler) Leave ¶
func (sc *ShardCtrler) Leave(args *LeaveArgs, reply *LeaveReply)
func (*ShardCtrler) Move ¶
func (sc *ShardCtrler) Move(args *MoveArgs, reply *MoveReply)
func (*ShardCtrler) Query ¶
func (sc *ShardCtrler) Query(args *QueryArgs, reply *QueryReply)
Click to show internal directories.
Click to hide internal directories.