Discover Packages
github.com/CocaineCong/tangseng
pkg
mapreduce
package
Version:
v0.1.3
Opens a new window with list of versions in this module.
Published: Mar 3, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
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")
)
func MapReduce[T, U, V any ](gen GenerateFunc[T], mapper MapperFunc[T, U], reducer ReducerFunc[U, V], opts ...Option) (v V, err error )
type GenerateFunc[T any ] func(source chan<- T)
GenerateFunc 执行生成的函数
type MapFunc[T, U any ] func(item T, writer Writer[U])
MapFunc Map的具体方法函数
type MapperFunc[T, U any ] func(item T, writer Writer[U], cancel func(err error ))
MapperFunc 执行map的函数
type Option func(opts *mapReduceOptions)
Option 可选择的选择
type ReduceFunc[T, U any ] func(item T, writer Writer[U])
ReduceFunc Reduce的具体函数方法
type ReducerFunc[U, V any ] func(pipe <-chan U, writer Writer[V], cancel func(err error ))
ReducerFunc 执行reduce的函数
type Writer[T any ] interface {
Write(v T)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.