forked from dase/CLAIMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Environment.h
executable file
·87 lines (82 loc) · 2.54 KB
/
Environment.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Environment.h
*
* Created on: Aug 10, 2013
* Author: wangli
*/
#ifndef ENVIRONMENT_H_
#define ENVIRONMENT_H_
#include "Executor/Coordinator.h"
#include "Executor/IteratorExecutorMaster.h"
#include "Executor/IteratorExecutorSlave.h"
#include "storage/BlockManager.h"
#include "storage/BlockManagerMaster.h"
#include "Resource/ResourceManagerMaster.h"
#include "Resource/ResourceManagerSlave.h"
#include "Catalog/Catalog.h"
#include "IndexManager/IndexManager.h"
#include "Executor/AdaptiveEndPoint.h"
#include "Executor/PortManager.h"
#include "common/Logging.h"
#include "utility/ThreadPool.h"
#include "Client/ClaimsServer.h"
#include "Executor/exchange_tracker.h"
#include "Executor/expander_tracker.h"
#include "Resource/BufferManager.h"
class Environment {
public:
virtual ~Environment();
static Environment* getInstance(bool ismaster=0);
std::string getIp();
unsigned getPort();
AdaptiveEndPoint* getEndPoint();
ExchangeTracker* getExchangeTracker();
ResourceManagerMaster* getResourceManagerMaster();
InstanceResourceManager* getResourceManagerSlave();
NodeID getNodeID()const;
Catalog* getCatalog()const;
ThreadPool* getThreadPool() const;
IteratorExecutorSlave* getIteratorExecutorSlave() const;
Environment(bool ismaster=false);
private:
void readConfigFile();
void initializeEndPoint();
void initializeCoordinator();
void initializeStorage();
void initializeResourceManager();
void initializeBufferManager();
void initializeIndexManager();
void initializeClientListener();
void initializeExpressionSystem();
void destoryClientListener();
bool initializeThreadPool();
private:
static Environment* _instance;
PortManager* portManager;
AdaptiveEndPoint* endpoint;
Coordinator* coordinator;
std::string ip;
unsigned port;
IteratorExecutorSlave* iteratorExecutorSlave;
IteratorExecutorMaster* iteratorExecutorMaster;
ExchangeTracker* exchangeTracker;
Logging* logging_;
bool ismaster_;
ResourceManagerMaster* resourceManagerMaster_;
InstanceResourceManager* resourceManagerSlave_;
Catalog* catalog_;
/* the globally unique node id*/
NodeID nodeid;
BlockManagerMaster* blockManagerMaster_;
BlockManager* blockManager_;
BufferManager* bufferManager_;
IndexManager* indexManager_;
ExpanderTracker* expander_tracker_;
ClientListener* listener_;
ThreadPool *thread_pool_;
/**
* TODO: the master and slave pair, such as ResouceManagerMaster and ResourceManagerSlave, should have a
* base class which provides the access methods and is derived by ResouceManagerMaster and ResourceManagerSlave.
*/
};
#endif /* ENVIRONMENT_H_ */