akamai / hface

Hackable HTTP/{1,2,3} {client,server,proxy}
https://hface.readthedocs.io
Apache License 2.0
30 stars 3 forks source link

Document API of transport classes #8

Open mila opened 1 year ago

mila commented 1 year ago

In the hface.connections module, we have a Transport interface implemented by TCPTransport and UDPTransport. These classes combine sans-IO protocols with sockets for IO. These classes are currently not part of the public API because I am not sure about their design. Users have only the Connection class available. This class uses transports internally.

Consider whether we need separate classes for connections and transports and what their interface should be. Once the interface is decided, document it.

mila commented 1 year ago

Having one Connection class (not interface) with undocumented transports used constructor means users of hface cannot replace the lowest protocol layer. In an idea case, it should be possible to provide own Connection (or Transport) implementations that would replace both the sans-IO protocol and AnyIO socket handling.

mila commented 1 year ago

One design detail I am not sure about: Connection references Transport, which references HTTPProtocol. That alone would be OK, but Connection sometimes calls Transport methods and sometime accesses directly HTTPProtocol.