-
Notifications
You must be signed in to change notification settings - Fork 5
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
Simplify the API of the Store type #118
base: main
Are you sure you want to change the base?
Conversation
be6e9e2
to
62f124b
Compare
62f124b
to
e9333a6
Compare
e9333a6
to
09ffa37
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.
Does each intermediate commit build, with this order of unexporting before changing NewUpdater's signature? Obviously NewUpdater becomes unusable in one of the intermediate commits until a later one, but as long as each commit builds that seems okay.
(I'm trying to work out whether you can rebase-and-merge or whether you should squash-and-merge, to try and keep all commits in the history buildable where possible)
Either way, LGTM!
I was planning to squash it anyway, though mainly at this point it was an essay in the idea. I realized later that I have some usage of the Watcher in tailsql that would need to be updated too, so I may revisit this and ask for a second opinion before I attempt to merge it. |
09ffa37
to
29a82f5
Compare
Move the unexported utility type into the shared test package. Update the tests to use the test package version instead.
The watcher semantics are still useful for plumbing, but it's hard to use correctly, so unexport it. Now that watcher is unexported, move its tests from a separate package into an internal package test. It is now no longer necessary to have the "watcher" method, so remove it.
Instead of taking a watcher (which is now unexported), take the *Store and the secret name directly. Report an error, and add an error field so that updates can detect and recover from them. Add a StaticUpdater constructor to make an Updater that vends a static value, analogous to StaticSecret.
f717e7b
to
60ca42f
Compare
Switching back to a draft to think on't some more. |
A proposal to simplify the API of the Store type a bit, to make it harder to
misuse. This is the first of two changes we discussed separately.
As a first step, this change unexports the Watcher type, which is mainly useful
as a plumbing tool inside the package. There are multiple commits here that can
be reviewed (mostly) separately.
We also talked about maybe removing (or unexporting) the Secret type too. That
isn't included here, but can be done as a follow-up. We have a bunch of
existing use of that API that will require some adjusting, whereas Watcher was
entirely unused outside the package.