mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-09-21 08:58:04 +03:00
28 lines
621 B
C++
28 lines
621 B
C++
![]() |
#include "file-hash.hh"
|
||
|
|
||
|
namespace nix {
|
||
|
|
||
|
std::string FileSystemHash::printMethodAlgo() const {
|
||
|
return makeFileIngestionPrefix(method) + printHashType(hash.type);
|
||
|
}
|
||
|
|
||
|
std::string makeFileIngestionPrefix(const FileIngestionMethod m) {
|
||
|
switch (m) {
|
||
|
case FileIngestionMethod::Flat:
|
||
|
return "";
|
||
|
case FileIngestionMethod::Recursive:
|
||
|
return "r:";
|
||
|
default:
|
||
|
throw Error("impossible, caught both cases");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
std::string makeFixedOutputCA(FileIngestionMethod method, const Hash & hash)
|
||
|
{
|
||
|
return "fixed:"
|
||
|
+ makeFileIngestionPrefix(method)
|
||
|
+ hash.to_string();
|
||
|
}
|
||
|
|
||
|
}
|