Skip to content

Commit

Permalink
config: remove network/HTTP filter type from interfaces. (#1575)
Browse files Browse the repository at this point in the history
This has been removed from the v2 config already, is ignored in v1 and is vestigial in the code
base.

Partial fix for #1535.
  • Loading branch information
htuch authored Aug 31, 2017
1 parent 85feb7f commit d123890
Show file tree
Hide file tree
Showing 25 changed files with 3 additions and 64 deletions.
3 changes: 2 additions & 1 deletion DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ The following features have been DEPRECATED and will be removed in the specified
RPC stubs. `Grpc::AsyncClientImpl` supports streaming, in addition to the previous unary, RPCs.
* The direction of network and HTTP filters in the configuration will be ignored from 1.4.0 and
later removed from the configuration in the v2 APIs. Filter direction is now implied at the C++ type
level.
level. The `type()` methods on the `NamedNetworkFilterConfigFactory` and
`NamedHttpFilterConfigFactory` intefaces have been removed to reflect this.
2 changes: 1 addition & 1 deletion ci/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ then
fi

# This is the hash on https://github.com/lyft/envoy-filter-example.git we pin to.
(cd "${ENVOY_FILTER_EXAMPLE_SRCDIR}" && git fetch origin && git checkout 77fdf641a61b5a8f20e2568c4e7eb6a3644fe7c9)
(cd "${ENVOY_FILTER_EXAMPLE_SRCDIR}" && git fetch origin && git checkout b904b8ce9cabafb485e6b6fae1d0fd9e33ddfcc1)
cp -f "${ENVOY_SRCDIR}"/ci/WORKSPACE.filter.example "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/WORKSPACE

# Also setup some space for building Envoy standalone.
Expand Down
14 changes: 0 additions & 14 deletions include/envoy/server/filter_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ class FactoryContext {
virtual Server::Admin& admin() PURE;
};

enum class NetworkFilterType { Read, Write, Both };

/**
* This function is used to wrap the creation of a network filter chain for new connections as
* they come in. Filter factories create the lambda at configuration initialization time, and then
Expand Down Expand Up @@ -174,15 +172,8 @@ class NamedNetworkFilterConfigFactory {
* produced by the factory.
*/
virtual std::string name() PURE;

/**
* @return NetworkFilterType the type of filter.
*/
virtual NetworkFilterType type() PURE;
};

enum class HttpFilterType { Decoder, Encoder, Both };

/**
* This function is used to wrap the creation of an HTTP filter chain for new streams as they
* come in. Filter factories create the function at configuration initialization time, and then
Expand Down Expand Up @@ -243,11 +234,6 @@ class NamedHttpFilterConfigFactory {
* produced by the factory.
*/
virtual std::string name() PURE;

