types

package
v0.0.0-...-aae2ccf Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Parallel   = "Parallel"
	Sequential = "Sequential"
)
View Source
const (
	MapOutputFilePrefix    = "map-output-tmp"
	ReduceOutputFilePrefix = "reduce-output-tmp"
	FinalOutputFIlePrefix  = "final-output"
)
View Source
const (
	Map    = "Map"
	Reduce = "Reduce"
)
View Source
const (
	Pending  = "Pending"
	Running  = "Running"
	Finished = "Finished"
)
View Source
const (
	FileIOErr = iota
	RpcCallErr
	MapErr
	ReduceErr
	UnknownTask
	ParallelLimitErr
	ExceptionErr
)
View Source
const (
	LocalStorage = "local"
)

Variables

View Source
var SucceededResult = Result{Code: 0, Message: "Succeeded"}

Functions

func ValidaMode

func ValidaMode(mode Mode) bool

Types

type ConfigOptions

type ConfigOptions struct {
	// Common options.
	JobName   string
	RootDir   string
	Address   string
	ReduceNum int
	Storage   StorageType

	MasterConfigOptions
	WorkerConfigOptions
}

type Hasher

type Hasher interface {
	Hash(key string) int
}

func DefaultHasher

func DefaultHasher() Hasher

type Job

type Job struct {
	Name      string
	Mapper    Mapper
	Reducer   Reducer
	Hasher    Hasher
	MapNum    int
	ReduceNum int
	Storage   storage.Storage
}

type JobStatus

type JobStatus struct {
	Message      string      `json:"message,omitempty"`
	Output       string      `json:"output,omitempty"`
	MapStatus    TasksStatus `json:"mapStatus"`
	ReduceStatus TasksStatus `json:"reduceStatus"`
}

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

type Mapper

type Mapper interface {
	Map(fileName string, reader io.Reader) ([]KeyValue, error)
}

type MasterConfigOptions

type MasterConfigOptions struct {
	Mode                 Mode
	InputFiles           []string
	WorkerTimeout        time.Duration
	HealthyCheckInterval time.Duration
}

type MasterConfiguration

type MasterConfiguration struct {
	Job        Job
	Mode       Mode
	InputFiles []string

	/*Parameters for parallel mode*/
	Address       rpc.Address
	WorkerTimeout time.Duration
	CheckInterval time.Duration
}

type Mode

type Mode = string

type PingArg

type PingArg struct {
	Name string
}

type Reducer

type Reducer interface {
	Reduce(key string, values []string) (string, error)
}

type RegisterArg

type RegisterArg struct {
	Name    string
	Balance int
	Address rpc.Address
}

type RegisterResult

type RegisterResult struct {
	Result
}

type Result

type Result struct {
	Code    int
	Message string
}

type StorageType

type StorageType = string

type Task

type Task struct {
	Index    int
	Type     TaskType
	FileName string
}

func (*Task) Key

func (t *Task) Key() string

type TaskState

type TaskState string

type TaskType

type TaskType string

type TasksStatus

type TasksStatus struct {
	Total    int
	Running  int
	Finished int
}

type WorkerConfigOptions

type WorkerConfigOptions struct {
	MapNum                int
	Limit                 int
	MasterAddress         string
	HealthyReportInterval time.Duration
}

type WorkerConfiguration

type WorkerConfiguration struct {
	Job                   Job
	Name                  string
	Limit                 int
	Address               rpc.Address
	MasterAddress         rpc.Address
	HealthyReportInterval time.Duration
}

type WorkerStatus

type WorkerStatus struct {
	Name     string
	Running  int
	Failed   int
	Finished int
}

Jump to

Keyboard shortcuts

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