libmapreduce.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
#include <pthread.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <sys/wait.h>
#include <poll.h>
#include "libmapreduce.h"
#include "libds/libds.h"

Functions

void mapreduce_init (mapreduce_t *mr, void(*mymap)(int, const char *), const char *(*myreduce)(const char *, const char *))
 Initialize the mapreduce data structure, given a map and a reduce function pointer.
void populate_fd_set (mapreduce_t *mr)
void * worker (void *arg)
void mapreduce_map_all (mapreduce_t *mr, const char **values)
 Starts the map() processes for each value in the values array.
void mapreduce_reduce_all (mapreduce_t *mr)
 Blocks until all the reduce() operations have been completed.
const char * mapreduce_get_value (mapreduce_t *mr, const char *result_key)
 Gets the current value for a key.
void mapreduce_destroy (mapreduce_t *mr)
 Destroys the mapreduce data structure.

Variables

pthread_t worker_thread

Detailed Description


Function Documentation

void mapreduce_destroy ( mapreduce_t mr  ) 

Destroys the mapreduce data structure.

Free all memory.

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

Gets the current value for a key.

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 
)

Initialize the mapreduce data structure, given a map and a reduce function pointer.

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

void mapreduce_map_all ( mapreduce_t mr,
const char **  values 
)

Starts the map() processes for each value in the values array.

Main function of this MP.

(See the MP description for full details.)

void mapreduce_reduce_all ( mapreduce_t mr  ) 

Blocks until all the reduce() operations have been completed.

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

(See the MP description for full details.)


Generated on 3 Nov 2013 for MP7 MapReduce by  doxygen 1.6.1