Repository navigation
Delete the 2018 protocol module - #7
Merged
Merged
Conversation
Mysqlex.Client now does the connection phase properly, which left the
2018 handshake parsing in Mysqlex.Protocol as dead code. Deleted, and
the module renamed to Mysqlex.Connection — settling decision 12, since
"protocol" meant both the DBConnection implementation and the namespace
holding the codecs.
Its state is a %Mysqlex.Client{} and connect/1 delegates, so the
behaviour is a wrapper rather than a participant. That is what keeps
decision 15's option open: nothing below this file knows DBConnection
exists.
Mysqlex.Error becomes an exception, since DBConnection specifies its
callbacks as returning Exception.t(). Failures that are not server
errors — a dead socket, an auth method we cannot speak — are wrapped in
one rather than returned raw, because the contract asks for an
exception either way.
An integration test connects through DBConnection itself, so the
wrapper is covered rather than assumed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopened against
master. #6 merged intophase-2-handshakeafter that branch had already landed via #5, so this commit never reachedmaster. Same single commit, nothing else changed.Mysqlex.Clientnow runs the connection phase, which left the 2018 handshake parsing inMysqlex.Protocolas dead code.handshake/1,parse_header/1,parse_payload_body/2andrecv_msg/2— what this project consisted of for eight years — are gone. Their last contribution was being the code run against real captured bytes to demonstrate theMatchErroron MySQL 8.4.4.Three things settled
Decision 12 is closed.
Mysqlex.Protocolmeant both theDBConnectionimplementation and the namespace holding the codecs. NowMysqlex.Connectionis the behaviour andMysqlex.Protocol.*is unambiguously the parsers. Renamed while it was still small, as the decision said to.The wrapper is thin on purpose.
connect/1delegates and the state is a%Mysqlex.Client{}. Nothing belowconnection.exknowsDBConnectionexists, which keeps decision 15's swap cheap rather than theoretical.Mysqlex.Erroris an exception now, becauseDBConnectionspecifies its callbacks as returningException.t()— listed as inevitable when the struct was created, now forced by the contract. Failures that are not server errors, like a dead socket or an auth method the driver cannot speak, are wrapped rather than returned raw, since the contract wants an exception either way.Coverage
An integration test connects through
DBConnection.start_link/2, so the wrapper is exercised rather than assumed. 50 tests with--include integration.The command phase callbacks still return
DBConnection.ConnectionError.COM_QUERYis next.