mr

package
v0.0.0-...-60a2587 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TASK_QUEUE_SIZE = 1
	COORDINATE_URL  = "http://127.0.0.1:3921/coordinate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

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

func MakeCoordinator

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

func (*Coordinator) Server

func (c *Coordinator) Server()

func (*Coordinator) String

func (c *Coordinator) String() string

type KeyValue

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

type MapFunc

type MapFunc = func(string, string) []KeyValue

type PluginFuncs

type PluginFuncs struct {
	MapFunc    MapFunc
	ReduceFunc ReduceFunc
}

type ReduceFunc

type ReduceFunc = func(string, []string) string

type Request

type Request struct {
	WorkerID  string          `json:"worker_id"`
	Tasks     map[string]Task `json:"tasks"`
	FetchTask bool            `json:"fetch_task"`
}

type Response

type Response struct {
	StatusCode    int    `json:"status_code"`
	StatusMessage string `json:"status_message"`
	Task          *Task  `json:"task"`
}

type Task

type Task struct {
	ID         string     `json:"id"`
	Type       TaskType   `json:"type"`
	Paths      []string   `json:"paths"`
	PluginPath string     `json:"plugin_path"`
	NReduce    int        `json:"n_reduce"`
	Status     TaskStatus `json:"status"`
	WorkerID   string     `json:"worker_id"`
	ReduceID   int        `json:"reduce_id"`
}

func (*Task) Map

func (task *Task) Map() TaskStatus

func (*Task) Reduce

func (task *Task) Reduce() TaskStatus

func (*Task) Run

func (task *Task) Run() (status TaskStatus)

type TaskStatus

type TaskStatus int8
const (
	TASK_SUCCESS TaskStatus = 0
	TASK_FAILED  TaskStatus = -1
	TASK_PENDING TaskStatus = 1
	TASK_RUNNING TaskStatus = 2
)

func (TaskStatus) String

func (taskStatus TaskStatus) String() string

type TaskType

type TaskType int8
const (
	MAP_TASK    TaskType = 1
	REDUCE_TASK TaskType = 2
)

func (TaskType) String

func (taskType TaskType) String() string

type Worker

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

func MakeWorker

func MakeWorker() *Worker

func (*Worker) Run

func (w *Worker) Run()

type WorkerInfo

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

Jump to

Keyboard shortcuts

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