-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathengine_manager.h
More file actions
48 lines (35 loc) · 1 KB
/
engine_manager.h
File metadata and controls
48 lines (35 loc) · 1 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
/*******************************************
Author : Jun Zhang
Email : ewalker.zj@gmail.com
Last Modified : 2019-08-14 11:16
Filename : engine_manager.h
Description :
*******************************************/
#pragma once
#include <vector>
#include <memory>
#include <functional>
#include "options.h"
#include "data.pb.h"
#include <butil/logging.h>
namespace sogou {
class Channel;
class Engine;
typedef std::function<void()> Closure;
class EngineManager {
public:
friend class Channel; //
public:
EngineManager() {}
~EngineManager() {}
static EngineManager& instance();
bool Init(const Options& options);
bool Destory();
bool Process(const Request* request, Response* response, std::function<void()> done);
int get_id() const;
int get_channel_id() const;
private:
std::vector<std::shared_ptr<Engine>> engines_;
std::vector<std::shared_ptr<Channel>> channels_;
};
}