-
Notifications
You must be signed in to change notification settings - Fork 7
Remove dead code #28
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
base: main
Are you sure you want to change the base?
Remove dead code #28
Conversation
e7f8088 to
5721be2
Compare
|
@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). |
|
@rainest Can we close this, or should we fix it up and get it merged? @shunr-hpe any feedback? |
|
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. |
|
I'm ok with this change |
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
|
Rebased to deconflict and add signoff:
|
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.