blob: 8be516900c04a3f36d952364d536f2105c2c0318 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#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
#define BUFFSIZE 500
#define DIRSIZE 150
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
|