-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
refactor keyring state store methods #23943
Conversation
For #23665 I'm about to make add a lot more code to the state store for the keyring, so I'd like to pull these out to their own file. Also updates the test to use `shoenig/test` and changes the name of one method to be a little more accurate.
ad7bd51
to
cb3226f
Compare
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.
LGTM!
@@ -0,0 +1,196 @@ | |||
// Copyright (c) HashiCorp, Inc. |
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.
bless your heart for moving this to a separate file 🙇♂️
key = key.MakeInactive() | ||
} | ||
modified = true | ||
case structs.RootKeyStateRekeying, structs.RootKeyStateDeprecated: |
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 have to explicitly case this? why not just skip this line?
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.
It absolutely could be default:
but when you've got a small enum like this I feel like it helps understandability to explicitly list them. If you add a state later it's more obvious that it's missing, rather than simply falling thru the default case and doing nothing.
For #23665 I'm about to make add a lot more code to the state store for the keyring, so I'd like to pull these out to their own file. Also updates the test to use
shoenig/test
and changes the name of one method to be a little more accurate.Note for reviewers:
nomad/encrypter.go
into its own package but right now that's got a lot of dependencies on server RPC code because of keyring replication and server lifecycle. So I'm punting on that here. Once I've got Store keyring in Raft #23665 ready to ship, I might revisit that decision but I don't want to push up a refactoring PR only to have to push up another one unwinding half of it once I'm done.