Reshuffle service.Config and resource.Params #4514
Merged
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.
What changed and why?
This PR reshuffles few structures between packages.
service.BootstrapParams
was moved toresource.Params
resource
package already contains big container with many dependencies used between all Cadence services. These parameters were even used to initialize it. Parameters also contain many dependencies.resource/config.ResourceConfig
was moved toservice.Config
It various dynamic config settings shared between all services. They do not contains any dependencies.
Persistence layer used
service.BootstrapParams
andresource/config.ResourceConfig
directly. Now it will useservice.Config
and additionally introducespersistence/client.Params
structure where all dependencies required for persistence are passed.Justification
Current package layout was suboptimal because with certain changes it easily results in circular dependencies. This was already a case for
resource/config.ResourceConfig
which was moved to separate package for this reason.The goal-state of this change is as follows:
resource
package contains service related things, with dependencies. This is the package that uses other things, but itself is not used by others.service
package contains service related things, without other significant dependencies. This is the package that others can use.Thus:
service
<- used by other packages <- used byresource
Additionally there was a case where persistence layer used whole
service.BootstrapParams
struct. After reshuffle this violated above goal-state, therefore it will accept its ownpersistence/client.Params
structure with explicit dependencies it uses.How did you test it?
Existing tests
Potential risks
Release notes
Documentation Changes