Documentation ¶
Index ¶
- Constants
- func CallExample()
- func HandleMap(mapf func(string, string) []KeyValue, filename string, filenum int, ...) []string
- func HandleReduce(reducef func(string, []string) string, filenames []string) string
- func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string)
- type ByKey
- type Coordinator
- func (m *Coordinator) Done() bool
- func (m *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error
- func (m *Coordinator) GetTask(args *GetTaskRequest, reply *GetTaskResponse) error
- func (m *Coordinator) HandleTimeout(taskName string)
- func (m *Coordinator) Report(args *ReplyStatusRequest, reply *ReplyStatusResponse) error
- type ExampleArgs
- type ExampleReply
- type GetTaskRequest
- type GetTaskResponse
- type KeyValue
- type ReplyStatusRequest
- type ReplyStatusResponse
- type Task
Constants ¶
View Source
const ( Map = iota Reduce Sleep )
利用iota初始化常量更为优雅
View Source
const ( Working = iota Timeout )
View Source
const ( NotStarted = iota Processing Finished )
Variables ¶
This section is empty.
Functions ¶
func CallExample ¶
func CallExample()
example function to show how to make an RPC call to the coordinator.
the RPC argument and reply types are defined in rpc.go.
func HandleReduce ¶
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
func MakeCoordinator ¶
func MakeCoordinator(files []string, nReduce int) *Coordinator
create a coordinator. main/mrcoordinator.go calls this function. nReduce is the number of reduce tasks to use.
func (*Coordinator) Done ¶
func (m *Coordinator) Done() bool
main/mrcoordinator.go calls Done() periodically to find out if the entire job has finished.
func (*Coordinator) Example ¶
func (m *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error
an example RPC handler.
the RPC argument and reply types are defined in rpc.go.
func (*Coordinator) GetTask ¶
func (m *Coordinator) GetTask(args *GetTaskRequest, reply *GetTaskResponse) error
func (*Coordinator) HandleTimeout ¶
func (m *Coordinator) HandleTimeout(taskName string)
func (*Coordinator) Report ¶
func (m *Coordinator) Report(args *ReplyStatusRequest, reply *ReplyStatusResponse) error
type ExampleArgs ¶
type ExampleArgs struct {
X int
}
type ExampleReply ¶
type ExampleReply struct {
Y int
}
type GetTaskResponse ¶
type ReplyStatusRequest ¶
worker reply
type ReplyStatusResponse ¶
type ReplyStatusResponse struct {
X int
}
Click to show internal directories.
Click to hide internal directories.