Open jamesmunns opened 2 weeks ago
Right now yes, the usage is that we obtain the SocketAddr
and then map to an HttpPeer
. Because we want to keep LoadBalancer
relatively generic, we probably want to be able to return optional metadata along with the SocketAddr
instead of having the balancer return peers.
@drcaramelsyrup that makes sense! River could probably assume the metadata should always be there (or ignore HTTP peers without metadata), which would leave the door open for that.
Open to either having "optional" methods, like .get_metadata() -> Option<PeerMetadata>
, or having a separate "with metadata" trait which we could bound on for our purposes (so we don't need to do that extra option check).
Let me know if you have any API proposals or have a branch with an API for me to try out, I can hack on it and report back, or open a PR that matches the API you propose.
Do you mean including optional metadata in the Backend
? I think that might be the easiest way to go, you may want some of that metadata to affect the Backend
hash as well. If you have bandwidth to try that out, happy to look at a PR.
Now that I've got #275 figured out, I'll look into this as an alternative to doing a two-stage lookup.
What is the problem your feature solves, or the need it fulfills?
The examples of
LoadBalancer
are oriented aroundSocketAddr
s, e.g. addr+ports. This includes the constructor ofLoadBalancer
, as well as the interfaces ofBackends
.However, when using
LoadBalancer
as a part of aProxyHttp
implementation, the Service is expected to provide anHttpPeer
, which includes additional information, such as TLS+SNI information.Is the recommended usage of
LoadBalancer
to obtain the socketaddr from the selection process, then do a second mapping ofSocketAddr
toHttpPeer
s?Describe the solution you'd like
I'm guessing the intent here is to support both TCP and HTTP load balancing, though I'm unsure what the intended use was for this.
I'm going to start looking into this, but wanted to raise it in case I'm just looking at it incorrectly.
Additional context
CC https://github.com/memorysafety/river/issues/39