Documentation
¶
Index ¶
- Constants
- func CallExample()
- func PingPong()
- func Register() uint64
- func Report(res *ResultReq)
- func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string)
- type ByKey
- type Dispatcher
- type ExampleArgs
- type ExampleReply
- type GetTaskReq
- type GetTaskRes
- type JobState
- type KeyValue
- type Master
- func (m *Master) Done() bool
- func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error
- func (m *Master) GetTaskWorker(args *GetTaskReq, reply *GetTaskRes) error
- func (m *Master) PingPong(args *Ping, reply *Pong) error
- func (m *Master) RegisterWorker(args *RegisterReq, reply *RegisterRes) error
- func (m *Master) ReportResult(args *ResultReq, reply *ResultRes) error
- type Ping
- type Pong
- type ReduceSource
- type RegisterReq
- type RegisterRes
- type ResultReq
- type ResultRes
- type Task
- type TaskConf
- type TaskPool
- type WorkerSession
Constants ¶
View Source
const ( CallRegister = "Master.RegisterWorker" CallPingPong = "Master.PingPong" CallGetTask = "Master.GetTaskWorker" CallReport = "Master.ReportResult" )
Variables ¶
This section is empty.
Functions ¶
func CallExample ¶
func CallExample()
Types ¶
type Dispatcher ¶
type Dispatcher struct { TimeOut time.Duration //默认10秒 M *Master //主节点全局结构 ReduceSourceChan chan *ReduceSource // 发送 reduce 的任务 执行内容 CleanWorkerChan chan uint64 // 清理失效的worker }
定时清理器
type ExampleArgs ¶
type ExampleArgs struct {
X int
}
type ExampleReply ¶
type ExampleReply struct {
Y int
}
type GetTaskRes ¶
type JobState ¶
type JobState struct { MatrixSource [][]string // MC * RC MC int RC int MCDone int32 // contains filtered or unexported fields }
Job 状态
type Master ¶
主节点
func (*Master) Done ¶
main/mrmaster.go calls Done() periodically to find out if the entire job has finished.
func (*Master) Example ¶
func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error
an example RPC handler.
func (*Master) GetTaskWorker ¶
func (m *Master) GetTaskWorker(args *GetTaskReq, reply *GetTaskRes) error
func (*Master) RegisterWorker ¶
func (m *Master) RegisterWorker(args *RegisterReq, reply *RegisterRes) error
type ReduceSource ¶
type RegisterRes ¶
type RegisterRes struct {
WorkerID uint64
}
type ResultReq ¶
type ResultReq struct { WorkerID uint64 Code int // 0 代表 map 1 代表 reduce 2代表 失败 Msg string M []string }
返回结果
type Task ¶
type Task struct { Status int // 0 未完成 1工作中 2已完成 Type int // 0 map 任务 1 reduce 任务 2 shut down 3 retry Conf *TaskConf }
任务
Click to show internal directories.
Click to hide internal directories.