mr

package module
v0.0.0-...-1abfb02 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableLogging

func EnableLogging(output bool)

func HandleError

func HandleError(err error)

func MRPrintln

func MRPrintln(format string, args ...interface{})

func Worker

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

Worker main/mrworker.go calls this function.

Types

type Coordinator

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

func MakeCoordinator

func MakeCoordinator(files []string, nReduce int) *Coordinator

func (*Coordinator) Done

func (c *Coordinator) Done() bool

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

func (*Coordinator) GetTask

func (c *Coordinator) GetTask(
	args *WorkerGetTaskRequest,
	reply *WorkerGetTaskReply,
) error

func (*Coordinator) GetWorkerId

func (c *Coordinator) GetWorkerId(
	args *WorkerRegisterRequest,
	reply *WorkerRegisterReply,
) error

GetWorkerId Give monotonically increasing Ids.

func (*Coordinator) UpdateTaskStatus

func (c *Coordinator) UpdateTaskStatus(
	args *WorkerUpdateTaskStatusRequest,
	reply *WorkerUpdateTaskStatusReply,
) error

type CoordinatorReply

type CoordinatorReply struct {
	FileNames string
}

type CoordinatorRequest

type CoordinatorRequest struct {
	WorkerId int
	TaskType TaskType
}
type WorkerRequest struct {
	WorkerId int
	Task     Task
}
type WorkerReply struct {
	Task Task
}

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue Map functions return a slice of KeyValue.

type RetryableError

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

func (*RetryableError) Error

func (e *RetryableError) Error() string

type Task

type Task struct {
	Id          int // M
	NReduce     int // fix const
	FileLocs    []string
	TaskType    TaskType
	TStatus     TaskStatus
	WorkerId    int
	WStatus     WorkerStatus
	ExpiryTimer *time.Timer
}

type TaskPtr

type TaskPtr map[int]*Task

type TaskStatus

type TaskStatus int
const (
	IDLE TaskStatus = iota
	COMPLETED
	IN_PROGRESS
)

type TaskType

type TaskType int
const (
	MAP TaskType = iota
	REDUCE
)

type WorkerGetTaskReply

type WorkerGetTaskReply struct {
	EmptyQueue bool
	TaskId     int // M
	NReduce    int // fix const
	FileLocs   []string
	TaskType   TaskType
	KillSignal bool
}

type WorkerGetTaskRequest

type WorkerGetTaskRequest struct {
	WorkerId int
}

type WorkerRegisterReply

type WorkerRegisterReply struct {
	WorkerId int
}

type WorkerRegisterRequest

type WorkerRegisterRequest struct{}

type WorkerStatus

type WorkerStatus int
const (
	HEALTHY WorkerStatus = iota
	DEAD
	EXITED
)

type WorkerUpdateTaskStatusReply

type WorkerUpdateTaskStatusReply struct {
	StatusUpdated bool
}

type WorkerUpdateTaskStatusRequest

type WorkerUpdateTaskStatusRequest struct {
	WorkerId          int
	TaskId            int // M
	NewGeneratedFiles []string
	TStatus           TaskStatus
}

Jump to

Keyboard shortcuts

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