Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExampleArgs ¶
type ExampleArgs struct {
X int
}
type ExampleReply ¶
type ExampleReply struct {
Y int
}
type Master ¶
type Master struct { TaskQueue chan *Task // 等待执行的task TaskMeta map[int]*MasterTask // 当前所有task的信息 MasterPhase State // Master的阶段 NReduce int InputFiles []string Intermediates [][]string // Map任务产生的R个中间文件的信息 }
Part1-3:此外Master存储Map任务产生的R个中间文件的信息
func MakeMaster ¶
Part 2-1:启动master create a Master. main/mrmaster.go calls this function. nReduce is the number of reduce tasks to use.
func (*Master) AssignTask ¶
func (m *Master) AssignTask(args *ExampleArgs, reply *Task) error
Part2-2:master监听worker RPC调用,分配任务 master等待worker调用
func (*Master) Done ¶
Part2-9:master确认所有ReduceTask都已经完成,转入Exit阶段,终止所有master和worker goroutine main/mrmaster.go calls Exit() periodically to find out if the entire job has finished.
func (*Master) TaskCompleted ¶
func (m *Master) TaskCompleted(task *Task, reply *ExampleReply) error
Part2-7:master收到完成后的Task
type MasterTask ¶
type MasterTask struct { TaskStatus MasterTaskStatus StartTime time.Time TaskReference *Task }
Part1-2: Master存储这些Task的信息。与论文不同的是,这里我并没有保留worked的ID,因此master不会主动向worker发送心跳检测
type MasterTaskStatus ¶
type MasterTaskStatus int
Part1-1:每个(Map或者Reduce)Task有分为idle, in-progress, completed 三种状态
const ( Idle MasterTaskStatus = iota InProgress Completed )
Click to show internal directories.
Click to hide internal directories.