mrlib

package
v0.0.0-...-62caf94 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 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)

Types

type FinishedTaskArgs

type FinishedTaskArgs struct {
	// what type of task was the worker assigned?
	TaskType TaskType

	// which task was it ?
	TaskNum int
}

The second RPC finshed worker -> coordinator FinishedTask RPCs are sent from an idle worker to coordinator to indicate that a task has been completed

type GetTaskArgs

type GetTaskArgs struct{}

The first RPC idle worker -> coordinator GetTask RPCs are sent from an idle worker to coordinator to ask the next task to perform

type GetTaskReply

type GetTaskReply struct {
	// what type of the task is this? (map, reduce, done)
	TaskType TaskType

	// task number of ether map/reduce task
	TaskNum int

	// needed for Map (to know which file to write)
	NReduceTask int

	// needed for Map (to know which file to read)
	MapFile string

	// needed for Reduce (to know how many intermediate map file to read)
	NMapTasks int
}

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

type Master

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

func MakeMaster

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

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

func (*Master) Done

func (m *Master) Done() bool

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

type TaskType

type TaskType int

Task type

const (
	Map    TaskType = 1
	Reduce TaskType = 2
	Done   TaskType = 3
)

Jump to

Keyboard shortcuts

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