File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed
hnix-store-remote/src/System/Nix/Store Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 99 * ` BuildResult ` s ` timesBuild ` field changes type from ` Integer ` to ` Int ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1010
1111* Additions:
12+ * ` System.Nix.StorePath.storePathHashPartToText ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1213 * Added ` Generic ` and ` Show ` instances for
1314 ` Signature ` and ` NarSignature ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1415 * Added ` Eq ` and ` Ord ` instances for ` SomeNamedDigest ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ module System.Nix.Internal.StorePath
2525 , storePathToRawFilePath
2626 , storePathToText
2727 , storePathToNarInfo
28+ , storePathHashPartToText
2829 , -- * Parsing 'StorePath's
2930 parsePath
3031 , pathParser
@@ -208,7 +209,7 @@ storePathToRawFilePath :: StoreDir -> StorePath -> RawFilePath
208209storePathToRawFilePath storeDir StorePath {.. } =
209210 unStoreDir storeDir <> " /" <> hashPart <> " -" <> name
210211 where
211- hashPart = encodeUtf8 $ encodeWith NixBase32 $ coerce storePathHash
212+ hashPart = encodeUtf8 $ storePathHashPartToText storePathHash
212213 name = encodeUtf8 $ unStorePathName storePathName
213214
214215-- | Render a 'StorePath' as a 'FilePath'.
@@ -225,6 +226,12 @@ storePathToNarInfo :: StorePath -> Bytes.Char8.ByteString
225226storePathToNarInfo StorePath {.. } =
226227 encodeUtf8 $ encodeWith NixBase32 (coerce storePathHash) <> " .narinfo"
227228
229+ -- | Render a 'StorePathHashPart' as a 'Text'.
230+ -- This is used by remote store / database
231+ -- via queryPathFromHashPart
232+ storePathHashPartToText :: StorePathHashPart -> Text
233+ storePathHashPartToText = encodeWith NixBase32 . unStorePathHashPart
234+
228235-- | Parse `StorePath` from `Bytes.Char8.ByteString`, checking
229236-- that store directory matches `expectedRoot`.
230237parsePath
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ module System.Nix.StorePath
2222 , storePathToRawFilePath
2323 , storePathToText
2424 , storePathToNarInfo
25+ , storePathHashPartToText
2526 , -- * Parsing 'StorePath's
2627 parsePath
2728 , pathParser
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import Data.HashSet (HashSet)
3939import Data.Map (Map )
4040import Data.Text (Text )
4141import qualified Control.Monad
42- import qualified Data.ByteString.Lazy
4342import qualified Data.Text.Encoding
4443--
4544import qualified Data.ByteString.Lazy as BSL
@@ -61,7 +60,6 @@ import System.Nix.StorePath ( StorePath
6160import System.Nix.StorePathMetadata ( Metadata (.. )
6261 , StorePathTrust (.. )
6362 )
64- import System.Nix.Internal.Base ( encodeWith )
6563
6664import qualified Data.Binary.Put
6765import qualified Data.Map.Strict
@@ -295,12 +293,8 @@ queryDerivationOutputNames p = do
295293queryPathFromHashPart :: StorePathHashPart -> MonadStore StorePath
296294queryPathFromHashPart storePathHash = do
297295 runOpArgs QueryPathFromHashPart
298- $ putByteStringLen
299- $ Data.ByteString.Lazy. fromStrict
300- $ Data.Text.Encoding. encodeUtf8
301- $ encodeWith NixBase32
302- $ System.Nix.StorePath. unStorePathHashPart
303- storePathHash
296+ $ putText
297+ $ System.Nix.StorePath. storePathHashPartToText storePathHash
304298 sockGetPath
305299
306300queryMissing
You can’t perform that action at this time.
0 commit comments