MP7 MapReduce
libmapreduce.h File Reference
#include <pthread.h>
#include "libds/libds.h"

Go to the source code of this file.

Data Structures

struct  mapreduce_t

Functions

void mapreduce_init (mapreduce_t *mr, void(*mymap)(int, const char *), const char *(*myreduce)(const char *, const char *))
 This function will be the first call made to the libmapreduce library.
void mapreduce_map_all (mapreduce_t *mr, const char **values)
 Main function of this MP.
void mapreduce_reduce_all (mapreduce_t *mr)
 This function should block until all map()'ing and reduce()'ing has completed.
const char * mapreduce_get_value (mapreduce_t *mr, const char *result_key)
 This function should return the current value of result_key.
void mapreduce_destroy (mapreduce_t *mr)
 Free all memory.

Detailed Description


Function Documentation

Free all memory.

Will always be called last.

const char* mapreduce_get_value ( mapreduce_t mr,
const char *  result_key 
)

This function should return the current value of result_key.

If the result_key does not exist, return NULL.

This function should return the current value of result_key.

(See the MP description for full details.)

void mapreduce_init ( mapreduce_t mr,
void(*)(int, const char *)  mymap,
const char *(*)(const char *, const char *)  myreduce 
)

This function will be the first call made to the libmapreduce library.

You should put any initialization logic here

Parameters:
mymapmap function
myreducereduce function
Returns:
Void
void mapreduce_map_all ( mapreduce_t mr,
const char **  values 
)

Main function of this MP.

Parameters:
valuescontains a NULL-terminated array of C-strings.
Returns:
Void

Main function of this MP.

(See the MP description for full details.)

This function should block until all map()'ing and reduce()'ing has completed.

This function should block until all map()'ing and reduce()'ing has completed.

(See the MP description for full details.)

 All Data Structures Files Functions