Skip to content

Commit fe33fba

Browse files
committed
Drop StorePathSet type alias
1 parent 6f21bb3 commit fe33fba

File tree

6 files changed

+25
-32
lines changed

6 files changed

+25
-32
lines changed

hnix-store-core/src/System/Nix/Internal/StorePath.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module System.Nix.Internal.StorePath
1313
StoreDir(..)
1414
, StorePath(..)
1515
, StorePathName(..)
16-
, StorePathSet
1716
, StorePathHashPart(..)
1817
, mkStorePathHashPart
1918
, ContentAddressableAddress(..)
@@ -97,9 +96,6 @@ mkStorePathHashPart
9796
-> StorePathHashPart
9897
mkStorePathHashPart = coerce . mkStorePathHash @hashAlgo
9998

100-
-- | A set of 'StorePath's.
101-
type StorePathSet = HashSet StorePath
102-
10399
-- | An address for a content-addressable store path, i.e. one whose
104100
-- store path hash is purely a function of its contents (as opposed to
105101
-- paths that are derivation outputs, whose hashes are a function of

hnix-store-core/src/System/Nix/ReadonlyStore.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ makeStorePath storeDir ty h nm = StorePath storeHash nm
4242
]
4343

4444
makeTextPath
45-
:: StoreDir -> StorePathName -> Digest SHA256 -> StorePathSet -> StorePath
45+
:: StoreDir -> StorePathName -> Digest SHA256 -> HashSet StorePath -> StorePath
4646
makeTextPath storeDir nm h refs = makeStorePath storeDir ty h nm
4747
where
4848
ty =
@@ -70,7 +70,7 @@ makeFixedOutputPath storeDir recursive h =
7070
<> ":"
7171

7272
computeStorePathForText
73-
:: StoreDir -> StorePathName -> ByteString -> (StorePathSet -> StorePath)
73+
:: StoreDir -> StorePathName -> ByteString -> (HashSet StorePath -> StorePath)
7474
computeStorePathForText storeDir nm = makeTextPath storeDir nm . hash
7575

7676
computeStorePathForPath

hnix-store-core/src/System/Nix/StorePath.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module System.Nix.StorePath
66
StoreDir(..)
77
, StorePath(..)
88
, StorePathName
9-
, StorePathSet
109
, StorePathHashPart
1110
, mkStorePathHashPart
1211
, unStorePathHashPart

hnix-store-core/src/System/Nix/StorePathMetadata.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Description : Metadata about Nix store paths.
44
module System.Nix.StorePathMetadata where
55

66
import System.Nix.StorePath ( StorePath
7-
, StorePathSet
87
, ContentAddressableAddress
98
)
109
import System.Nix.Hash ( SomeNamedDigest )
@@ -22,7 +21,7 @@ data StorePathMetadata = StorePathMetadata
2221
-- | The hash of the nar serialization of the path.
2322
narHash :: !SomeNamedDigest
2423
, -- | The paths that this path directly references
25-
references :: !StorePathSet
24+
references :: !(HashSet StorePath)
2625
, -- | When was this path registered valid in the store?
2726
registrationTime :: !UTCTime
2827
, -- | The size of the nar serialization of the path, in bytes.