/**
* @return HttpFilterType the type of filter.
*/
virtual HttpFilterType type() PURE;
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class BufferFilterConfig : public NamedHttpFilterConfigFactory {
const std::string& stats_prefix,
FactoryContext& context) override;
std::string name() override { return "buffer"; }
HttpFilterType type() override { return HttpFilterType::Decoder; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/dynamo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class DynamoFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object&, const std::string& stat_prefix,
FactoryContext& context) override;
std::string name() override { return "http_dynamo_filter"; }
HttpFilterType type() override { return HttpFilterType::Both; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class FaultFilterConfig : public NamedHttpFilterConfigFactory {
const std::string& stats_prefix,
FactoryContext& context) override;
std::string name() override { return "fault"; }
HttpFilterType type() override { return HttpFilterType::Decoder; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/grpc_http1_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class GrpcHttp1BridgeFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object&, const std::string&,
FactoryContext& context) override;
std::string name() override { return "grpc_http1_bridge"; }
HttpFilterType type() override { return HttpFilterType::Both; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/grpc_json_transcoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class GrpcJsonTranscoderFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object&, const std::string&,
FactoryContext& context) override;
std::string name() override { return "grpc_json_transcoder"; };
HttpFilterType type() override { return HttpFilterType::Both; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/grpc_web.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class GrpcWebFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object&, const std::string&,
FactoryContext&) override;
std::string name() override { return "grpc_web"; }
HttpFilterType type() override { return HttpFilterType::Both; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/ip_tagging.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class IpTaggingFilterConfig : public NamedHttpFilterConfigFactory {
const std::string& stat_prefix,
FactoryContext& context) override;
std::string name() override { return "ip_tagging"; }
HttpFilterType type() override { return HttpFilterType::Decoder; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/ratelimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class RateLimitFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object& config, const std::string&,
FactoryContext& context) override;
std::string name() override { return "rate_limit"; }
HttpFilterType type() override { return HttpFilterType::Decoder; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/http/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class RouterFilterConfig : public NamedHttpFilterConfigFactory {
const std::string& stat_prefix,
FactoryContext& context) override;
std::string name() override { return "router"; }
HttpFilterType type() override { return HttpFilterType::Decoder; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/client_ssl_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ClientSslAuthConfigFactory : public NamedNetworkFilterConfigFactory {
NetworkFilterFactoryCb createFilterFactory(const Json::Object& json_config,
FactoryContext& context) override;
std::string name() override { return "client_ssl_auth"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/echo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class EchoConfigFactory : public NamedNetworkFilterConfigFactory {
}

std::string name() override { return "echo"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

/**
Expand Down
11 changes: 0 additions & 11 deletions source/server/config/network/http_connection_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,6 @@ void HttpConnectionManagerConfig::createFilterChain(Http::FilterChainFactoryCall
}
}

HttpFilterType HttpConnectionManagerConfig::stringToType(const std::string& type) {
if (type == "decoder") {
return HttpFilterType::Decoder;
} else if (type == "encoder") {
return HttpFilterType::Encoder;
} else {
ASSERT(type == "both" || type.empty());
return HttpFilterType::Both;
}
}

const Network::Address::Instance& HttpConnectionManagerConfig::localAddress() {
return *context_.localInfo().address();
}
Expand Down
3 changes: 0 additions & 3 deletions source/server/config/network/http_connection_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class HttpConnectionManagerFilterConfigFactory : Logger::Loggable<Logger::Id::co
new envoy::api::v2::filter::HttpConnectionManager());
}
std::string name() override { return "http_connection_manager"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

/**
Expand Down Expand Up @@ -98,8 +97,6 @@ class HttpConnectionManagerConfig : Logger::Loggable<Logger::Id::config>,
private:
enum class CodecType { HTTP1, HTTP2, AUTO };

HttpFilterType stringToType(const std::string& type);

FactoryContext& context_;
std::list<HttpFilterFactoryCb> filter_factories_;
std::list<Http::AccessLog::InstanceSharedPtr> access_logs_;
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/mongo_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class MongoProxyFilterConfigFactory : public NamedNetworkFilterConfigFactory {
FactoryContext& context) override;

std::string name() override { return "mongo_proxy"; }
NetworkFilterType type() override { return NetworkFilterType::Both; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/ratelimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class RateLimitConfigFactory : public NamedNetworkFilterConfigFactory {
NetworkFilterFactoryCb createFilterFactory(const Json::Object& json_config,
FactoryContext& context) override;
std::string name() override { return "ratelimit"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/redis_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class RedisProxyFilterConfigFactory : public NamedNetworkFilterConfigFactory {
NetworkFilterFactoryCb createFilterFactory(const Json::Object& config,
FactoryContext& context) override;
std::string name() override { return "redis_proxy"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/config/network/tcp_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class TcpProxyConfigFactory : public NamedNetworkFilterConfigFactory {
NetworkFilterFactoryCb createFilterFactory(const Json::Object& config,
FactoryContext& context) override;
std::string name() override { return "tcp_proxy"; }
NetworkFilterType type() override { return NetworkFilterType::Read; }
};

} // namespace Configuration
Expand Down
1 change: 0 additions & 1 deletion source/server/http/health_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class HealthCheckFilterConfig : public NamedHttpFilterConfigFactory {
HttpFilterFactoryCb createFilterFactory(const Json::Object& config, const std::string&,
FactoryContext& context) override;
std::string name() override { return "health_check"; }
HttpFilterType type() override { return HttpFilterType::Both; }
};

} // namespace Configuration
Expand Down
9 changes: 0 additions & 9 deletions test/server/config/http/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ TEST(HttpFilterConfigTest, BufferFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
BufferFilterConfig factory;
EXPECT_EQ(HttpFilterType::Decoder, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamDecoderFilter(_));
Expand Down Expand Up @@ -71,7 +70,6 @@ TEST(HttpFilterConfigTest, RateLimitFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
RateLimitFilterConfig factory;
EXPECT_EQ(HttpFilterType::Decoder, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamDecoderFilter(_));
Expand Down Expand Up @@ -101,7 +99,6 @@ TEST(HttpFilterConfigTest, DynamoFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
DynamoFilterConfig factory;
EXPECT_EQ(HttpFilterType::Both, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamFilter(_));
Expand All @@ -122,7 +119,6 @@ TEST(HttpFilterConfigTest, FaultFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
FaultFilterConfig factory;
EXPECT_EQ(HttpFilterType::Decoder, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamDecoderFilter(_));
Expand All @@ -138,7 +134,6 @@ TEST(HttpFilterConfigTest, GrpcHttp1BridgeFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
GrpcHttp1BridgeFilterConfig factory;
EXPECT_EQ(HttpFilterType::Both, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamFilter(_));
Expand All @@ -154,7 +149,6 @@ TEST(HttpFilterConfigTest, GrpcWebFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
GrpcWebFilterConfig factory;
EXPECT_EQ(HttpFilterType::Both, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamFilter(_));
Expand All @@ -172,7 +166,6 @@ TEST(HttpFilterConfigTest, HealthCheckFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
HealthCheckFilterConfig factory;
EXPECT_EQ(HttpFilterType::Both, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamFilter(_));
Expand Down Expand Up @@ -204,7 +197,6 @@ TEST(HttpFilterConfigTest, RouterFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
RouterFilterConfig factory;
EXPECT_EQ(HttpFilterType::Decoder, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamDecoderFilter(_));
Expand Down Expand Up @@ -240,7 +232,6 @@ TEST(HttpFilterConfigTest, IpTaggingFilter) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
IpTaggingFilterConfig factory;
EXPECT_EQ(HttpFilterType::Decoder, factory.type());
HttpFilterFactoryCb cb = factory.createFilterFactory(*json_config, "stats", context);
Http::MockFilterChainFactoryCallbacks filter_callback;
EXPECT_CALL(filter_callback, addStreamDecoderFilter(_));
Expand Down
4 changes: 0 additions & 4 deletions test/server/config/network/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ TEST(NetworkFilterConfigTest, RedisProxy) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
RedisProxyFilterConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Read, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addReadFilter(_));
Expand Down Expand Up @@ -88,7 +87,6 @@ TEST_P(RouteIpListConfigTest, TcpProxy) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
TcpProxyConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Read, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addReadFilter(_));
Expand Down Expand Up @@ -116,7 +114,6 @@ TEST_P(IpWhiteListConfigTest, ClientSslAuth) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
ClientSslAuthConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Read, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addReadFilter(_));
Expand All @@ -136,7 +133,6 @@ TEST(NetworkFilterConfigTest, Ratelimit) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
RateLimitConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Read, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addReadFilter(_));
Expand Down
2 changes: 0 additions & 2 deletions test/server/config/network/mongo_proxy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ TEST(MongoFilterConfigTest, CorrectConfigurationNoFaults) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
MongoProxyFilterConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Both, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addFilter(_));
Expand Down Expand Up @@ -212,7 +211,6 @@ TEST(MongoFilterConfigTest, CorrectFaultConfiguration) {
Json::ObjectSharedPtr json_config = Json::Factory::loadFromString(json_string);
NiceMock<MockFactoryContext> context;
MongoProxyFilterConfigFactory factory;
EXPECT_EQ(NetworkFilterType::Both, factory.type());
NetworkFilterFactoryCb cb = factory.createFilterFactory(*json_config, context);
Network::MockConnection connection;
EXPECT_CALL(connection, addFilter(_));
Expand Down
3 changes: 0 additions & 3 deletions test/server/listener_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ class TestStatsConfigFactory : public Configuration::NamedNetworkFilterConfigFac
return [](Network::FilterManager&) -> void {};
}
std::string name() override { return "stats_test"; }
Configuration::NetworkFilterType type() override {
return Configuration::NetworkFilterType::Read;
}
};

TEST_F(ListenerManagerImplWithRealFiltersTest, StatsScopeTest) {
Expand Down

0 comments on commit d123890

Please sign in to comment.