Make libfetchers Input
an interface with virtual methods.
#9578
Labels
fetching
Networking with the outside (non-Nix) world, input locking
Is your feature request related to a problem? Please describe.
The way libfetchers currently works is by making changes to an
Input
object, which is a mutable attrset-like map.This makes the behavior of each fetcher somewhat harder to understand, because there's no overview of the states an
Input
can be in.Describe the solution you'd like
By modeling the state of the input with actual C++ types, we - by default - canonicalize the state; reduce the entropy; making a function like
fetchTree
behave more predictably.Step 1. Change
Input
type usages.s/Input/InputRef
; and e.g.typedef ref<Input> InputRef;
Step 2. Move methods from
InputScheme
toInput
as appropriate. Default implementations are provided that still refer toInputScheme
, butInputScheme
itself is not considered to be the public interface for the method anymore.Step 3a. Subclass
Input
so that individual fetchers implement the new architectureStep 3b. Make individual methods more functional.
Describe alternatives you've considered
Make
Input
a state machine, and put virtual methods on an object contained in it. Changes less code, but I would prefer to also move the library to a more functional style.Additional context
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: