worker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MasterIP string

Functions

func Init

func Init(masterIP string)

func StartWorker

func StartWorker(pluginFile string, nReduce int, addr string, storeInRAM bool)

func UpdateIMDInfo

func UpdateIMDInfo(u *rpc.IMDInfo) bool

func WorkerRegister

func WorkerRegister(w *rpc.WorkerInfo) int

Types

type KV

type KV struct {
	Key   string `json:"k"`
	Value string `json:"v"`
}

func GetIMDData

func GetIMDData(ip string, filename string) []KV

type MapFormat

type MapFormat (func(string, string, MrContext))

type MrContext

type MrContext struct {
	Chan chan KV
}

func (*MrContext) Emit

func (mc *MrContext) Emit(key string, value string)

func (*MrContext) EmitIntermediate

func (mc *MrContext) EmitIntermediate(key string, value string)

type ReduceFormat

type ReduceFormat (func(string, []string, MrContext))

type Worker

type Worker struct {
	UUID string
	ID   int

	Mapf    MapFormat
	Reducef ReduceFormat
	Chan    MrContext
	EndChan chan bool

	State rpc.WorkerState_State

	rpc.UnimplementedWorkerServer
	// contains filtered or unexported fields
}

func (*Worker) End

func (wr *Worker) End(ctx context.Context, in *rpc.Empty) (*rpc.Empty, error)

func (*Worker) GetIMDData

func (wr *Worker) GetIMDData(ctx context.Context, in *rpc.IMDLoc) (*rpc.JSONKVs, error)

func (*Worker) Health added in v1.0.0

func (wr *Worker) Health(ctx context.Context, in *rpc.Empty) (*rpc.WorkerState, error)

func (*Worker) Map

func (wr *Worker) Map(ctx context.Context, in *rpc.MapInfo) (*rpc.Result, error)

func (*Worker) Reduce

func (wr *Worker) Reduce(ctx context.Context, in *rpc.ReduceInfo) (*rpc.Result, error)

Jump to

Keyboard shortcuts

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