diff --git a/concurrency-mapreduce/README.md b/concurrency-mapreduce/README.md index 252e791..0cfa98d 100644 --- a/concurrency-mapreduce/README.md +++ b/concurrency-mapreduce/README.md @@ -90,8 +90,9 @@ infrastructure does the rest. ## Code Overview -We give you here `mapreduce.h` file that specifies exactly what you must build -in your MapReduce library: +We give you here the +[`mapreduce.h`](https://github.com/remzi-arpacidusseau/ostep-projects/tree/master/concurrency-mapreduce/mapreduce.h) +header file that specifies exactly what you must build in your MapReduce library: ``` #ifndef __mapreduce_h__ diff --git a/concurrency-mapreduce/mapreduce.h b/concurrency-mapreduce/mapreduce.h new file mode 100644 index 0000000..49c2cdc --- /dev/null +++ b/concurrency-mapreduce/mapreduce.h @@ -0,0 +1,19 @@ +#ifndef __mapreduce_h__ +#define __mapreduce_h__ + +typedef char *(*Getter)(); + +typedef void (*Mapper)(char *file_name); +typedef void (*Reducer)(char *key, Getter get_func, int partition_number); +typedef unsigned long (*Partitioner)(char *key, int num_buckets); + +void MR_Emit(char *key, char *value); + +unsigned long MR_DefaultHashPartition(char *key, int num_buckets); + +void MR_Run(int argc, char *argv[], + Mapper map, int num_mappers, + Reducer reduce, int num_reducers, + Partitioner partition); + +#endif // __mapreduce_h__