mr

package
v0.0.0-...-3691d1c Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 ByKey

type ByKey []KeyValue

func (ByKey) Len

func (a ByKey) Len() int

for sorting by key.

func (ByKey) Less

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

func (ByKey) Swap

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

type CallArgs

type CallArgs struct {
	TaskIndex             int
	TaskType              int
	IntermediateFileNames []string
}

Add your RPC definitions here.

type CallReply

type CallReply struct {
	TaskType              int
	TaskIndex             int
	FileName              string
	NReduce               int
	IntermediateFileNames []string
}

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 (c *Coordinator) Done() bool

main/mrcoordinator.go calls Done() periodically to find out if the entire job has finished.

func (*Coordinator) FinishTask

func (c *Coordinator) FinishTask(args *CallArgs, reply *CallReply) error

func (*Coordinator) GetTask

func (c *Coordinator) GetTask(args *CallArgs, reply *CallReply) error

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

Map functions return a slice of KeyValue.

type Task

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

type TaskStatus

type TaskStatus int
const (
	Idle       TaskStatus = 0
	InProgress TaskStatus = 1
	Completed  TaskStatus = 2
)

type TaskType

type TaskType int
const (
	MapTask    TaskType = 0
	ReduceTask TaskType = 1
	Done       TaskType = 2
	Goose      TaskType = 3
)

Jump to

Keyboard shortcuts

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