Skip to content

Commit e534a85

Browse files
committed
remote: drop old path utils
1 parent aa58adb commit e534a85

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ querySubstitutablePathInfos ps = do
108108
cnt <- sockGetInt
109109
forM (take cnt $ cycle [(0 :: Int)]) $ pure $ do
110110
_pth <- sockGetPath
111-
drv <- sockGetStr
111+
drv <- sockGetPath
112112
refs <- sockGetPaths
113113
dlSize <- sockGetInt
114114
narSize' <- sockGetInt
115115
return $ SubstitutablePathInfo {
116-
deriver = mkPath drv
116+
deriver = drv
117117
, references = refs
118118
, downloadSize = dlSize
119119
, narSize = narSize'
@@ -128,7 +128,7 @@ queryPathInfoUncached path = do
128128
valid <- sockGetBool
129129
unless valid $ error "Path is not valid"
130130

131-
deriver <- mkPath <$> sockGetStr
131+
deriver <- sockGetPath
132132
narHash <- lBSToText <$> sockGetStr
133133
references <- sockGetPaths
134134
registrationTime <- sockGet getTime

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,12 @@ putText = putByteStringLen . textToLBS
9595
putTexts :: [Text] -> Put
9696
putTexts = putByteStrings . (map textToLBS)
9797

98-
mkPath :: LBS.ByteString -> Maybe Path
99-
mkPath p = case (pathName $ lBSToText p) of
100-
Just x -> Just $ Path (Hash.hash $ LBS.toStrict p) x
101-
Nothing -> Nothing
102-
103-
mkPathText :: T.Text -> Maybe Path
104-
mkPathText p = case pathName p of
105-
Just x -> Just $ Path (Hash.hash $ BSC.pack $ T.unpack p) x
106-
Nothing -> Nothing
107-
10898
getPath :: Get (Maybe Path)
10999
getPath = parsePath <$> getByteStringLen
110100

111101
getPaths :: Get PathSet
112102
getPaths = HashSet.fromList . catMaybes . map parsePath <$> getByteStrings
113103

114-
{-
115-
putPath :: Path -> Put
116-
putPath (Path _digest name) = putText $ pathNameContents name
117-
118-
putPaths :: PathSet -> Put
119-
putPaths = putByteStrings . HashSet.map (\(Path _digest name) -> textToLBS $ pathNameContents name)
120-
-}
121104
putPath :: StoreDir -> Path -> Put
122105
putPath sd = putText . storedToText . makeStored sd
123106

hnix-store-remote/tests/NixDaemon.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ withPath action = do
142142
(Just path) <- addTextToStore "hnix-store" "test" (HS.fromList []) False
143143
action path
144144

145+
invalidPath = Path (hash "invalid") $ fromJust $ pathName "invalid"
145146
{-
146147
- broken
147148
@@ -233,7 +234,7 @@ spec_protocol = Hspec.around withNixDaemon $ do
233234
context "isValidPathUncached" $ do
234235
itRights "validates path" $ withPath $ \path -> do
235236
(isValidPathUncached path) `shouldReturn` True
236-
itLefts "fails on invalid path" $ isValidPathUncached $ fromJust $ mkPath "nopez"
237+
itLefts "fails on invalid path" $ isValidPathUncached $ invalidPath
237238

238239
context "queryAllValidPaths" $ do
239240
itRights "empty query" $ queryAllValidPaths

0 commit comments

Comments
 (0)