Indeed, this would be like if squid could predict the endpoints and pre-warm the cache. With this you could run it on your laptop with opam.ocaml.org or opam.robur.coop as the upstream at home,…
I used sectors because I didn't want to deal with rounding and potential overflow. I think with realistic disk sizes we don't have to worry about overflow thankfully.
Thanks. To be honest I think a single Lwt.pause ()
should be sufficient since we process at most 4096 bytes at a time. But this should work just fine!
Latest commit splits mirror URLs from upstream cache URLs so the mirror URLs are tried first before the upstream caches, and adds a longer description of the option.
Hm it turns out the exact semantics is a bit complicated to explain. You are right that we first to go the source! Then we go to the mirrors or the cache depending on how the URLs sort as they…
I don't think the order is significant, but it's worth noting we reverse the order here.
The opam source code does url :: mirrors
FWIW. Just an observation; not a request for change.
"Upstream caches to use internally (e.g. https://opam.ocaml.org/cache). This makes opam-mirror try the cache(s) before going to the source and mirrors. This does not change the published "archive-mirrors:" value in the /repo endpoint."
Maybe worth using HM.fold
This looks interesting. I will do a closer review later.