Documentation ¶
Index ¶
- func CallExample()
- func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string)
- type ExampleReply
- type ExampleReq
- type FinishTaskReply
- type FinishTaskReq
- type GetTaskReply
- type GetTaskReq
- type KeyValue
- type Master
- func (m *Master) Done() bool
- func (m *Master) Example(args *ExampleReq, reply *ExampleReply) error
- func (m *Master) FinishTask(req *FinishTaskReq, reply *FinishTaskReply) error
- func (m *Master) GetTask(req *GetTaskReq, reply *GetTaskReply) error
- func (m *Master) RegisterWorker(req *RegisterReq, reply *RegisterReply) error
- type RegisterReply
- type RegisterReq
- type Task
- type TaskStatus
- type TaskType
Constants ¶
This section is empty.
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 ExampleReply ¶
type ExampleReply struct {
Y int
}
type ExampleReq ¶
type ExampleReq struct {
X int
}
type FinishTaskReply ¶
type FinishTaskReply struct { }
type FinishTaskReq ¶
type FinishTaskReq struct { WorkerID int TaskID int TaskType TaskType TaskStatus TaskStatus }
type GetTaskReply ¶
type GetTaskReply struct {
Task *Task
}
type GetTaskReq ¶
type GetTaskReq struct {
WorkerID int
}
type Master ¶
type Master struct {
// contains filtered or unexported fields
}
必须所有的map操作做完后才能进行reduce
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 *ExampleReq, reply *ExampleReply) error
an example RPC handler.
the RPC argument and reply types are defined in rpc.go.
func (*Master) FinishTask ¶
func (m *Master) FinishTask(req *FinishTaskReq, reply *FinishTaskReply) error
func (*Master) GetTask ¶
func (m *Master) GetTask(req *GetTaskReq, reply *GetTaskReply) error
func (*Master) RegisterWorker ¶
func (m *Master) RegisterWorker(req *RegisterReq, reply *RegisterReply) error
Your code here -- RPC handlers for the worker to call.
type RegisterReply ¶
type RegisterReply struct {
WorkerID int
}
type Task ¶
type Task struct { WorkerID int TaskID int TaskType TaskType TaskStatus TaskStatus FileName string NMaps int NReduce int Alive bool }
!!!go中涉及到RPC调用时,变量一律开头字母大写,要不然无法传输!!!
type TaskStatus ¶
type TaskStatus int
const ( //go中默认初始化是0 TaskInit TaskStatus = 0 TaskReady TaskStatus = 1 TaskRunning TaskStatus = 2 TaskFinished TaskStatus = 3 TaskError TaskStatus = 4 )
Click to show internal directories.
Click to hide internal directories.