-
Notifications
You must be signed in to change notification settings - Fork 955
Feature/service manager in protocol context #8533
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
Feature/service manager in protocol context #8533
Conversation
238fb8e
to
b5244a8
Compare
bcd1ac8
to
c3285d6
Compare
@@ -52,4 +54,22 @@ public interface ServiceManager { | |||
* is unavailable | |||
*/ | |||
<T extends BesuService> Optional<T> getService(Class<T> serviceType); | |||
|
|||
/** A toy implementation of ServiceManager, suitable for test and mocks. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this live in the test packages instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol context builder is using it for the default/unset service manager. I might need to revisit that comment to reflect that
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
…y their concerns Signed-off-by: garyschulte <garyschulte@gmail.com>
… base class Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
c3285d6
to
2ca8869
Compare
@@ -52,4 +54,22 @@ public interface ServiceManager { | |||
* is unavailable | |||
*/ | |||
<T extends BesuService> Optional<T> getService(Class<T> serviceType); | |||
|
|||
/** A basic implementation of ServiceManager, suitable for tests. */ | |||
class SimpleServiceManager implements ServiceManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personal pref: break this out to its own class, possibly in a test path.
PR description
Adds plugin service manager to protocol context. The specific motivation is to have plugin services available to AbstractBlockProcessor (in a subsequent PR), but generally this is a logical and convenient way to surface plugin services in the besu codebase.
The scope of the code change is minimal, but there are a lot of test fixture changes. Also, the ProtocolContext constructor is now protected so we do not have to plumb a bunch of unnecessary items into it for unit tests which directly construct a test protocol context.
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests