Documentation ¶
Index ¶
- Constants
- func CallExample()
- func DPrintf(format string, v ...interface{})
- func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string)
- type ByKey
- type ExampleArgs
- type ExampleReply
- type KeyValue
- type Master
- func (m *Master) Done() bool
- func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error
- func (m *Master) GenerateOneTask(taskSeq int) Task
- func (m *Master) GetOneTask(args *TaskArgs, reply *TaskReply) error
- func (m *Master) InitMapTasks()
- func (m *Master) InitReduceTasks()
- func (m *Master) RegOneTask(args *TaskArgs, task *Task)
- func (m *Master) RegWorker(args *RegisterArgs, reply *RegisterReply) error
- func (m *Master) ReportTask(args *ReportTaskArgs, reply *ReportTaskReply) error
- func (m *Master) Schedule()
- func (m *Master) TickSchedule()
- type RegisterArgs
- type RegisterReply
- type ReportTaskArgs
- type ReportTaskReply
- type Task
- type TaskArgs
- type TaskPhase
- type TaskReply
- type TaskStatus
Constants ¶
View Source
const ( TaskStatusReady = 0 //just created, waited to be put into tack Channel of the master TaskStatusQueue = 1 //waiting for an idle worker's request to execute it TaskStatusRunning = 2 //running in some worker TaskStatusDone = 3 //done by the worker TaskStatusErr = 4 //err in the worker )
View Source
const ( MaxTaskRunTime = time.Second * 10 ScheduleInterval = time.Millisecond * 500 )
View Source
const Debug = false
common
Variables ¶
This section is empty.
Functions ¶
func CallExample ¶
func CallExample()
example function to show how to make an RPC call to the master.
the RPC argument and reply types are defined in rpc.go.
Types ¶
type ExampleArgs ¶
type ExampleArgs struct {
X int
}
type ExampleReply ¶
type ExampleReply struct {
Y int
}
type Master ¶
type Master struct { TotalNumReduce int // contains filtered or unexported fields }
func MakeMaster ¶
create a Master. main/mrmaster.go calls this function. nReduce is the number of reduce tasks to use.
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.
the RPC argument and reply types are defined in rpc.go.
func (*Master) GenerateOneTask ¶
func (*Master) InitMapTasks ¶
func (m *Master) InitMapTasks()
func (*Master) InitReduceTasks ¶
func (m *Master) InitReduceTasks()
func (*Master) RegOneTask ¶
func (*Master) RegWorker ¶
func (m *Master) RegWorker(args *RegisterArgs, reply *RegisterReply) error
func (*Master) ReportTask ¶
func (m *Master) ReportTask(args *ReportTaskArgs, reply *ReportTaskReply) error
func (*Master) Schedule ¶
func (m *Master) Schedule()
maintain taskArray, assign tasks to workers called at regular time, called when a worker sends a report
func (*Master) TickSchedule ¶
func (m *Master) TickSchedule()
type RegisterArgs ¶
type RegisterArgs struct { }
type RegisterReply ¶
type RegisterReply struct {
WorkerId int
}
type ReportTaskArgs ¶
type ReportTaskArgs struct { Status TaskStatus Seq int Phase TaskPhase WorkerId int }
type ReportTaskReply ¶
type ReportTaskReply struct { }
type TaskStatus ¶
type TaskStatus int
Click to show internal directories.
Click to hide internal directories.