master

package
v0.0.0-...-e147593 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignIdleMapTasksToAvailableWorkers

func AssignIdleMapTasksToAvailableWorkers(masterState *MasterState, rpcGateway rpc.RpcGateway)

func AssignIdleReduceTasksToAvailableWorkers

func AssignIdleReduceTasksToAvailableWorkers(masterState *MasterState, rpcGateway rpc.RpcGateway)

func UpdateWorkerTasksFromHeartbeats

func UpdateWorkerTasksFromHeartbeats(state *MasterState, rpcGateway rpc.RpcGateway)

Types

type MapTask

type MapTask struct {
	Id                     uint16
	Status                 rpc.TaskStatus
	InputFileSplitLocation string
	IntermediateFiles      []rpc.IntermediateFile
	WorkerAssignedId       *WorkerId
}

type MasterState

type MasterState struct {
	Workers     []Worker
	MapTasks    []MapTask
	ReduceTasks []ReduceTask
	// contains filtered or unexported fields
}

func (*MasterState) AssignMapTaskToWorker

func (state *MasterState) AssignMapTaskToWorker(mapTaskId uint16, workerId WorkerId)

func (*MasterState) AssignReduceTaskToWorker

func (state *MasterState) AssignReduceTaskToWorker(reduceTaskId uint16, workerId WorkerId)

func (*MasterState) ChangeWorkerOnlineStatus

func (state *MasterState) ChangeWorkerOnlineStatus(workerId WorkerId, status WorkerStatus)

func (*MasterState) ChangeWorkerWithMapTaskToOnline

func (state *MasterState) ChangeWorkerWithMapTaskToOnline(
	workerId WorkerId,
	mapTaskId uint16,
	intermediateFiles []rpc.IntermediateFile,
	mapTaskStatus rpc.TaskStatus,
)

func (*MasterState) ChangeWorkerWithReduceTaskToOnline

func (state *MasterState) ChangeWorkerWithReduceTaskToOnline(
	workerId WorkerId,
	reduceTaskId uint16,
	outputFileLocation string,
	reduceTaskStatus rpc.TaskStatus,
)

func (*MasterState) GetReduceTaskById

func (state *MasterState) GetReduceTaskById(reduceTaskId uint16) *ReduceTask

type ReduceTask

type ReduceTask struct {
	Id                 uint16
	Status             rpc.TaskStatus
	PartitionNumber    uint16
	OutputFileLocation *string
	WorkerAssignedId   *WorkerId
}

type Request

type Request struct {
	Args    interface{}
	Address string
}

type Worker

type Worker struct {
	Id       WorkerId
	Hostname string
	Port     uint16
	Status   WorkerStatus
}

type WorkerId

type WorkerId uint16

type WorkerServer

type WorkerServer struct {
	Hostname     string
	Port         uint16
	RequestCount int
	// contains filtered or unexported fields
}

func (*WorkerServer) AbortReduceTask

func (workerServer *WorkerServer) AbortReduceTask(
	args rpc.AbortReduceTaskArgs,
	reply *rpc.AbortReduceTaskReply,
) error

func (*WorkerServer) EnqueueAbortReduceTaskReply

func (workerServer *WorkerServer) EnqueueAbortReduceTaskReply(reply rpc.AbortReduceTaskReply)

func (*WorkerServer) EnqueueGetHeartbeatReply

func (workerServer *WorkerServer) EnqueueGetHeartbeatReply(reply rpc.GetHeartBeatReply)

func (*WorkerServer) EnqueueStartMapTask

func (workerServer *WorkerServer) EnqueueStartMapTask(reply rpc.StartMapTaskReply)

func (*WorkerServer) EnqueueStartReduceTask

func (workerServer *WorkerServer) EnqueueStartReduceTask(reply rpc.StartReduceTaskReply)

func (*WorkerServer) GetHeartbeat

func (workerServer *WorkerServer) GetHeartbeat(
	args rpc.GetHeartBeatArgs,
	reply *rpc.GetHeartBeatReply,
) error

func (*WorkerServer) StartMapTask

func (workerServer *WorkerServer) StartMapTask(
	args rpc.StartMapTaskArgs,
	reply *rpc.StartMapTaskReply,
) error

func (*WorkerServer) StartReduceTask

func (workerServer *WorkerServer) StartReduceTask(
	args rpc.StartReduceTaskArgs,
	reply *rpc.StartReduceTaskReply,
) error

func (*WorkerServer) StartServer

func (mockWorkerServer *WorkerServer) StartServer()

func (*WorkerServer) StopServer

func (mockWorkerServer *WorkerServer) StopServer()

func (*WorkerServer) TakeRequest

func (workerServer *WorkerServer) TakeRequest() Request

type WorkerStatus

type WorkerStatus uint8
const (
	Online  WorkerStatus = 0
	Offline WorkerStatus = 1
)

Jump to

Keyboard shortcuts

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