![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include "nix/util/source-accessor.hh"Go to the source code of this file.
Enumerations | |
| enum struct | nix::FileSerialisationMethod : uint8_t { Flat , NixArchive } |
| enum struct | nix::FileIngestionMethod : uint8_t { Flat , NixArchive , Git } |
Functions | |
| FileSerialisationMethod | nix::parseFileSerialisationMethod (std::string_view input) |
| std::string_view | nix::renderFileSerialisationMethod (FileSerialisationMethod method) |
| void | nix::dumpPath (const SourcePath &path, Sink &sink, FileSerialisationMethod method, PathFilter &filter) |
| void | nix::restorePath (const std::filesystem::path &path, Source &source, FileSerialisationMethod method, bool startFsync, RestoreSinkHooks *hooks) |
| HashResult | nix::hashPath (const SourcePath &path, FileSerialisationMethod method, HashAlgorithm ha, PathFilter &filter) |
| FileIngestionMethod | nix::parseFileIngestionMethod (std::string_view input) |
| std::string_view | nix::renderFileIngestionMethod (FileIngestionMethod method) |
| std::pair< Hash, std::optional< uint64_t > > | nix::hashPath (const SourcePath &path, FileIngestionMethod method, HashAlgorithm ht, PathFilter &filter) |
|
strong |
An enumeration of the ways we can ingest file system objects, producing a hash or digest.
See file-system-object/content-address.md in the manual for a user-facing description of this concept.
| Enumerator | |
|---|---|
| Flat | Hash FileSerialisationMethod::Flat serialisation. See file-system-object/content-address.md#serial-flat in the manual. |
| NixArchive | Hash FileSerialisationMethod::NixArchive serialisation. See file-system-object/content-address.md#serial-flat in the manual. |
| Git | Git hashing. Part of ExperimentalFeature::GitHashing. See file-system-object/content-address.md#serial-git in the manual. |
|
strong |
An enumeration of the ways we can serialize file system objects.
See file-system-object/content-address.md#serial in the manual for a user-facing description of this concept, but note that this type is also used for storing or sending copies; not just for addressing. Note also that there are other content addressing methods that don't correspond to a serialisation method.
| void nix::dumpPath | ( | const SourcePath & | path, |
| Sink & | sink, | ||
| FileSerialisationMethod | method, | ||
| PathFilter & | filter = defaultPathFilter ) |
Dump a serialization of the given file system object.
| std::pair< Hash, std::optional< uint64_t > > nix::hashPath | ( | const SourcePath & | path, |
| FileIngestionMethod | method, | ||
| HashAlgorithm | ha, | ||
| PathFilter & | filter = defaultPathFilter ) |
Compute the hash of the given file system object according to the given method, and for some ingestion methods, the size of the serialisation.
Unlike the other hashPath, this works on an arbitrary FileIngestionMethod instead of FileSerialisationMethod, but may not return the size as this is this is not a both simple and useful defined for a merkle format.
| HashResult nix::hashPath | ( | const SourcePath & | path, |
| FileSerialisationMethod | method, | ||
| HashAlgorithm | ha, | ||
| PathFilter & | filter = defaultPathFilter ) |
Compute the hash of the given file system object according to the given method.
the hash is defined as (in pseudocode):
| FileIngestionMethod nix::parseFileIngestionMethod | ( | std::string_view | input | ) |
Parse a FileIngestionMethod by name. Choice of:
Opposite of renderFileIngestionMethod.
| FileSerialisationMethod nix::parseFileSerialisationMethod | ( | std::string_view | input | ) |
Parse a FileSerialisationMethod by name. Choice of:
Opposite of renderFileSerialisationMethod.
| std::string_view nix::renderFileIngestionMethod | ( | FileIngestionMethod | method | ) |
Render a FileIngestionMethod by name.
Opposite of parseFileIngestionMethod.
| std::string_view nix::renderFileSerialisationMethod | ( | FileSerialisationMethod | method | ) |
Render a FileSerialisationMethod by name.
Opposite of parseFileSerialisationMethod.
| void nix::restorePath | ( | const std::filesystem::path & | path, |
| Source & | source, | ||
| FileSerialisationMethod | method, | ||
| bool | startFsync = false, | ||
| RestoreSinkHooks * | hooks = nullptr ) |
Restore a serialisation of the given file system object.