Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
remzi-arpacidusseau
GitHub Repository: remzi-arpacidusseau/ostep-projects
Path: blob/master/concurrency-mapreduce/mapreduce.h
909 views
1
#ifndef __mapreduce_h__
2
#define __mapreduce_h__
3
4
// Different function pointer types used by MR
5
typedef char *(*Getter)(char *key, int partition_number);
6
typedef void (*Mapper)(char *file_name);
7
typedef void (*Reducer)(char *key, Getter get_func, int partition_number);
8
typedef unsigned long (*Partitioner)(char *key, int num_partitions);
9
10
// External functions: these are what you must define
11
void MR_Emit(char *key, char *value);
12
13
unsigned long MR_DefaultHashPartition(char *key, int num_partitions);
14
15
void MR_Run(int argc, char *argv[],
16
Mapper map, int num_mappers,
17
Reducer reduce, int num_reducers,
18
Partitioner partition);
19
20
#endif // __mapreduce_h__
21
22