Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
store-dir-config.hh
1
#pragma once
2
3
#include "
nix/store/path.hh
"
4
#include "
nix/util/canon-path.hh
"
5
#include "
nix/util/hash.hh
"
6
#include "
nix/store/content-address.hh
"
7
#include "
nix/util/configuration.hh
"
8
9
#include <map>
10
#include <string>
11
#include <variant>
12
13
namespace
nix {
14
15
struct
SourcePath
;
16
28
struct
StoreDirConfig
29
{
30
const
std::string & storeDir;
31
32
// pure methods
33
34
StorePath
parseStorePath(std::string_view path)
const
;
35
43
StorePath
parseStorePathCanonical
(std::string_view path)
const
;
44
45
std::optional<StorePath> maybeParseStorePath(std::string_view path)
const
;
46
47
std::string printStorePath(
const
StorePath
& path)
const
;
48
49
StringSet
printStorePathSet(
const
StorePathSet & path)
const
;
50
51
std::size_t maxCanonicalStorePathLen()
const
noexcept
52
{
53
/* storeDir itself must be canonical + "/" + StorePath basename. */
54
return
storeDir.size() + 1 +
StorePath::MaxBasenameLen
;
55
}
56
65
bool
isInStore
(std::string_view path)
const
;
66
71
bool
isStorePath
(std::string_view path)
const
;
72
77
std::pair<StorePath, CanonPath>
toStorePath
(std::string_view path)
const
;
78
82
StorePath
makeStorePath
(std::string_view type, std::string_view hash, std::string_view name)
const
;
83
StorePath
makeStorePath
(std::string_view type,
const
Hash
& hash, std::string_view name)
const
;
84
85
StorePath
makeOutputPath(std::string_view
id
,
const
Hash
& hash, std::string_view name)
const
;
86
87
StorePath
makeFixedOutputPath(std::string_view name,
const
FixedOutputInfo
& info)
const
;
88
89
StorePath
makeFixedOutputPathFromCA(std::string_view name,
const
ContentAddressWithReferences
& ca)
const
;
90
95
std::pair<StorePath, Hash>
computeStorePath
(
96
std::string_view name,
97
const
SourcePath
& path,
98
ContentAddressMethod
method =
ContentAddressMethod::Raw::NixArchive
,
99
HashAlgorithm hashAlgo = HashAlgorithm::SHA256,
100
const
StorePathSet & references = {},
101
PathFilter
& filter = defaultPathFilter)
const
;
102
};
103
104
}
// namespace nix
canon-path.hh
nix::StorePath
Definition
path.hh:33
nix::StorePath::MaxBasenameLen
static constexpr size_t MaxBasenameLen
Maximum length of the basename admitted by the constructor from a string.
Definition
path.hh:53
configuration.hh
content-address.hh
nix::PathFilter
fun< bool(const std::string &path)> PathFilter
Definition
file-system.hh:494
path.hh
hash.hh
nix::ContentAddressMethod
Definition
content-address.hh:32
nix::ContentAddressMethod::Raw::NixArchive
@ NixArchive
Definition
content-address.hh:51
nix::ContentAddressWithReferences
Definition
content-address.hh:284
nix::FixedOutputInfo
Definition
content-address.hh:257
nix::Hash
Definition
hash.hh:58
nix::SourcePath
Definition
source-path.hh:22
nix::StoreDirConfig
Definition
store-dir-config.hh:29
nix::StoreDirConfig::isInStore
bool isInStore(std::string_view path) const
Definition
store-api.cc:133
nix::StoreDirConfig::parseStorePathCanonical
StorePath parseStorePathCanonical(std::string_view path) const
Definition
store-dir-config.cc:34
nix::StoreDirConfig::makeStorePath
StorePath makeStorePath(std::string_view type, std::string_view hash, std::string_view name) const
Definition
store-dir-config.cc:85
nix::StoreDirConfig::computeStorePath
std::pair< StorePath, Hash > computeStorePath(std::string_view name, const SourcePath &path, ContentAddressMethod method=ContentAddressMethod::Raw::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references={}, PathFilter &filter=defaultPathFilter) const
Definition
store-dir-config.cc:164
nix::StoreDirConfig::toStorePath
std::pair< StorePath, CanonPath > toStorePath(std::string_view path) const
Definition
store-api.cc:138
nix::StoreDirConfig::isStorePath
bool isStorePath(std::string_view path) const
Definition
store-dir-config.cc:58
nix::StringSet
std::set< std::string, std::less<> > StringSet
Definition
types.hh:45
libstore
include
nix
store
store-dir-config.hh
Generated by
1.18.0