mr

package
v0.0.0-...-2717372 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TaskInterval = 200
View Source
const TaskTimeout = 10
View Source
const TempDir = "tmp"

Variables

This section is empty.

Functions

func Worker

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

main/mrworker.go calls this function.

Types

type GetReduceCountArgs

type GetReduceCountArgs struct {
}

example to show how to declare the arguments and reply for an RPC.

type GetReduceCountReply

type GetReduceCountReply struct {
	ReduceCount int
}

type JobStage

type JobStage int

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

Map functions return a slice of KeyValue.

type Master

type Master struct {
	// contains filtered or unexported fields
}

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

func (m *Master) GetReduceCount(args *GetReduceCountArgs, reply *GetReduceCountReply) error

GetReduceCount RPC handler.

func (*Master) ReportTaskDone

func (m *Master) ReportTaskDone(args *ReportTaskArgs, reply *ReportTaskReply) error

RequestTask RPC handler.

func (*Master) RequestTask

func (m *Master) RequestTask(args *RequestTaskArgs, reply *RequestTaskReply) error

RequestTask RPC handler.

type ReportTaskArgs

type ReportTaskArgs struct {
	WorkerId int
	TaskType TaskType
	TaskId   int
}

type ReportTaskReply

type ReportTaskReply struct {
	CanExit bool
}

type RequestTaskArgs

type RequestTaskArgs struct {
	WorkerId int
}

type RequestTaskReply

type RequestTaskReply struct {
	TaskType TaskType
	TaskId   int
	TaskFile string
}

type Task

type Task struct {
	Type     TaskType
	Status   TaskStatus
	Index    int
	File     string
	WorkerId int
}

type TaskStatus

type TaskStatus int
const (
	NotStarted TaskStatus = iota
	Executing
	Finished
)

type TaskType

type TaskType int
const (
	MapTask TaskType = iota
	ReduceTask
	NoTask
	ExitTask
)

Jump to

Keyboard shortcuts

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