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

PSQLBackendMessageDecoder is a SingleStepDecoder #174

Merged
merged 1 commit into from
Sep 18, 2021

Conversation

fabianfett
Copy link
Collaborator

Motivation

We want to use the PSQLBackendMessageDecoder as NIOSingleStepByteToMessageDecoder in the future.

Changes

  • Rename PSQLBackendMessage.Decoder to PSQLBackendMessageDecoder. Namespacing the Decoder in its own MessageType was a stupid idea. Sorry. Reverting this now.
  • PSQLBackendMessageDecoder get's its own file. Implementation copy and pasted.
  • PSQLBackendMessageDecoder implements NIOSingleStepByteToMessageDecoder protocol, which has an auto-conformance to ByteToMessageDecoder
  • Move PSQLBackendMessage.ensureAtLeastNBytesRemaining into an internal extension on ByteBuffer

Result

  • Cleaner, less clever code.

Notes

  • PSQLBackendMessageDecoder has a very high test code coverage. For this reason

@fabianfett fabianfett requested a review from gwynne September 18, 2021 11:14
@fabianfett fabianfett added the enhancement New feature or request label Sep 18, 2021
Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

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

LGTM!

@fabianfett fabianfett merged commit 7acca81 into vapor:main Sep 18, 2021
@fabianfett fabianfett deleted the ff-single-step-decoder branch September 18, 2021 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants