Conversation
|
cc @nsidnev & @scotttrinh |
scotttrinh
left a comment
There was a problem hiding this comment.
Everything looks sensible to me, but I mostly skimmed the implementation itself, so feel free to point out anything you think might want some closer inspection and I'll take another pass.
| @Override | ||
| public HttpResponse.BodySubscriber<List<Receivable>> apply(HttpResponse.ResponseInfo responseInfo) { | ||
| // ensure success | ||
| var isSuccess = responseInfo.statusCode() / 100 == 2; |
There was a problem hiding this comment.
Not sure how this works in the HTTP client we're using here, but would a 3XX response also be considered a success? Or does redirection happen implicitly by the client and you end up with 2XX/4XX/5XX?
There was a problem hiding this comment.
I believe redirection happens implicitly, although should we even support/handle redirects though in bindings @1st1?
should it instead be a separate type, like |
The way this binding is written internally mimics the abstraction of the .NET binding, essentially I'm not opposed to changing it to a new class, it would just require writing more abstractions for pooling |
Yeah, it seems like that's the main difference between the two clients in the JS driver: https://github.com/edgedb/edgedb-js/blob/master/packages/driver/src/nodeClient.ts I defer to what feels idiomatic. If they both seem fine, then yeah maybe alignment across the clients is something we should strive for. |
|
I think the main difference with the approaches is for .NET and java we don't use global methods ( In js, adding a new method for creating a http client makes sense because you're returning the same client type in the function, but with the constructor approach this would most likely make integration in previous code (and future code for client-agnostic APIs) a bit more difficult. I think this was the consensus reached with .NET and why it acts similar to this. |
This PR implements an HTTP binary client
API surface changes
HTTP:getClientTypemethod toEdgeDBClientFixes
ReadyForCommandwouldn't be consumed in the failed parse case.Overview
A new duplexer called
HttpDuplexerwas introduced which provides the duplex implementation for HTTP via a promise queue. On top of this, a new client class,EdgeDBHttpClient, was added which extends theEdgeDBBinaryclient to support the binary protocol over HTTP by proxying the duplexer to the protocol code.One implementation note: Java being java doesn't auto implement DNS name resolving for matching URI hosts to the certificates (see this stack overflow post which is related) so using
127.0.0.1as a hostname for HTTP clients will not work. To fix this, the defaulthostnameinEdgeDBConnectionwas changed from127.0.0.1tolocalhostto match certificates, this should not effect other behavior of the client.