hnix-store-remote/src/System/Nix/Store/Remote.hs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import System.Nix.Hash ( NamedAlgo(..)
4949
)
5050
import System.Nix.StorePath ( StorePath
5151
, StorePathName
52-
, StorePathSet
5352
, StorePathHashPart
5453
)
5554
import System.Nix.StorePathMetadata ( StorePathMetadata(..)
@@ -99,10 +98,10 @@ addToStore name source recursive repair = do
9998
-- Reference accepts repair but only uses it
10099
-- to throw error in case of remote talking to nix-daemon.
101100
addTextToStore
102-
:: Text -- ^ Name of the text
103-
-> Text -- ^ Actual text to add
104-
-> StorePathSet -- ^ Set of `StorePath`s that the added text references
105-
-> RepairFlag -- ^ Repair flag, must be `False` in case of remote backend
101+
:: Text -- ^ Name of the text
102+
-> Text -- ^ Actual text to add
103+
-> HashSet StorePath -- ^ Set of `StorePath`s that the added text references
104+
-> RepairFlag -- ^ Repair flag, must be `False` in case of remote backend
106105
-> MonadStore StorePath
107106
addTextToStore name text references' repair = do
108107
when (unRepairFlag repair)
@@ -138,7 +137,7 @@ addTempRoot pn = do
138137
-- | Build paths if they are an actual derivations.
139138
--
140139
-- If derivation output paths are already valid, do nothing.
141-
buildPaths :: StorePathSet -> BuildMode -> MonadStore ()
140+
buildPaths :: HashSet StorePath -> BuildMode -> MonadStore ()
142141
buildPaths ps bm = do
143142
storeDir <- getStoreDir
144143
void $ simpleOpArgs BuildPaths $ do
@@ -198,22 +197,22 @@ isValidPathUncached p = do
198197

199198
-- | Query valid paths from set, optionally try to use substitutes.
200199
queryValidPaths
201-
:: StorePathSet -- ^ Set of `StorePath`s to query
200+
:: HashSet StorePath -- ^ Set of `StorePath`s to query
202201
-> SubstituteFlag -- ^ Try substituting missing paths when `True`
203-
-> MonadStore StorePathSet
202+
-> MonadStore (HashSet StorePath)
204203
queryValidPaths ps substitute = do
205204
storeDir <- getStoreDir
206205
runOpArgs QueryValidPaths $ do
207206
putPaths storeDir ps
208207
putBool (unSubstituteFlag substitute)
209208
sockGetPaths
210209

211-
queryAllValidPaths :: MonadStore StorePathSet
210+
queryAllValidPaths :: MonadStore (HashSet StorePath)
212211
queryAllValidPaths = do
213212
runOp QueryAllValidPaths
214213
sockGetPaths
215214

216-
querySubstitutablePaths :: StorePathSet -> MonadStore StorePathSet
215+
querySubstitutablePaths :: HashSet StorePath -> MonadStore (HashSet StorePath)
217216
querySubstitutablePaths ps = do
218217
storeDir <- getStoreDir
219218
runOpArgs QuerySubstitutablePaths $ putPaths storeDir ps
@@ -262,25 +261,25 @@ queryPathInfoUncached path = do
262261

263262
pure $ StorePathMetadata{..}
264263

265-
queryReferrers :: StorePath -> MonadStore StorePathSet
264+
queryReferrers :: StorePath -> MonadStore (HashSet StorePath)
266265
queryReferrers p = do
267266
storeDir <- getStoreDir
268267
runOpArgs QueryReferrers $ putPath storeDir p
269268
sockGetPaths
270269

271-
queryValidDerivers :: StorePath -> MonadStore StorePathSet
270+
queryValidDerivers :: StorePath -> MonadStore (HashSet StorePath)
272271
queryValidDerivers p = do
273272
storeDir <- getStoreDir
274273
runOpArgs QueryValidDerivers $ putPath storeDir p
275274
sockGetPaths
276275

277-
queryDerivationOutputs :: StorePath -> MonadStore StorePathSet
276+
queryDerivationOutputs :: StorePath -> MonadStore (HashSet StorePath)
278277
queryDerivationOutputs p = do
279278
storeDir <- getStoreDir
280279
runOpArgs QueryDerivationOutputs $ putPath storeDir p
281280
sockGetPaths
282281

283-
queryDerivationOutputNames :: StorePath -> MonadStore StorePathSet
282+
queryDerivationOutputNames :: StorePath -> MonadStore (HashSet StorePath)
284283
queryDerivationOutputNames p = do
285284
storeDir <- getStoreDir
286285
runOpArgs QueryDerivationOutputNames $ putPath storeDir p
@@ -297,13 +296,13 @@ queryPathFromHashPart storePathHash = do
297296
sockGetPath
298297

299298
queryMissing
300-
:: StorePathSet
299+
:: (HashSet StorePath)
301300
-> MonadStore
302-
( StorePathSet-- Paths that will be built
303-
, StorePathSet -- Paths that have substitutes
304-
, StorePathSet -- Unknown paths
305-
, Integer -- Download size
306-
, Integer -- Nar size?
301+
( HashSet StorePath -- Paths that will be built
302+
, HashSet StorePath -- Paths that have substitutes
303+
, HashSet StorePath -- Unknown paths
304+
, Integer -- Download size
305+
, Integer -- Nar size?
307306
)
308307
queryMissing ps = do
309308
storeDir <- getStoreDir

hnix-store-remote/src/System/Nix/Store/Remote/Util.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ sockGetPathMay = do
8383
Just
8484
pth
8585

86-
sockGetPaths :: MonadStore StorePathSet
86+
sockGetPaths :: MonadStore (HashSet StorePath)
8787
sockGetPaths = do
8888
sd <- getStoreDir
8989
getSocketIncremental (getPaths sd)
@@ -109,14 +109,14 @@ putTexts = putByteStrings . fmap textToBSL
109109
getPath :: StoreDir -> Get (Either String StorePath)
110110
getPath sd = parsePath sd <$> getByteStringLen
111111

112-
getPaths :: StoreDir -> Get StorePathSet
112+
getPaths :: StoreDir -> Get (HashSet StorePath)
113113
getPaths sd =
114114
Data.HashSet.fromList . rights . fmap (parsePath sd) <$> getByteStrings
115115

116116
putPath :: StoreDir -> StorePath -> Put
117117
putPath storeDir = putByteStringLen . fromStrict . storePathToRawFilePath storeDir
118118

119-
putPaths :: StoreDir -> StorePathSet -> Put
119+
putPaths :: StoreDir -> HashSet StorePath -> Put
120120
putPaths storeDir = putByteStrings . Data.HashSet.toList . Data.HashSet.map
121121
(fromStrict . storePathToRawFilePath storeDir)
122122

0 commit comments

Comments
 (0)