mr

package
v0.0.0-...-524613c Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATE_PENDING = 1 + iota
	STATE_IDLE
	STATE_COMPLETED
)
View Source
const (
	HEARTBEAT = 10 * time.Second
)

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 Worker

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

main/mrworker.go calls this function.

Types

type ByKey

type ByKey []*string

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
}

type ExampleReply

type ExampleReply struct {
	Y int
}

type HeartbeatArgs

type HeartbeatArgs struct {
	Type int // 0 => Map, 1 => Reduce
	Id   int
}

type HeartbeatReply

type HeartbeatReply struct {
}

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Map functions return a slice of KeyValue.

type MapFinishArgs

type MapFinishArgs struct {
	Id           int
	Name         string
	Intermediate map[int]string
}

type MapFinishReply

type MapFinishReply struct {
}

type MapInputArgs

type MapInputArgs struct {
}

Add your RPC definitions here.

type MapInputReply

type MapInputReply struct {
	NReduce  int
	Filename string
	Id       int
	RealId   int
}

type MapState

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

type MapTask

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

type Master

type Master struct {
	// Your definitions here.
	NReduce int
	// 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) 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) GetMapInput

func (m *Master) GetMapInput(in *MapInputArgs, reply *MapInputReply) error

Your code here -- RPC handlers for the worker to call.

func (*Master) GetReduceInput

func (m *Master) GetReduceInput(in *ReduceInputArgs, reply *ReduceInputReply) error

func (*Master) Heartbeat

func (m *Master) Heartbeat(in *HeartbeatArgs, reply *HeartbeatReply) error

func (*Master) MapFinished

func (m *Master) MapFinished(in *MapFinishArgs, reply *MapFinishReply) error

func (*Master) ReduceFinished

func (m *Master) ReduceFinished(in *ReduceFinishArgs, reply *ReduceFinishReply) error

type ReduceFinishArgs

type ReduceFinishArgs struct {
	Id int
}

type ReduceFinishReply

type ReduceFinishReply struct {
}

type ReduceInputArgs

type ReduceInputArgs struct {
}

type ReduceInputReply

type ReduceInputReply struct {
	Id           int
	Intermediate []string
}

type ReduceTask

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

type Task

type Task interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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