diff options
Diffstat (limited to 'P1/Template/include')
-rw-r--r-- | P1/Template/include/mapper.h | 46 | ||||
-rw-r--r-- | P1/Template/include/mapreduce.h | 6 | ||||
-rw-r--r-- | P1/Template/include/reducer.h | 24 | ||||
-rw-r--r-- | P1/Template/include/utils.h | 52 |
4 files changed, 0 insertions, 128 deletions
diff --git a/P1/Template/include/mapper.h b/P1/Template/include/mapper.h deleted file mode 100644 index 2e3693c..0000000 --- a/P1/Template/include/mapper.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef MAPPER_H -#define MAPPER_H - -#include "utils.h" - -// ###### DO NOT REMOVE ###### -#define MAXKEYSZ 100 -#define MAXVALUESZ 100 - -// ###### DO NOT REMOVE ###### -char *mapOutDir; -int mapperID; - - -// You are free to change the intermediate data structure as it suits you -// If you do so, ensure the provided utility functions are also changed -// 1 1 1... -typedef struct valueList { - // MAXVALUESZ can be reduced to a small value as you are only storing "1" - char value[MAXVALUESZ]; - struct valueList *next; -}valueList; - -// word 1 1 1... -typedef struct intermediateDS{ - char key[MAXKEYSZ]; - valueList *value; - struct intermediateDS *next; -}intermediateDS; - -// ###### DO NOT REMOVE ###### -valueList *createNewValueListNode(char *value); -valueList *insertNewValueToList(valueList *root, char *count); -void freeValueList(valueList *root); - -// ###### DO NOT REMOVE ###### -intermediateDS *createNewInterDSNode(char *word, char *count); -intermediateDS *insertPairToInterDS(intermediateDS *root, char *word, char *count); -void freeInterDS(intermediateDS *root); - -// ###### DO NOT REMOVE ###### -void emit(char *key, char *value); -void map(char *chunkData); -void writeIntermediateDS(); - -#endif
\ No newline at end of file diff --git a/P1/Template/include/mapreduce.h b/P1/Template/include/mapreduce.h deleted file mode 100644 index 9b5950b..0000000 --- a/P1/Template/include/mapreduce.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MAPREDUCE_H -#define MAPREDUCE_H - -#include "utils.h" //sendChunkData and shuffle - -#endif
\ No newline at end of file diff --git a/P1/Template/include/reducer.h b/P1/Template/include/reducer.h deleted file mode 100644 index 79ea452..0000000 --- a/P1/Template/include/reducer.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef REDUCER_H -#define REDUCER_H - -#include "utils.h" - -#define MAXKEYSZ 50 - -// ###### DO NOT REMOVE ###### -typedef struct finalKeyValueDS { - char key[MAXKEYSZ]; - int value; - struct finalKeyValueDS *next; -} finalKeyValueDS; - -// ###### DO NOT REMOVE ###### -finalKeyValueDS *createFinalKeyValueNode(char *value, int count); -finalKeyValueDS *insertNewKeyValue(finalKeyValueDS *root, char *word, int count); -void freeFinalDS(finalKeyValueDS *root); - -// ###### DO NOT REMOVE ###### -void writeFinalDS(int reducerID); -void reduce(char *key); - -#endif
\ No newline at end of file diff --git a/P1/Template/include/utils.h b/P1/Template/include/utils.h deleted file mode 100644 index cfe56f2..0000000 --- a/P1/Template/include/utils.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <unistd.h> -#include <dirent.h> -#include <string.h> -#include <fcntl.h> -#include <sys/msg.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/types.h> -#include <ctype.h> - -#define chunkSize 1024 -#define MSGSIZE 1100 -#define ENDTYPE 1000 -#define ACKTYPE 1100 - -struct msgBuffer { - long msgType; - char msgText[MSGSIZE]; -}; - -// mapper side -int validChar(char c); -// getWord usage - retrieves words from the chunk passed until it is fully traversed -// given a chunk of data chunkData, the call to getWord should look as below: -// int i = 0; -// char *buffer; -// while ((buffer = getWord(chunkData, &i)) != NULL){ -// your code -// } -char *getWord(char *chunk, int *i); -char *getChunkData(int mapperID); -void sendChunkData(char *inputFile, int nMappers); - - -// reducer side -int hashFunction(char* key, int reducers); -int getInterData(char *key, int reducerID); -void shuffle(int nMappers, int nReducers); - -// directory -void createOutputDir(); -char *createMapDir(int mapperID); -void removeOutputDir(); -void bookeepingCode(); - -#endif
\ No newline at end of file |