mapreduce

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCancelWithNil           = errors.New("mapreduce cancelled with nil")
	ErrReduceNoOutput          = errors.New("reduce not writing value")
	ErrWriteMoreThanOneProduce = errors.New("more than one element written in reducer")
)

Functions

func MapReduce

func MapReduce[T, U, V any](gen GenerateFunc[T], mapper MapperFunc[T, U], reducer ReducerFunc[U, V], opts ...Option) (v V, err error)

Types

type GenerateFunc

type GenerateFunc[T any] func(source chan<- T)

GenerateFunc 执行生成的函数

type MapFunc

type MapFunc[T, U any] func(item T, writer Writer[U])

MapFunc Map的具体方法函数

type MapperFunc

type MapperFunc[T, U any] func(item T, writer Writer[U], cancel func(err error))

MapperFunc 执行map的函数

type Option

type Option func(opts *mapReduceOptions)

Option 可选择的选择

type ReduceFunc

type ReduceFunc[T, U any] func(item T, writer Writer[U])

ReduceFunc Reduce的具体函数方法

type ReducerFunc

type ReducerFunc[U, V any] func(pipe <-chan U, writer Writer[V], cancel func(err error))

ReducerFunc 执行reduce的函数

type Writer

type Writer[T any] interface {
	Write(v T)
}

Jump to

Keyboard shortcuts

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