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

transport/grpchttp2: add http2.Framer bridge #7453

Merged
merged 22 commits into from
Aug 13, 2024

Conversation

printchard
Copy link
Contributor

Create HTTP2Bridge on the grpchttp2 package.

As part of the ongoing effort to migrate into a new Framer inside the grpchttp2 package, I added an adapter for the http2.Framer implementation to provide a way to opt-out of the new feature.

RELEASE NOTES: none

@printchard printchard added the Type: Feature New features or improvements in behavior label Jul 30, 2024
@printchard printchard added this to the 1.66 Release milestone Jul 30, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 96.06299% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.67%. Comparing base (d00dd8f) to head (eafb63c).
Report is 5 commits behind head on master.

Files Patch % Lines
internal/transport/grpchttp2/framer.go 62.50% 3 Missing ⚠️
internal/transport/grpchttp2/http2bridge.go 98.31% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7453      +/-   ##
==========================================
+ Coverage   81.41%   81.67%   +0.26%     
==========================================
  Files         357      359       +2     
  Lines       27261    27515     +254     
==========================================
+ Hits        22195    22474     +279     
+ Misses       3843     3817      -26     
- Partials     1223     1224       +1     
Files Coverage Δ
internal/transport/grpchttp2/http2bridge.go 98.31% <98.31%> (ø)
internal/transport/grpchttp2/framer.go 59.09% <62.50%> (+59.09%) ⬆️

... and 38 files with indirect coverage changes

@printchard printchard changed the title transport/grpchttp2: Add http2.Framer bridge transport/grpchttp2: qdd http2.Framer bridge Jul 30, 2024
@printchard printchard changed the title transport/grpchttp2: qdd http2.Framer bridge transport/grpchttp2: add http2.Framer bridge Jul 30, 2024
Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

Yet to completely review the tests. But this should unblock you for the time being.

internal/transport/grpchttp2/framer.go Show resolved Hide resolved
internal/transport/grpchttp2/framer.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
@easwars easwars assigned printchard and unassigned easwars Jul 31, 2024
Copy link
Contributor Author

@printchard printchard left a comment

Choose a reason for hiding this comment

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

Thanks for the review! I have replied to the conversations, I'll make the code changes to the rest later today.

internal/transport/grpchttp2/errors.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/framer.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
@printchard printchard assigned easwars and unassigned printchard Aug 2, 2024
internal/transport/grpchttp2/errors.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/framer.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
@easwars easwars assigned printchard and unassigned easwars and arvindbr8 Aug 2, 2024
@printchard printchard requested a review from easwars August 5, 2024 20:53
@printchard printchard removed their assignment Aug 5, 2024
@easwars
Copy link
Contributor

easwars commented Aug 8, 2024

Feels like we are very close to the finish line on this PR.

@printchard printchard assigned easwars and unassigned printchard Aug 8, 2024
@printchard printchard requested a review from easwars August 8, 2024 21:50
Copy link
Member

@arvindbr8 arvindbr8 left a comment

Choose a reason for hiding this comment

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

I think we should be done in this last pass

internal/transport/grpchttp2/framer.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge.go Show resolved Hide resolved
@arvindbr8 arvindbr8 assigned arvindbr8 and printchard and unassigned easwars and arvindbr8 Aug 8, 2024
Copy link
Member

@arvindbr8 arvindbr8 left a comment

Choose a reason for hiding this comment

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

LGTM, only a few optional comments. I dont want to block merge on them. I would wait for an approval from @easwars

internal/transport/grpchttp2/http2bridge.go Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
internal/transport/grpchttp2/http2bridge_test.go Outdated Show resolved Hide resolved
@arvindbr8 arvindbr8 assigned easwars and printchard and unassigned arvindbr8 Aug 12, 2024
@printchard printchard removed their assignment Aug 12, 2024
}, nil
default:
buf := fr.pool.Get(int(hdr.Size))
huf := f.(*http2.UnknownFrame)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, what's a huf? lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant to type uf lol.

return uint16(b[0])<<8 | uint16(b[1])
}

// checkWrittenHeader takes a byte buffer representing a written frame header
Copy link
Contributor

Choose a reason for hiding this comment

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

The function name has changed. Needs fixing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the actual description but forgot the name 😅. It is done now.

@easwars easwars assigned printchard and unassigned easwars Aug 13, 2024
@printchard printchard assigned easwars and arvindbr8 and unassigned printchard Aug 13, 2024
@easwars easwars merged commit 366decf into grpc:master Aug 13, 2024
13 checks passed
infovivek2020 pushed a commit to infovivek2020/grpc-go that referenced this pull request Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants