Skip to content
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

Reshuffle service.Config and resource.Params #4514

Conversation

vytautas-karpavicius
Copy link
Contributor

@vytautas-karpavicius vytautas-karpavicius commented Sep 27, 2021

What changed and why?
This PR reshuffles few structures between packages.

  1. service.BootstrapParams was moved to resource.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.

  2. resource/config.ResourceConfig was moved to service.Config
    It various dynamic config settings shared between all services. They do not contains any dependencies.

  3. Persistence layer used service.BootstrapParams and resource/config.ResourceConfig directly. Now it will use service.Config and additionally introduces persistence/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 by resource

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 own persistence/client.Params structure with explicit dependencies it uses.

How did you test it?
Existing tests

Potential risks

Release notes

Documentation Changes

@vytautas-karpavicius vytautas-karpavicius force-pushed the resource-params branch 2 times, most recently from bc04a91 to 018b3ad Compare September 27, 2021 12:52
@vytautas-karpavicius vytautas-karpavicius changed the title Resource params Reshuffle service.Config and resource.Params Sep 27, 2021
@vytautas-karpavicius vytautas-karpavicius marked this pull request as ready for review September 27, 2021 13:36
@vytautas-karpavicius vytautas-karpavicius requested a review from a team September 27, 2021 13:36
@coveralls
Copy link

coveralls commented Sep 27, 2021

Pull Request Test Coverage Report for Build 54cbd3e0-8034-407b-ba59-12520157e8fd

  • 24 of 30 (80.0%) changed or added relevant lines in 11 files are covered.
  • 53 unchanged lines in 11 files lost coverage.
  • Overall coverage decreased (-0.03%) to 56.435%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/server/cadence/server.go 0 1 0.0%
service/worker/service.go 1 2 50.0%
common/persistence/persistence-tests/dbVisibilityPersistenceTest.go 0 2 0.0%
common/resource/resourceImpl.go 3 5 60.0%
Files with Coverage Reduction New Missed Lines %
common/resource/resourceImpl.go 1 79.11%
common/task/weightedRoundRobinTaskScheduler.go 1 89.64%
common/task/fifoTaskScheduler.go 2 84.54%
common/types/mapper/thrift/shared.go 2 64.65%
service/history/execution/mutable_state_builder.go 2 69.77%
service/history/shard/context.go 2 66.64%
common/cache/lru.go 3 90.73%
common/persistence/nosql/nosqlplugin/cassandra/workflow.go 3 49.77%
service/history/execution/context.go 6 73.83%
common/persistence/nosql/nosqlplugin/cassandra/workflowUtils.go 12 76.76%
Totals Coverage Status
Change from base Build 738b5db7-e043-4226-ad46-5ab5065493c6: -0.03%
Covered Lines: 80181
Relevant Lines: 142076

💛 - Coveralls

Copy link
Contributor

@mantas-sidlauskas mantas-sidlauskas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vytautas-karpavicius vytautas-karpavicius merged commit 467824e into cadence-workflow:master Sep 28, 2021
@vytautas-karpavicius vytautas-karpavicius deleted the resource-params branch September 28, 2021 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants