Skip to content

Clean up the dialing logic related to multiplexing

Sami Hiltunen requested to merge smh-internal-dial-package into master

This MR contains no functional changes, only some clean up related of recent additions related to the connection multiplexing.

  • Praefect requires a more flexible API to plug in its multiplexing implementation to when dialing to Gitaly. This implementation should not be part of the public API interface so we don't have to maintain backwards compatibility. This commit moves the internals of the dialing into an internal subpackage. This way we can retain the exisiting public APIs we offer in client package and provide more flexible APIs for internal use in ìnternal/gitaly/client.

  • DialWithMux should not be part of our public API as it is an implementation detail between Praefect and Gitaly. Let's remove DialWithMux from the public package thus and use the internal dialing API in Praefect.

  • This commit shuffles some of the backchannel's client handshake code around to minimize the dependency drilling later required. Initializing ClientHandshaker with the logger once allows us to later only inject a minimal set of dependencies into the dialing functions as we don't have to drill down the logger which would be needed by the ServerFactory's ClientHandshake method currently. After this change, the ClientHandshaker already contains the logger so we don't need to pass the logger down separately. No functional changes in this commit, only to improve code ergonomics.

  • Praefect needs to provide a custom handshaker to use when establishing a connection to Gitaly in order to set up the multiplexed connection. This commit allows for injecting a handshaker into the Dial function to perform the custom handshake.

Related to #3262 (closed)
Depends on !3293 (merged)

Edited by Sami Hiltunen

Merge request reports

Loading