/proc/self/cwd/source/server/factory_context_base_impl.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include "envoy/server/factory_context.h" |
4 | | |
5 | | namespace Envoy { |
6 | | namespace Server { |
7 | | |
8 | | class FactoryContextBaseImpl : public Configuration::FactoryContextBase { |
9 | | public: |
10 | | FactoryContextBaseImpl(const Server::Options& options, Event::Dispatcher& main_thread_dispatcher, |
11 | | Api::Api& api, const LocalInfo::LocalInfo& local_info, |
12 | | OptRef<Server::Admin> admin, Runtime::Loader& runtime, |
13 | | Singleton::Manager& singleton_manager, |
14 | | ProtobufMessage::ValidationVisitor& validation_visitor, |
15 | | Stats::Store& store, ThreadLocal::SlotAllocator& local) |
16 | | : options_(options), main_thread_dispatcher_(main_thread_dispatcher), api_(api), |
17 | | local_info_(local_info), admin_(admin), runtime_(runtime), |
18 | | singleton_manager_(singleton_manager), validation_visitor_(validation_visitor), |
19 | 0 | scope_(*store.rootScope()), thread_local_(local) {} |
20 | | |
21 | | FactoryContextBaseImpl(Configuration::FactoryContextBase& config) |
22 | | : options_(config.options()), main_thread_dispatcher_(config.mainThreadDispatcher()), |
23 | | api_(config.api()), local_info_(config.localInfo()), admin_(config.admin()), |
24 | | runtime_(config.runtime()), singleton_manager_(config.singletonManager()), |
25 | | validation_visitor_(config.messageValidationVisitor()), scope_(config.scope()), |
26 | 6 | thread_local_(config.threadLocal()) {} |
27 | | |
28 | | // FactoryContextBase |
29 | 2 | const Options& options() override { return options_; }; |
30 | 4 | Event::Dispatcher& mainThreadDispatcher() override { return main_thread_dispatcher_; }; |
31 | 4 | Api::Api& api() override { return api_; }; |
32 | 2 | const LocalInfo::LocalInfo& localInfo() const override { return local_info_; }; |
33 | 2 | OptRef<Server::Admin> admin() override { return admin_; }; |
34 | 2 | Envoy::Runtime::Loader& runtime() override { return runtime_; }; |
35 | 6 | Singleton::Manager& singletonManager() override { return singleton_manager_; }; |
36 | 2 | ProtobufMessage::ValidationVisitor& messageValidationVisitor() override { |
37 | 2 | return validation_visitor_; |
38 | 2 | }; |
39 | 2 | Stats::Scope& scope() override { return scope_; }; |
40 | 0 | Stats::Scope& serverScope() override { return scope_; } |
41 | 2 | ThreadLocal::SlotAllocator& threadLocal() override { return thread_local_; }; |
42 | | |
43 | | private: |
44 | | const Server::Options& options_; |
45 | | Event::Dispatcher& main_thread_dispatcher_; |
46 | | Api::Api& api_; |
47 | | const LocalInfo::LocalInfo& local_info_; |
48 | | OptRef<Server::Admin> admin_; |
49 | | Runtime::Loader& runtime_; |
50 | | Singleton::Manager& singleton_manager_; |
51 | | ProtobufMessage::ValidationVisitor& validation_visitor_; |
52 | | Stats::Scope& scope_; |
53 | | ThreadLocal::SlotAllocator& thread_local_; |
54 | | }; |
55 | | |
56 | | } // namespace Server |
57 | | } // namespace Envoy |