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

Introduce internal/fwserver package and migrate GetProviderSchema #319

Merged
merged 1 commit into from May 6, 2022

Conversation

bflad
Copy link
Member

@bflad bflad commented May 6, 2022

Reference: #215

This step of the provider server refactoring introduces a new internal/fwserver package that will contain the provider server implementation for any protocol version, there only being a version 6 implementation at the moment. This package will contain only framework-native types that aren't already defined by the tfsdk package that are used by provider developers today, which is necessary to prevent import cycles. The protocol specific implementations will then wrap this framework server implementation and handle any necessary conversion of protocol specific types to framework specific types and back. Eventually, the existing internal/proto6server implementation will make no reference to any framework native types except the framework server and protocol type conversions.

For now, only the GetProviderSchema RPC is migrated to show what this refactoring will look like for the rest of the RPCs.

This has a few benefits which can be seen here including clear abstractions for protocol specific handling versus generic framework handling and unit testing at those abstraction boundaries.

Please note that much of the "end-to-end" unit testing is already in the internal/proto6server package, which shows no changes in behavior, and therefore can help gain confidence in this change not introducing potential regressions.

Reference: #215

This step of the provider server refactoring introduces a new `internal/fwserver` package that will contain the provider server implementation for any protocol version, there only being a version 6 implementation at the moment. This package will contain only framework-native types that aren't already defined by the `tfsdk` package that are used by provider developers today, which is necessary to prevent import cycles. The protocol specific implementations will then wrap this framework server implementation and handle any necessary conversion of protocol specific types to framework specific types and back. Eventually, the existing `internal/proto6server` implementation will make no reference to any framework native types except the framework server and protocol type conversions.

For now, only the `GetProviderSchema` RPC is migrated to show what this refactoring will look like for the rest of the RPCs.

This has a few benefits which can be seen here including clear abstractions for protocol specific handling versus generic framework handling and unit testing at those abstraction boundaries.
@bflad bflad added the tech-debt Issues tracking technical debt that we're carrying. label May 6, 2022
@bflad bflad added this to the v0.8.0 milestone May 6, 2022
@bflad bflad requested a review from a team as a code owner May 6, 2022 16:15
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.

I really like the direction this is going in, a distinct separation of concerns for protocol-specific and framework-specific handling is a great idea and makes logical sense. I have to be honest though and confess that I didn’t look at internal/toproto6/getproviderschema_test.go. Great work Brian!

@bflad bflad merged commit 555a882 into main May 6, 2022
@bflad bflad deleted the bflad-fwserver-getproviderschema branch May 6, 2022 17:15
@github-actions
Copy link

github-actions bot commented Jun 6, 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 6, 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.

None yet

2 participants