Skip to content

Add FilterConfigurationBase#518

Merged
dubious90 merged 5 commits intoenvoyproxy:masterfrom
oschaaf:extension-refactor-prelude-2
Sep 10, 2020
Merged

Add FilterConfigurationBase#518
dubious90 merged 5 commits intoenvoyproxy:masterfrom
oschaaf:extension-refactor-prelude-2

Conversation

@oschaaf
Copy link
Copy Markdown
Member

@oschaaf oschaaf commented Sep 9, 2020

Base class for test server http filter extension configuration.
Provides support for shared configuration and consolidates
shared code.

Potentially useful in that it provides a path to cache parsed
and interpreted configuration accross extensions as it flows
through the server pipeline. This isn't a goal for now however,
this is a prelude to #512, which includes it and provides a means
to see the end goal.

Signed-off-by: Otto van der Schaaf oschaaf@we-amp.com

Base class for test server http filter extension configuration.
Provides support for shared configuration and consolidates
shared code.

Potentially useful in that it provides a path to cache parsed
and interpreted configuration accross extensions as it flows
through the server pipeline. This isn't a goal for now however,
this is a prelude to envoyproxy#512, which includes it and provides a means
to see the end goal.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Sep 9, 2020

note to reviewers: to avoid a dip in coverage, this doesn't wire up in BUILD yet. There's no separate testing on this around yet, though it will get tested once we're done via extensions as the extensions rely on this (see #512).

Copy link
Copy Markdown
Contributor

@dubious90 dubious90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Have a couple comments.

Just to make sure I follow, there is a PR coming soon that will integrate these changes into our existing filters, and that's when we'll bring in both the BUILD changes and the testing?

* or a shared pointer to the effective configuration. We use a shared pointer to avoid copying
* in the static configuration flow.
*/
using EffectiveFilterConfiguration =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think including StatusOr as part of this is a little confusing. Can we make EffectiveFilterConfiguration just the shared pointer, and then return StatusOr?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, let me know if you feel this was properly addressed.

* @param filter_name name of the extension that is consuming this. Used during error response
* generation.
*/
FilterConfigurationBase(nighthawk::server::ResponseOptions static_proto_config,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be a const reference?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

namespace Nighthawk {
namespace Server {

FilterConfigurationBase::FilterConfigurationBase(nighthawk::server::ResponseOptions proto_config,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: proto_config has a different name in the header file.

}

bool FilterConfigurationBase::maybeSendErrorReply(
Envoy::Http::StreamDecoderFilterCallbacks& decoder_callbacks) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be const? Or is sendLocalReply a non-const function?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendLocalReply is a non-const function, so we can't const this.

@dubious90 dubious90 added waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. and removed waiting-for-review A PR waiting for a review. labels Sep 10, 2020
…r-prelude-2

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Copy link
Copy Markdown
Member Author

@oschaaf oschaaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dubious90 review feedback addressed in 562a1d9, including the updated canonical representation which uses absl::StatusOr, so we can open up the discussion on that.

}

bool FilterConfigurationBase::maybeSendErrorReply(
Envoy::Http::StreamDecoderFilterCallbacks& decoder_callbacks) const {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendLocalReply is a non-const function, so we can't const this.

* or a shared pointer to the effective configuration. We use a shared pointer to avoid copying
* in the static configuration flow.
*/
using EffectiveFilterConfiguration =
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, let me know if you feel this was properly addressed.

* @param filter_name name of the extension that is consuming this. Used during error response
* generation.
*/
FilterConfigurationBase(nighthawk::server::ResponseOptions static_proto_config,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Sep 10, 2020

Looks good. Have a couple comments.

Just to make sure I follow, there is a PR coming soon that will integrate these changes into our existing filters, and that's when we'll bring in both the BUILD changes and the testing?

that is correct. this is a subset of #512 which has the BUILD file and everything else. The BUILD file is excluded to avoid coverage from failing because of dipping below the threshold.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Sep 10, 2020

@dubious90 as discussed, backed out the absl::StatusOr typedef in b894e96

@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Sep 10, 2020
@dubious90 dubious90 merged commit d9eda43 into envoyproxy:master Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-for-review A PR waiting for a review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants