master

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TASK_IDLE int = iota
	TASK_INPROGRESS
	TASK_COMPLETED
)
View Source
const (
	WORKER_IDLE int = iota
	WORKER_BUSY
	WORKER_UNKNOWN
)

Variables

This section is empty.

Functions

func NewMaster

func NewMaster(nWorker int, nReduce int) rpc.MasterServer

func StartMaster

func StartMaster(files []string, nWorker int, nReduce int, addr string)

Types

type FileInfo

type FileInfo struct {
	FileName string
	From     int
	To       int
}

type IMDInfo

type IMDInfo struct {
	IP       string
	FileName string
}

type MapTaskInfo

type MapTaskInfo struct {
	Files     []FileInfo
	TaskState int
	UUID      string
}

type Master

type Master struct {
	Workers     []WorkerInfo
	MapTasks    []MapTaskInfo
	ReduceTasks []ReduceTaskInfo

	rpc.UnimplementedMasterServer
	// contains filtered or unexported fields
}

func (*Master) PeriodicHealthCheck

func (ms *Master) PeriodicHealthCheck()

func (*Master) UpdateIMDInfo

func (ms *Master) UpdateIMDInfo(ctx context.Context, in *rpc.IMDInfo) (*rpc.UpdateResult, error)

func (*Master) WorkerRegister

func (ms *Master) WorkerRegister(ctx context.Context, in *rpc.WorkerInfo) (*rpc.RegisterResult, error)

type ReduceTaskInfo

type ReduceTaskInfo struct {
	IMDs      []IMDInfo
	TaskState int
	UUID      string
}

func (*ReduceTaskInfo) SetState

func (mt *ReduceTaskInfo) SetState(state int)

type RpcClient

type RpcClient interface {
	Connect(workerIP string) (*grpc.ClientConn, rpc.WorkerClient)
	Map(workerIP string, m *rpc.MapInfo) bool
	Reduce(workerIP string, m *rpc.ReduceInfo) bool
	End(workerIP string) bool
	Health(workerIP string) int
}

type WorkerInfo

type WorkerInfo struct {
	UUID        string
	IP          string
	WorkerState int
	// contains filtered or unexported fields
}

func (*WorkerInfo) Broken

func (w *WorkerInfo) Broken() bool

func (*WorkerInfo) Health

func (w *WorkerInfo) Health() bool

func (*WorkerInfo) SetState

func (w *WorkerInfo) SetState(state int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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