6
6
7
7
namespace nix {
8
8
9
- StorePath MixStoreDirMethods ::parseStorePath (std::string_view path) const
9
+ StorePath StoreDirConfig ::parseStorePath (std::string_view path) const
10
10
{
11
11
// On Windows, `/nix/store` is not a canonical path. More broadly it
12
12
// is unclear whether this function should be using the native
@@ -25,7 +25,7 @@ StorePath MixStoreDirMethods::parseStorePath(std::string_view path) const
25
25
return StorePath (baseNameOf (p));
26
26
}
27
27
28
- std::optional<StorePath> MixStoreDirMethods ::maybeParseStorePath (std::string_view path) const
28
+ std::optional<StorePath> StoreDirConfig ::maybeParseStorePath (std::string_view path) const
29
29
{
30
30
try {
31
31
return parseStorePath (path);
@@ -34,25 +34,25 @@ std::optional<StorePath> MixStoreDirMethods::maybeParseStorePath(std::string_vie
34
34
}
35
35
}
36
36
37
- bool MixStoreDirMethods ::isStorePath (std::string_view path) const
37
+ bool StoreDirConfig ::isStorePath (std::string_view path) const
38
38
{
39
39
return (bool ) maybeParseStorePath (path);
40
40
}
41
41
42
- StorePathSet MixStoreDirMethods ::parseStorePathSet (const PathSet & paths) const
42
+ StorePathSet StoreDirConfig ::parseStorePathSet (const PathSet & paths) const
43
43
{
44
44
StorePathSet res;
45
45
for (auto & i : paths)
46
46
res.insert (parseStorePath (i));
47
47
return res;
48
48
}
49
49
50
- std::string MixStoreDirMethods ::printStorePath (const StorePath & path) const
50
+ std::string StoreDirConfig ::printStorePath (const StorePath & path) const
51
51
{
52
52
return (storeDir + " /" ).append (path.to_string ());
53
53
}
54
54
55
- PathSet MixStoreDirMethods ::printStorePathSet (const StorePathSet & paths) const
55
+ PathSet StoreDirConfig ::printStorePathSet (const StorePathSet & paths) const
56
56
{
57
57
PathSet res;
58
58
for (auto & i : paths)
@@ -69,28 +69,28 @@ also update the user-visible behavior, please update the specification
69
69
to match.
70
70
*/
71
71
72
- StorePath MixStoreDirMethods ::makeStorePath (std::string_view type, std::string_view hash, std::string_view name) const
72
+ StorePath StoreDirConfig ::makeStorePath (std::string_view type, std::string_view hash, std::string_view name) const
73
73
{
74
74
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
75
75
auto s = std::string (type) + " :" + std::string (hash) + " :" + storeDir + " :" + std::string (name);
76
76
auto h = compressHash (hashString (HashAlgorithm::SHA256, s), 20 );
77
77
return StorePath (h, name);
78
78
}
79
79
80
- StorePath MixStoreDirMethods ::makeStorePath (std::string_view type, const Hash & hash, std::string_view name) const
80
+ StorePath StoreDirConfig ::makeStorePath (std::string_view type, const Hash & hash, std::string_view name) const
81
81
{
82
82
return makeStorePath (type, hash.to_string (HashFormat::Base16, true ), name);
83
83
}
84
84
85
- StorePath MixStoreDirMethods ::makeOutputPath (std::string_view id, const Hash & hash, std::string_view name) const
85
+ StorePath StoreDirConfig ::makeOutputPath (std::string_view id, const Hash & hash, std::string_view name) const
86
86
{
87
87
return makeStorePath (" output:" + std::string{id}, hash, outputPathName (name, id));
88
88
}
89
89
90
90
/* Stuff the references (if any) into the type. This is a bit
91
91
hacky, but we can't put them in, say, <s2> (per the grammar above)
92
92
since that would be ambiguous. */
93
- static std::string makeType (const MixStoreDirMethods & store, std::string && type, const StoreReferences & references)
93
+ static std::string makeType (const StoreDirConfig & store, std::string && type, const StoreReferences & references)
94
94
{
95
95
for (auto & i : references.others ) {
96
96
type += " :" ;
@@ -101,7 +101,7 @@ static std::string makeType(const MixStoreDirMethods & store, std::string && typ
101
101
return std::move (type);
102
102
}
103
103
104
- StorePath MixStoreDirMethods ::makeFixedOutputPath (std::string_view name, const FixedOutputInfo & info) const
104
+ StorePath StoreDirConfig ::makeFixedOutputPath (std::string_view name, const FixedOutputInfo & info) const
105
105
{
106
106
if (info.method == FileIngestionMethod::Git
107
107
&& !(info.hash .algo == HashAlgorithm::SHA1 || info.hash .algo == HashAlgorithm::SHA256)) {
@@ -126,7 +126,7 @@ StorePath MixStoreDirMethods::makeFixedOutputPath(std::string_view name, const F
126
126
}
127
127
128
128
StorePath
129
- MixStoreDirMethods ::makeFixedOutputPathFromCA (std::string_view name, const ContentAddressWithReferences & ca) const
129
+ StoreDirConfig ::makeFixedOutputPathFromCA (std::string_view name, const ContentAddressWithReferences & ca) const
130
130
{
131
131
// New template
132
132
return std::visit (
@@ -148,7 +148,7 @@ MixStoreDirMethods::makeFixedOutputPathFromCA(std::string_view name, const Conte
148
148
ca.raw );
149
149
}
150
150
151
- std::pair<StorePath, Hash> MixStoreDirMethods ::computeStorePath (
151
+ std::pair<StorePath, Hash> StoreDirConfig ::computeStorePath (
152
152
std::string_view name,
153
153
const SourcePath & path,
154
154
ContentAddressMethod method,
@@ -173,10 +173,4 @@ std::pair<StorePath, Hash> MixStoreDirMethods::computeStorePath(
173
173
};
174
174
}
175
175
176
- StoreDirConfig::StoreDirConfig (const Params & params)
177
- : StoreDirConfigBase(params)
178
- , MixStoreDirMethods{storeDir_}
179
- {
180
- }
181
-
182
176
} // namespace nix
0 commit comments