Conversation
|
I'm curious what the status and merge plan of this PR is. It could as well be part of a separate git repository if the httpaf maintainers do not want to maintain the mirage adapter. what do you think? |
|
Haven't had time to look at this too closely, as I'm prioritizing bug fixes at the moment. However, this like the lwt runtime, is a copy paste job. Eventually, having a bunch of different copies of the same code is going to become a nightmare to maintain and isn't going to make it easy to share fixes. Async's different enough that the split there is justified. But for the lwt-based runtimes, if possible, the implementations should just be functorized, or otherwise parameterized. |
|
I'm at the Mirage retreat this week and I can have a look into finding an abstraction to share code between the Lwt and Mirage runtimes. |
|
Looks good! |
|
Summary of recent changes:
Most of the Lwt runtime code can now be shared, and there's only one implementation of the I/O loops. |
|
I will look tomorrow about this PR, the question between compatibility between But thanks for your fast as f**k replies 👍 ! Today is Sunday! |
dinosaure
left a comment
There was a problem hiding this comment.
From what I know about the Mirage side, this PR seems ok anyway. Great work @anmonteiro 👍.
|
The unix-independent Lwt part of this would be very useful to have in httpaf, but I recommend putting the Mirage piece of this PR into a separate repository under the mirage/ org and not to include it in the httpaf repository. We'll likely need to iterate on the example unikernel and interfaces from the Mirage end more quickly as we head towards a Mirage4 release, but the httpaf-lwt portion is unlikely to need too many changes. |
the Lwt runtimes make httpaf-mirage use httpaf-lwt, and introduce httpaf-lwt-unix package that also uses httpaf-lwt
Provide a default for the conduit_direct stack, otherwise different stacks have different flows and need to be able to construct clients and servers with their respective flows.
|
Hmmhmm, with your last commit, I did not know exactly where it comes but it's not so easy to make an HTTP server: let start console clock conduit http =
let server = Httpaf_mirage.Server_with_conduit.create_connection_handler
~request_handler
~error_handler
~config:Httpaf.Config.default in
http (`TCP 4242) serverif I remove the optional val create_connection_handler : request_handler:_ -> error_handler:_ -> ?config:Config.t -> (flow -> unit Lwt.t)OCaml consider it as: val create_connection_handler : request_handler:_ -> error_handler:_ -> ?config:Config.t -> flow -> unit Lwt.tAnd |
Turns out all the pieces were already in place (thanks to bigstringaf) and someone just needed to hack a Mirage adapter together.
There's a video demo at https://twitter.com/_anmonteiro/status/1074710486279692288