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.
Before this PR
Clients were constructed via a
new
function that took 5 arguments. Configuration updates were handled by creating aRefreshHandle
from the client and calling a method on that.After this PR
==COMMIT_MSG==
Client construction has been refactored to use the
refreshables
crate and builder-style types.==COMMIT_MSG==
The new API more closely matches Dialogue, and should be significantly nicer to work with.
Builder
type to avoid having to pass tons of arguments into a function. The service name and user agent are required, but everything else, including metric registries, is optional, making tests a little bit easier to write.ClientFactory
which takes aRefreshable<ServicesConfig>
and creates live-updating clients for the services within the configuration. While this is currently very simple and just creates a new client every time, it can be updated in the future to cache clients like Dialogue so that connection pools, node status, etc can be shared.Possible downsides?
Not providing a user agent or service name to the builder results in a panic rather than compile-time error, but that should be something that's caught immediately and fixed if someone forgets.