refactor: expand pool and connection implementation #7224
Merged
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.
This PR includes much of the rewiring of the existing ManagedStream abstraction, but doesn't cut over to the new implemention yet.
We add a reference to the origin writer as part of the
pendingWrite
which retains information about a single write request and response. This allows us to resolve retry settings for a given write by checking if the writer has a custom retry policy. In other cases, we use the default settings of the connection pool.We introduce internal UUID identifiers to the core abstractions (pool, connection, writer) so that we can add observability later to see which components are responsible for processing requests.
We remove the notion of adding connections to the connectionpool contract. Instead, we introduce a new interface in the pool called a
poolRouter
. By interface contract, it's responsible for picking the correct connection for a given write. However, this allows us to abstract away different implementations for pool behavior and make it the responsibility of an individual router.Further, this PR adds the most simplistic router we'll use for the initial migration to multiplexing (
simpleRouter
): it supports a single connection, and routes all traffic to it.This PR also moves over more internal functionality from the ManagedStream, namely
appendWithRetry()
andlockingAppend()
. The implementations still remain on the ManagedStream implementation at this time, we'll remove most of the functionality when we cut over to using pools/connections.Towards: #7103