Open
Conversation
e7f8088 to
5721be2
Compare
Contributor
Author
|
@bmcdonald3 also worth considering for upstream, albeit less likely to be a concern for conflicts (insofar as this is all unused, I don't expect it to change in any CSM patches). |
Member
|
@rainest Can we close this, or should we fix it up and get it merged? @shunr-hpe any feedback? |
Member
|
We were waiting on the changes to be upstream, to avoid potential conflicts, however as @rainest points out its dead code so that is unlikely. |
Collaborator
|
I'm ok with this change |
shunr-hpe
approved these changes
Aug 21, 2025
5721be2 to
d9dbd6d
Compare
Remove an unused test scaffold for the API package. This scaffold contained one function, which registered the aggregate API router at the root path, but did not serve it. It contained nothing specific to PCS. Most of the API lacks tests entirely. One section (health) sets up its own test server independently. Signed-off-by: Travis Raines <571832+rainest@users.noreply.github.com>
Remove several unused utility functions from the model package. Move several API-only types from the model package to the api package. Signed-off-by: Travis Raines <571832+rainest@users.noreply.github.com>
Signed-off-by: Travis Raines <571832+rainest@users.noreply.github.com>
Remove the InitFromStorage() function from the DistributedLockProvider interface. This method was only used in tests, and was redundant. Init() can handle all cases where InitFromStorage() would be used. Signed-off-by: Travis Raines <571832+rainest@users.noreply.github.com>
d9dbd6d to
ec1874c
Compare
Contributor
Author
|
Rebased to deconflict and add signoff:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing PCS codebase contains several pieces of dead code under
internal/. I decided to remove it afterFrom
mainas of fc206aa:PowerStatusMonitorStopandPowerStatusMonitorChangeInterval: added in the initial version of power monitoring and never reachable. These are hypothetically useful, but that they've gone unused for 3y+ suggests they're YAGNI features.Either can be handled in the
cmdpackage instead. APCS_POWER_SAMPLE_INTERVALenvvar is already available, and we can add a way to disabledomain.PowerStatusMonitorInit()if desired.internal/model/models.gocontains generic utility functions added in the initial commit and never used. Most of these are handled by https://pkg.go.dev/golang.org/x/exp/slices. The file also contained two types that are only used by the API; these are now in theapipackage.internal/model/power-status.gocontained some unused utility function to convert an iota type to an int. These aren't useful, you can cast to an int if you really want to.fromStorageETCDandfromStorageMEMhave been left as-is. These exist because of poor interface design whereStorageProviderandDistributedLockProvideraren't truly independent, and should be addressed as part of a larger refactor instead.I did remove the
DistributedLockProvider.InitFromStorage()functions, which were effectively dead for lack of non-test use.