/proc/self/cwd/source/extensions/filters/network/thrift_proxy/router/config.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "source/extensions/filters/network/thrift_proxy/router/config.h" |
2 | | |
3 | | #include "envoy/extensions/filters/network/thrift_proxy/router/v3/router.pb.h" |
4 | | #include "envoy/extensions/filters/network/thrift_proxy/router/v3/router.pb.validate.h" |
5 | | #include "envoy/registry/registry.h" |
6 | | |
7 | | #include "source/extensions/filters/network/thrift_proxy/router/router_impl.h" |
8 | | #include "source/extensions/filters/network/thrift_proxy/router/shadow_writer_impl.h" |
9 | | |
10 | | namespace Envoy { |
11 | | namespace Extensions { |
12 | | namespace NetworkFilters { |
13 | | namespace ThriftProxy { |
14 | | namespace Router { |
15 | | |
16 | | ThriftFilters::FilterFactoryCb RouterFilterConfig::createFilterFactoryFromProtoTyped( |
17 | | const envoy::extensions::filters::network::thrift_proxy::router::v3::Router& proto_config, |
18 | 0 | const std::string& stat_prefix, Server::Configuration::FactoryContext& context) { |
19 | 0 | auto stats = |
20 | 0 | std::make_shared<const RouterStats>(stat_prefix, context.scope(), context.localInfo()); |
21 | 0 | auto shadow_writer = std::make_shared<ShadowWriterImpl>( |
22 | 0 | context.clusterManager(), *stats, context.mainThreadDispatcher(), context.threadLocal()); |
23 | 0 | bool close_downstream_on_error = |
24 | 0 | PROTOBUF_GET_WRAPPED_OR_DEFAULT(proto_config, close_downstream_on_upstream_error, true); |
25 | |
|
26 | 0 | return [&context, stats, shadow_writer, close_downstream_on_error]( |
27 | 0 | ThriftFilters::FilterChainFactoryCallbacks& callbacks) -> void { |
28 | 0 | callbacks.addDecoderFilter(std::make_shared<Router>(context.clusterManager(), *stats, |
29 | 0 | context.runtime(), *shadow_writer, |
30 | 0 | close_downstream_on_error)); |
31 | 0 | }; |
32 | 0 | } |
33 | | |
34 | | /** |
35 | | * Static registration for the router filter. @see RegisterFactory. |
36 | | */ |
37 | | REGISTER_FACTORY(RouterFilterConfig, ThriftFilters::NamedThriftFilterConfigFactory); |
38 | | |
39 | | } // namespace Router |
40 | | } // namespace ThriftProxy |
41 | | } // namespace NetworkFilters |
42 | | } // namespace Extensions |
43 | | } // namespace Envoy |