[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] Irmin_http with Cohttp_mirage
Sven Anderson <sven@xxxxxxxxxxx> schrieb am Fr., 24. Nov. 2017 um 20:12 Uhr: TL;DR: Irmin_http.KV(Cohttp_mirage.Client)(Irmin.Contents.String) doesn’t work, because the default context uses an empty conduit without TCP support. How to do it right? In the meantime I managed to get Irmin_http work together with Cohttp_mirage.Client. However, I wonder if it is the right way to do it, and would like to hear comments about it. Since I figured that I need runtime values for the Cohttp_mirage.Client, because the conduit and dns resolver come in as arguments of the start function, I saw no other way than to instantiate the modules in the code path, and I'm not sure if this is an anti-pattern. Also, because I saw no way to replace the default context of the conduit, I "monkey-patched" the module, by defining a new module that includes Cohttp_mirage.Client and overwrites the call function (which is the only one that Irmin_http seems to use) that brings its own context. It looks now something like this: let start _clock data certs http res_dns con = let module Client = struct include Cohttp_mirage.Client let call ?ctx:_ctx = call ~ctx:(ctx res_dns con) end in let module Storage = Irmin_http.KV(Client)(Irmin.Contents.String) in [...] Is this acceptable code? Is it possible to solve it with globally defined modules? Is there a nicer way to set the client context, if the http functions are called in 3rd party code (Irmin_http) without setting a context? I also found a weird problem, that I will address in another email. Cheers, Sven _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |