1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 03:23:16 +02:00

Proper parse and render functions for FileIngestionMethod and ContentAddressMethod

No outward facing behavior is changed.

Older methods with same names that operate on on method + algo pair (for
old-style `<method>:algo`) are renamed to `*WithAlgo`.)

The functions are unit-tested in the same way the names for the hash
algorithms are tested.
This commit is contained in:
John Ericson 2024-02-13 09:54:07 -05:00
parent fb5a438dca
commit 41dd9857c7
10 changed files with 162 additions and 30 deletions

View file

@ -23,6 +23,23 @@ enum struct FileIngestionMethod : uint8_t {
Recursive = 1,
};
/**
* Parse a `FileIngestionMethod` by name. Choice of:
*
* - `flat`: `FileIngestionMethod::Flat`
* - `nar`: `FileIngestionMethod::Recursive`
*
* Oppostite of `renderFileIngestionMethod`.
*/
FileIngestionMethod parseFileIngestionMethod(std::string_view input);
/**
* Render a `FileIngestionMethod` by name.
*
* Oppostite of `parseFileIngestionMethod`.
*/
std::string_view renderFileIngestionMethod(FileIngestionMethod method);
/**
* Dump a serialization of the given file system object.
*/