/proc/self/cwd/source/common/api/api_impl.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include <chrono> |
4 | | #include <string> |
5 | | |
6 | | #include "envoy/api/api.h" |
7 | | #include "envoy/config/bootstrap/v3/bootstrap.pb.h" |
8 | | #include "envoy/event/timer.h" |
9 | | #include "envoy/filesystem/filesystem.h" |
10 | | #include "envoy/network/socket.h" |
11 | | #include "envoy/thread/thread.h" |
12 | | |
13 | | #include "source/common/stats/custom_stat_namespaces_impl.h" |
14 | | |
15 | | namespace Envoy { |
16 | | namespace Api { |
17 | | |
18 | | /** |
19 | | * Implementation of Api::Api |
20 | | */ |
21 | | class Impl : public Api { |
22 | | public: |
23 | | Impl(Thread::ThreadFactory& thread_factory, Stats::Store& store, Event::TimeSystem& time_system, |
24 | | Filesystem::Instance& file_system, Random::RandomGenerator& random_generator, |
25 | | const envoy::config::bootstrap::v3::Bootstrap& bootstrap, |
26 | | const ProcessContextOptRef& process_context = absl::nullopt, |
27 | | Buffer::WatermarkFactorySharedPtr watermark_factory = nullptr); |
28 | | |
29 | | // Api::Api |
30 | | Event::DispatcherPtr allocateDispatcher(const std::string& name) override; |
31 | | Event::DispatcherPtr |
32 | | allocateDispatcher(const std::string& name, |
33 | | const Event::ScaledRangeTimerManagerFactory& scaled_timer_factory) override; |
34 | | Event::DispatcherPtr allocateDispatcher(const std::string& name, |
35 | | Buffer::WatermarkFactoryPtr&& watermark_factory) override; |
36 | 54.1k | Thread::ThreadFactory& threadFactory() override { return thread_factory_; } |
37 | 53.5k | Filesystem::Instance& fileSystem() override { return file_system_; } |
38 | 60.5k | TimeSource& timeSource() override { return time_system_; } |
39 | 9.43k | Stats::Scope& rootScope() override { return *store_.rootScope(); } |
40 | 106k | Random::RandomGenerator& randomGenerator() override { return random_generator_; } |
41 | 0 | Stats::CustomStatNamespaces& customStatNamespaces() override { return custom_stat_namespaces_; } |
42 | 23.0k | const envoy::config::bootstrap::v3::Bootstrap& bootstrap() const override { return bootstrap_; } |
43 | 0 | ProcessContextOptRef processContext() override { return process_context_; } |
44 | | |
45 | | private: |
46 | | Thread::ThreadFactory& thread_factory_; |
47 | | Stats::Store& store_; |
48 | | Event::TimeSystem& time_system_; |
49 | | Filesystem::Instance& file_system_; |
50 | | Random::RandomGenerator& random_generator_; |
51 | | const envoy::config::bootstrap::v3::Bootstrap& bootstrap_; |
52 | | Stats::CustomStatNamespacesImpl custom_stat_namespaces_; |
53 | | ProcessContextOptRef process_context_; |
54 | | const Buffer::WatermarkFactorySharedPtr watermark_factory_; |
55 | | }; |
56 | | |
57 | | } // namespace Api |
58 | | } // namespace Envoy |