mr_main.h
1 // Copyright 2019, Beeri 15. All rights reserved.
2 // Author: Roman Gershman (romange@gmail.com)
3 //
4 #pragma once
5 
6 #include "mr/pipeline.h"
7 #include "util/http/http_conn_handler.h"
8 
9 class MainInitGuard;
10 
11 namespace util {
12 class AcceptServer;
13 } // util
14 
15 namespace mr3 {
16 
17 class LocalRunner;
18 
19 class PipelineMain {
20 public:
22  PipelineMain();
23 
25  // everything that PipelineMain() does.
26  PipelineMain(int* argc, char*** argv);
27 
28  ~PipelineMain();
29 
30  util::IoContextPool* pool() { return pool_.get(); }
31  Pipeline* pipeline() { return pipeline_.get(); }
32  void ResetPipeline();
33  util::AcceptServer* accept_server() { return acc_server_.get(); }
34 
35  LocalRunner* StartLocalRunner(const std::string& root_dir, bool stop_on_break = true);
36 
37 private:
38  void Init();
39 
40  std::unique_ptr<MainInitGuard> guard_; // Must be first to be destructed last.
41 
42  std::unique_ptr<util::IoContextPool> pool_;
43  std::unique_ptr<Pipeline> pipeline_;
44  std::unique_ptr<util::AcceptServer> acc_server_;
45  util::http::Listener<> http_listener_;
46  std::unique_ptr<LocalRunner> runner_;
47 };
48 
49 } // namespace mr3
Serves as the main entry point for setting up and configuring the mapreduce pipeline.
Definition: pipeline.h:42
PipelineMain()
This sets up MR pipeline object and all its dependencies like IO pool.
A pool of IoContext objects, representing and managing CPU resources of the system.