-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapReduceFramework.h
More file actions
57 lines (44 loc) · 1.24 KB
/
MapReduceFramework.h
File metadata and controls
57 lines (44 loc) · 1.24 KB
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
55
56
57
#ifndef MAPREDUCEFRAMEWORK_H
#define MAPREDUCEFRAMEWORK_H
#include "MapReduceClient.h"
// ======================[ Type Definitions ]========================
typedef void* JobHandle;
enum stage_t {
UNDEFINED_STAGE = 0,
MAP_STAGE = 1,
SHUFFLE_STAGE = 2,
REDUCE_STAGE = 3
};
typedef struct {
stage_t stage;
float percentage;
} JobState;
// ======================[ API Functions ]===========================
/**
* @brief Emits an intermediate (K2, V2) pair from the map function.
*/
void emit2(K2* key, V2* value, void* context);
/**
* @brief Emits an output (K3, V3) pair from the reduce function.
*/
void emit3(K3* key, V3* value, void* context);
/**
* @brief Starts a MapReduce job.
*/
JobHandle startMapReduceJob(const MapReduceClient& client,
const InputVec& inputVec,
OutputVec& outputVec,
int multiThreadLevel);
/**
* @brief Waits for the MapReduce job to finish.
*/
void waitForJob(JobHandle job);
/**
* @brief Gets the current state of the MapReduce job.
*/
void getJobState(JobHandle job, JobState* state);
/**
* @brief Releases all resources of the MapReduce job.
*/
void closeJobHandle(JobHandle job);
#endif // MAPREDUCEFRAMEWORK_H