mr

package
v0.0.0-...-c15ff4a Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAPPER_NOT_STARTED  = 0
	MAPPER_IN_PROGRESS  = 1
	MAPPER_DONE         = 2
	REDUCER_NOT_STARTED = 3
	REDUCER_IN_PROGRESS = 4
	REDUCER_DONE        = 5
	MAPPER_WORK         = "Mapper"
	REDUCE_WORK         = "Reducer"
	TIME_OUT_MAPPER     = 10
	TIME_OUT_REDUCER    = 10
)

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 CallMapperDone

func CallMapperDone(req MapperRequest)

func CallReducerDone

func CallReducerDone(req ReducerRequest)

func CallRequestTask

func CallRequestTask() (string, int, string)

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 ExampleArgs

type ExampleArgs struct {
	X int
}

ExampleArgs is ...

type ExampleReply

type ExampleReply struct {
	Y int
}

ExampleReply is ...

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

Map functions return a slice of KeyValue.

type MapperRequest

type MapperRequest struct {
	FileName              []string
	OriginalFileAllocated string
	WorkerNum             int
}

MapperRequest is...

type Master

type Master struct {
	ReducerFileState    map[string]int
	InvalidMapperWorker map[int]int
	InvalidReduceWorker map[int]int
	// contains filtered or unexported fields
}

func MakeMaster

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

create a Master. main/mrmaster.go calls this function.

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

func (*Master) MapperDone

func (m *Master) MapperDone(req *MapperRequest, reply *MrEmpty) error

func (*Master) ReducerDone

func (m *Master) ReducerDone(req *ReducerRequest, reply *MrEmpty) error

func (*Master) RequestTask

func (m *Master) RequestTask(req MrRequest, reply *MrReply) error

func (m *Master) RequestTask(args) func Map(filename string, contents string) []mr.KeyValue func Reduce(key string, values []string) string

type MrEmpty

type MrEmpty struct {
}

MrEmpty is ...

type MrReply

type MrReply struct {
	FileName  string
	WorkerNum int
	WorkType  string
}

MrReply is ...

type MrRequest

type MrRequest struct {
}

MrRequest is ...

type ReducerRequest

type ReducerRequest struct {
	FileName              string
	OriginalFileAllocated string
	WorkerNum             int
}

ReducerRequest is ...

Jump to

Keyboard shortcuts

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