Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract SignalHandler class for re-use #282

Merged
merged 10 commits into from
Jun 18, 2020

Conversation

oschaaf
Copy link
Member

@oschaaf oschaaf commented Jan 15, 2020

In preparation of sharing functionality for signal handling,
extract what we have right now into a SignalHandler class.

Preparation for #280

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

In preparation of sharing functionality for signal handling,
extract what we have right now into SignalHandler.

Status: draft

For fixing envoyproxy#280

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
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
Member Author

oschaaf commented Jan 15, 2020

@mum4k requesting early feedback on this; this extracts our signal handling code from nighthawk_service into a separate class for re-use later. In terms of design and fool proofing this we can probably enhance this, but a perfect design is not the initial goal:

  • I think this would be an improvement compared to what's on master today as we contain this functionality.
  • service_main.cc gets much cleaner.

Would it make sense to shoot for landing this as-is?

…ndler

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf changed the title Extract SignalHandler [DRAFT] Extract SignalHandler Jan 15, 2020
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
…ndler

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf added the P3 label Jan 16, 2020
@oschaaf oschaaf added the waiting-for-review A PR waiting for a review. label Jun 10, 2020
@oschaaf oschaaf marked this pull request as ready for review June 10, 2020 20:11
@oschaaf oschaaf changed the title [DRAFT] Extract SignalHandler Extract SignalHandler class for re-use Jun 10, 2020
Copy link
Collaborator

@mum4k mum4k left a comment

Choose a reason for hiding this comment

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

This is a definitive improvement and we should be able to merge it in after addressing a few nits.


namespace Nighthawk {

using SignalCallback = std::function<void()>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is part of the header - can we document it?


using SignalCallback = std::function<void()>;

class SignalHandler final : public Envoy::Logger::Loggable<Envoy::Logger::Id::main> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's also add documentation for the class including an example of usage.


class SignalHandler final : public Envoy::Logger::Loggable<Envoy::Logger::Id::main> {
public:
SignalHandler(const SignalCallback& signal_callback);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add documentation for the constructor?

class SignalHandler final : public Envoy::Logger::Loggable<Envoy::Logger::Id::main> {
public:
SignalHandler(const SignalCallback& signal_callback);
SignalHandler(SignalHandler const&) = delete;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a single comment above these two to indicate the intention, something like:

// Not copyable or movable.

@mum4k mum4k 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 Jun 17, 2020
@mum4k mum4k self-assigned this Jun 17, 2020
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf
Copy link
Member Author

oschaaf commented Jun 18, 2020

@mum4k thanks, comments addressed in e665347

@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 Jun 18, 2020
@mum4k mum4k merged commit a921fc9 into envoyproxy:master Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 waiting-for-review A PR waiting for a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants