mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-12-02 09:13:12 +03:00
remote: align GC(Options|Result) record field naming
This commit is contained in:
parent
77fe9f9acd
commit
c841f93b69
@ -234,9 +234,9 @@ deleteSpecific paths = do
|
||||
putInt (0::Int)
|
||||
putInt (0::Int)
|
||||
getSocketIncremental $ do
|
||||
gcResult_deletedPaths <- getPathsOrFail storeDir
|
||||
gcResult_bytesFreed <- getInt
|
||||
-- TODO: who knows
|
||||
gcResultDeletedPaths <- getPathsOrFail storeDir
|
||||
gcResultBytesFreed <- getInt
|
||||
-- TODO: obsolete
|
||||
_ :: Int <- getInt
|
||||
pure GCResult{..}
|
||||
|
||||
|
@ -1101,10 +1101,10 @@ storeRequest = Serializer
|
||||
pure $ Some (BuildDerivation path drv buildMode')
|
||||
|
||||
WorkerOp_CollectGarbage -> mapGetE $ do
|
||||
gcOptions_operation <- getS enum
|
||||
gcOptions_pathsToDelete <- getS (hashSet storePath)
|
||||
gcOptions_ignoreLiveness <- getS bool
|
||||
gcOptions_maxFreed <- getS int
|
||||
gcOptionsOperation <- getS enum
|
||||
gcOptionsPathsToDelete <- getS (hashSet storePath)
|
||||
gcOptionsIgnoreLiveness <- getS bool
|
||||
gcOptionsMaxFreed <- getS int
|
||||
-- obsolete fields
|
||||
Control.Monad.forM_ [0..(2 :: Word8)]
|
||||
$ pure $ getS (int @Word8)
|
||||
@ -1238,10 +1238,10 @@ storeRequest = Serializer
|
||||
Some (CollectGarbage GCOptions{..}) -> mapPutE $ do
|
||||
putS workerOp WorkerOp_CollectGarbage
|
||||
|
||||
putS enum gcOptions_operation
|
||||
putS (hashSet storePath) gcOptions_pathsToDelete
|
||||
putS bool gcOptions_ignoreLiveness
|
||||
putS int gcOptions_maxFreed
|
||||
putS enum gcOptionsOperation
|
||||
putS (hashSet storePath) gcOptionsPathsToDelete
|
||||
putS bool gcOptionsIgnoreLiveness
|
||||
putS int gcOptionsMaxFreed
|
||||
-- obsolete fields
|
||||
Control.Monad.forM_ [0..(2 :: Word8)]
|
||||
$ pure $ putS int (0 :: Word8)
|
||||
@ -1444,12 +1444,12 @@ gcResult
|
||||
=> NixSerializer r ReplySError GCResult
|
||||
gcResult = mapErrorS ReplySError_GCResult $ Serializer
|
||||
{ getS = do
|
||||
gcResult_deletedPaths <- getS (hashSet storePath)
|
||||
gcResult_bytesFreed <- getS int
|
||||
gcResultDeletedPaths <- getS (hashSet storePath)
|
||||
gcResultBytesFreed <- getS int
|
||||
Control.Monad.void $ getS (int @Word64) -- obsolete
|
||||
pure GCResult{..}
|
||||
, putS = \GCResult{..} -> do
|
||||
putS (hashSet storePath) gcResult_deletedPaths
|
||||
putS int gcResult_bytesFreed
|
||||
putS (hashSet storePath) gcResultDeletedPaths
|
||||
putS int gcResultBytesFreed
|
||||
putS (int @Word64) 0 -- obsolete
|
||||
}
|
||||
|
@ -24,24 +24,24 @@ data GCAction
|
||||
-- | Garbage collector operation options
|
||||
data GCOptions = GCOptions
|
||||
{ -- | Operation
|
||||
gcOptions_operation :: GCAction
|
||||
gcOptionsOperation :: GCAction
|
||||
-- | If set, then reachability from the roots is ignored (unused)
|
||||
, gcOptions_ignoreLiveness :: Bool
|
||||
, gcOptionsIgnoreLiveness :: Bool
|
||||
-- | Paths to delete for @GCAction_DeleteSpecific@
|
||||
, gcOptions_pathsToDelete :: HashSet StorePath
|
||||
, gcOptionsPathsToDelete :: HashSet StorePath
|
||||
-- | Stop after `gcOptions_maxFreed` bytes have been freed
|
||||
, gcOptions_maxFreed :: Word64
|
||||
, gcOptionsMaxFreed :: Word64
|
||||
} deriving (Eq, Generic, Ord, Show)
|
||||
|
||||
-- | Result of the garbage collection operation
|
||||
data GCResult = GCResult
|
||||
{ -- | Depending on the action, the GC roots,
|
||||
-- or the paths that would be or have been deleted
|
||||
gcResult_deletedPaths :: HashSet StorePath
|
||||
gcResultDeletedPaths :: HashSet StorePath
|
||||
-- | The number of bytes that would be or was freed for
|
||||
--
|
||||
-- - @GCAction_ReturnDead@
|
||||
-- - @GCAction_DeleteDead@
|
||||
-- - @GCAction_DeleteSpecific@
|
||||
, gcResult_bytesFreed :: Word64
|
||||
, gcResultBytesFreed :: Word64
|
||||
} deriving (Eq, Generic, Ord, Show)
|
||||
|
@ -297,6 +297,6 @@ spec_protocol = Hspec.around withNixDaemon $
|
||||
removeFile $ mconcat [ tempRootsDir, "/", entry ]
|
||||
|
||||
GCResult{..} <- deleteSpecific (HS.fromList [path])
|
||||
gcResult_deletedPaths `shouldBe` HS.fromList [path]
|
||||
gcResult_bytesFreed `shouldBe` 4
|
||||
gcResultDeletedPaths `shouldBe` HS.fromList [path]
|
||||
gcResultBytesFreed `shouldBe` 4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user