-
Notifications
You must be signed in to change notification settings - Fork 4
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
chore: refactored the ServiceStatus interface methods to a new interface #801
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Harsh Sawarkar <[email protected]>
Thanks @HarshSawarkar for the contribution, welcome 🎊 . |
Codecov ReportAttention: Patch coverage is ❌ Your patch check has failed because the patch coverage (67.34%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. @@ Coverage Diff @@
## main #801 +/- ##
============================================
+ Coverage 84.59% 84.66% +0.06%
- Complexity 640 641 +1
============================================
Files 130 131 +1
Lines 2960 2973 +13
Branches 208 208
============================================
+ Hits 2504 2517 +13
Misses 388 388
Partials 68 68
🚀 New features to boost your workflow:
|
Thanks, @Nana-EC ! I’ll be more than happy to resolve any comments received from the team. I’m excited and looking forward to making more contributions. By the way, is there a Discord channel or group to connect with in case I have any doubts or need help? |
Signed-off-by: Harsh Sawarkar <[email protected]>
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.
Overall looks good, leave some comments and suggestions, mostly nits.
However PR is failing checks, please let me know if you have issues with running the tests. I will do a second pass once all Tests are passing.
Thanks!
@@ -1,4 +1,4 @@ | |||
#·SPDX-License-Identifier:·Apache-2.0 |
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.
was this change made by spotless
? otherwise I would recommend not changing files that don't need to be changed.
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.
if it was spotlessApply, then maybe we can consider the unrelated format change.
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.
This is a bad characters fix (and much appreciated in this case).
The ·
somehow got copied into the YAML file, and it makes the SPDX identifier not process correctly.
I assume spotlessApply made the change, but it could have just been an eagle-eyed review.
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.
Thanks for the clarification @jsync-swirlds
@NonNull final HealthService healthService, | ||
@NonNull final PbjBlockStreamService pbjBlockStreamService, | ||
@NonNull final PbjBlockAccessService pbjBlockAccessService, | ||
@NonNull final WebServerConfig.Builder webServerBuilder, | ||
@NonNull final ServerConfig serverConfig, | ||
@NonNull final ConfigurationLogging configurationLogging) { | ||
this.serviceStatus = requireNonNull(serviceStatus); | ||
this.webServerStatus = webServerStatus; |
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.
this.webServerStatus = webServerStatus; | |
this.webServerStatus = requireNonNull(webServerStatus); |
In general we use preconditions on constructors to fail fast.
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.
Updated
// SPDX-License-Identifier: Apache-2.0 | ||
package com.hedera.block.server.service; | ||
|
||
import dagger.Binds; | ||
import dagger.Module; | ||
import javax.inject.Singleton; | ||
|
||
/** A Dagger module for providing dependencies for WebServerStatus Module. */ | ||
@Module | ||
public interface WebServerStatusInjectionModule { | ||
|
||
/** | ||
* Binds the service status to the Web Server status implementation. | ||
* | ||
* @param webServerStatus needs a service status implementation | ||
* @return the service status implementation | ||
*/ | ||
@Singleton | ||
@Binds | ||
WebServerStatus bindWebServerStatus(WebServerStatusImpl webServerStatus); | ||
} |
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.
We try to keep a single InjectionModule file per module
in this case com.hedera.block.server.service
package.
We can add this Binding in existing file: ServiceInjectionModule
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.
Updated.
@@ -22,6 +23,7 @@ | |||
modules = { | |||
NotifierInjectionModule.class, | |||
ServiceInjectionModule.class, | |||
WebServerStatusInjectionModule.class, |
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.
Do we want to add a new InjectionModule?
@@ -106,6 +109,7 @@ public PbjBlockStreamServiceProxy( | |||
@NonNull final ProducerConfig producerConfig) { | |||
|
|||
this.serviceStatus = Objects.requireNonNull(serviceStatus); | |||
this.webServerStatus = webServerStatus; |
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.
this.webServerStatus = webServerStatus; | |
this.webServerStatus = Objects.requireNonNull(webServerStatus); |
this.serviceStatus = serviceStatus; | ||
this.webServerStatus = webServerStatus; | ||
this.blockReader = blockReader; | ||
this.metricsService = metricsService; |
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.
this.serviceStatus = serviceStatus; | |
this.webServerStatus = webServerStatus; | |
this.blockReader = blockReader; | |
this.metricsService = metricsService; | |
this.serviceStatus = Objects.requireNonNull(serviceStatus); | |
this.webServerStatus = Objects.requireNonNull(webServerStatus); | |
this.blockReader = Objects.requireNonNull(blockReader); | |
this.metricsService = Objects.requireNonNull(metricsService); |
this.mediator = mediator; | ||
this.metricsService = metricsService; | ||
this.serviceStatus = serviceStatus; | ||
this.webServerStatus = webServerStatus; |
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.
this.mediator = mediator; | |
this.metricsService = metricsService; | |
this.serviceStatus = serviceStatus; | |
this.webServerStatus = webServerStatus; | |
this.mediator = Objects.requireNonNull(mediator); | |
this.metricsService = Objects.requireNonNull(metricsService); | |
this.serviceStatus = Objects.requireNonNull(serviceStatus); | |
this.webServerStatus = Objects.requireNonNull(webServerStatus); |
this.metricsService = metricsService; | ||
this.webServerStatus = webServerStatus; |
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.
this.metricsService = metricsService; | |
this.webServerStatus = webServerStatus; | |
this.metricsService = Objects.requireNonNull(metricsService); | |
this.webServerStatus = Objects.requireNonNull(webServerStatus); |
public HealthServiceImpl(@NonNull ServiceStatus serviceStatus) { | ||
this.serviceStatus = serviceStatus; | ||
public HealthServiceImpl(@NonNull WebServerStatus webServerStatus) { | ||
this.webServerStatus = webServerStatus; |
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.
this.webServerStatus = webServerStatus; | |
this.webServerStatus = Objects.requireNonNull(webServerStatus); |
() -> getBlockAsFileBlockStreamManager( | ||
getAbsoluteFolder("build/resources/test//BlockAsDirException/1/"))); | ||
} |
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.
was this also made by spotlessApply? otherwise better not to commit this auto changes by some IDE style parser.
We use the included spotless plugin to enforce format and style checks
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.
Yes, it was made by spotlessApply, so I’m keeping it intact.
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.
Review and approve .github/ISSUE_TEMPLATE/03-Bug-Template.yml
Signed-off-by: Harsh Sawarkar <[email protected]>
Just an FYI, the reason basically every file conflicts now is that we did a rename of all packages to reflect the |
Reviewer Notes
WebServerStatus
interface.Related Issue(s)
Fixes #575