mr

package
v0.0.0-...-185bb6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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.

func MapFinished

func MapFinished(filename string, rpcID int)

func ReduceFinished

func ReduceFinished(taskNo int, rpcID int)

func Worker

func Worker(mapf func(string, string) []KeyValue,
	reducef func(string, []string) string)

main/mrworker.go calls this function.

Types

type ExampleArgs

type ExampleArgs struct {
	X int
}

type ExampleReply

type ExampleReply struct {
	Y int
}

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

Map functions return a slice of KeyValue.

type KeyValues

type KeyValues []KeyValue

func (KeyValues) Len

func (a KeyValues) Len() int

for sorting by key.

func (KeyValues) Less

func (a KeyValues) Less(i, j int) bool

func (KeyValues) Swap

func (a KeyValues) Swap(i, j int)

type MapFinishedArgs

type MapFinishedArgs struct {
	MapFilename string
	RPCID       int
}

type MapFinishedReply

type MapFinishedReply struct{}

type Master

type Master struct {
	MapperTask     map[string]int
	MapFinished    int
	ReducerTask    map[int]int
	ReduceFinished int
	// contains filtered or unexported fields
}

Master FileMap: filename -> unstarted:0 / working:1

func MakeMaster

func MakeMaster(files []string, nReduce int) *Master

create a Master. main/mrmaster.go calls this function. nReduce is the number of reduce tasks to use.

func (*Master) Done

func (m *Master) Done() bool

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) MapFinish

func (m *Master) MapFinish(args *MapFinishedArgs, reply *MapFinishedReply) error

func (*Master) ReduceFinish

func (m *Master) ReduceFinish(args *ReduceFinishedArgs, reply *ReduceFinishedReply) error

func (*Master) TaskAssign

func (m *Master) TaskAssign(args *TaskAssignArgs, reply *TaskAssignReply) error

type ReduceFinishedArgs

type ReduceFinishedArgs struct {
	ReduceTaskNo int
	RPCID        int
}

type ReduceFinishedReply

type ReduceFinishedReply struct{}

type TaskAssignArgs

type TaskAssignArgs struct{}

type TaskAssignReply

type TaskAssignReply struct {
	RPCID    int
	Filename string
	TaskType string
	TaskNo   int
}

func TaskRequest

func TaskRequest() *TaskAssignReply

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL