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

Refactor PagedDoraWorker by injectin...; Port [#18181] to branch-3-1.1.x #18381

Merged

Conversation

alluxio-bot
Copy link
Contributor

What changes are proposed in this pull request?

  1. If an object is created inside PagedDoraWorker constructor, extract that creation to before the constructor and use dependency injection to inject it to the worker object. This doesn't change any creation logic, just a refactor to better adapt to dependency injection flavor.
  2. There is a circular dependency between MetaManager and PagedDoraWorker. This change removes that cycle. Now we create one, then create the other. Before, we create one and in the construction, we let this ref escape and create the other. Some methods are either moved or changed to static.
  3. By adapting to dependency injection, we rely on UfsManager interface instead of DoraUfsManager implementation. Some method signatures are extracted to the interface level.
  4. A few other small refactors to get rid of some downcasts and variable scope changes. Reasons are attached in comments on this PR.

Why are the changes needed?

Improve code quality and extensibility.

Does this PR introduce any user facing changes?

No. All refactor changes are small and equivalent to existing code. So nothing should break.

[This is an auto-generated PR to cherry-pick committed PR #18181 into target branch branch-3-1.1.x]

### What changes are proposed in this pull request?

1. If an object is created inside `PagedDoraWorker` constructor, extract that creation to before the constructor and use dependency injection to inject it to the worker object. This doesn't change any creation logic, just a refactor to better adapt to dependency injection flavor.
2. There is a circular dependency between `MetaManager` and `PagedDoraWorker`. This change removes that cycle. Now we create one, then create the other. Before, we create one and in the construction, we let `this` ref escape and create the other. Some methods are either moved or changed to `static`.
3. By adapting to dependency injection, we rely on `UfsManager` interface instead of `DoraUfsManager` implementation. Some method signatures are extracted to the interface level.
4. A few other small refactors to get rid of some downcasts and variable scope changes. Reasons are attached in comments on this PR.

### Why are the changes needed?

Improve code quality and extensibility.

### Does this PR introduce any user facing changes?

No. All refactor changes are small and equivalent to existing code. So nothing should break.

			pr-link: #18181
			change-id: cid-4f9e9bc770b12253188bb541dd456ef3cd889c2b
@jiacheliu3
Copy link
Contributor

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit b558899 into branch-3-1.1.x Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-code-quality code quality improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants