go_mapreduce icon indicating copy to clipboard operation
go_mapreduce copied to clipboard

A simple MapReduce implementation in Google Go.

go_mapreduce

A simple MapReduce implementation in Go using channels and generics.

This is a learning project for understanding Go channels and MapReduce basics. Not intended for production use.

Installation

go get github.com/dbravender/go_mapreduce

Usage

import "github.com/dbravender/go_mapreduce/mapreduce"

result := mapreduce.MapReduce(mapper, reducer, inputChan, poolSize)
  • mapper: func(In, chan<- Mid) - processes each input, sends result to channel
  • reducer: func(<-chan Mid, chan<- Out) - aggregates mapper outputs
  • inputChan: <-chan In - input items to process
  • poolSize: int - max concurrent mappers

Example

See cmd/wordcount/main.go for a word counting example.

go run ./cmd/wordcount

License

MIT