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

tfsdk: Migrate server to internal/proto6server package #310

Merged
merged 3 commits into from
May 3, 2022

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Apr 29, 2022

Reference: #215

This change was accomplished by the following (with zero actual logic changes):

  • mkdir internal/proto6server
  • git mv tfsdk/serve* internal/proto6server/
  • Replacing package tfsdk with package proto6server in those moved files
  • Removing NewProtocol6Server(), Serve(), and ServeOpts in moved files
  • Adding necessary tfsdk. scoping to the now external tfsdk package references
  • Moved necessary unexported methods (e.g. Schema.tfprotov6Schema()) to internal/toproto6 (this package will be expanded further in the future)
  • Moved attribute plan modification testing (including test plan modifiers) to internal/proto6server/attribute_plan_modification_test.go
  • Moved attribute validation testing (including test validators) to internal/proto6server/attribute_validation_test.go
  • Moved block plan modification testing (including test plan modifiers) to internal/proto6server/block_plan_modification_test.go
  • Moved block validation testing (including test validators) to internal/proto6server/block_validation_test.go
  • Copied tfsdk Config/Plan/State.getAttributeValue methods to internal/proto6server (Config/Plan/State)GetAttributeValue functions temporarily to not export existing methods

There are some other planned refactorings in the future for the internal/proto6server and tfsdk code including:

  • Creating a shared implementation for the underlying Config/Plan/State details
  • Creating a internal/fromproto6 package with protocol version 6 type to framework type conversions
  • Migrating additional framework type to protocol version 6 code to internal/toproto6
  • Migrating RPC handling into individual code and test files

These will be handled separately to reduce review burden, as this change was already very large.

Reference: #215

This change was accomplished by:

- `mkdir internal/proto6server`
- `git mv tfsdk/serve* internal/proto6server/`
- Replacing `package tfsdk` with `package proto6server` in those moved files
- Removing `NewProtocol6Server()`, `Serve()`, and `ServeOpts` in moved files
- Adding necessary `tfsdk.` scoping to the now external `tfsdk` package references
- Moved necessary unexported methods (e.g. `Schema.tfprotov6Schema()`) to `internal/toproto6` (this package will be expanded further in the future)
- Moved attribute plan modification testing (including test plan modifiers) to `internal/proto6server/attribute_plan_modification_test.go`
- Moved attribute validation testing (including test validators) to `internal/proto6server/attribute_validation_test.go`
- Moved block plan modification testing (including test plan modifiers) to `internal/proto6server/block_plan_modification_test.go`
- Moved block validation testing (including test validators) to `internal/proto6server/block_validation_test.go`
- Copied tfsdk Config/Plan/State.getAttributeValue methods to internal/proto6server (Config/Plan/State)GetAttributeValue functions temporarily to not export existing methods

There are some other planned refactorings in the future for the `internal/proto6server` and `tfsdk` code including:

- Creating a shared implementation for the underlying `Config`/`Plan`/`State` details
- Creating a `internal/fromproto6` package with protocol version 6 type to framework type conversions
- Migrating additional framework type to protocol version 6 code to `internal/toproto6`
- Migrating RPC handling into individual code and test files

These will be handled separately to reduce review burden, as this change was already very large.
@bflad bflad added the tech-debt Issues tracking technical debt that we're carrying. label Apr 29, 2022
@bflad bflad added this to the v0.8.0 milestone Apr 29, 2022
@bflad bflad requested a review from a team as a code owner April 29, 2022 20:17
Since the code is now external to the package that declares these as deprecated, staticcheck will raise an issue. This silences those reports, either by denoting that the support is required in the case of Block support, or denoting that the functionality will be removed in the case of ResourceImportStateNotImplemented().
Copy link
Contributor

@bendbennett bendbennett left a comment

Choose a reason for hiding this comment

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

Chunky PR :)

Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

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

Thank you for the report on how this was created.
It's impractical for me to read through the code changes, but with that list at least it's clear it's all "moving stuff around" to create the new structure.

LGTM

@bflad
Copy link
Contributor Author

bflad commented May 3, 2022

Thank you both!

@bflad bflad merged commit 09acc68 into main May 3, 2022
@bflad bflad deleted the bflad-providerserver-migration-part-2 branch May 3, 2022 14:10
@github-actions
Copy link

github-actions bot commented Jun 3, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tech-debt Issues tracking technical debt that we're carrying.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants