@@ -253,11 +253,11 @@ toSnapMergingRunState !mr = do
253253
254254{-# SPECIALISE
255255 snapshotWriteBuffer ::
256- ActionRegistry IO
257- -> HasFS IO h
256+ HasFS IO h
258257 -> HasBlockIO IO h
259258 -> UniqCounter IO
260259 -> UniqCounter IO
260+ -> ActionRegistry IO
261261 -> ActiveDir
262262 -> NamedSnapshotDir
263263 -> WriteBuffer
@@ -266,17 +266,17 @@ toSnapMergingRunState !mr = do
266266 #-}
267267snapshotWriteBuffer ::
268268 (MonadMVar m , MonadSTM m , MonadST m , MonadMask m )
269- => ActionRegistry m
270- -> HasFS m h
269+ => HasFS m h
271270 -> HasBlockIO m h
272271 -> UniqCounter m
273272 -> UniqCounter m
273+ -> ActionRegistry m
274274 -> ActiveDir
275275 -> NamedSnapshotDir
276276 -> WriteBuffer
277277 -> Ref (WriteBufferBlobs m h )
278278 -> m WriteBufferFsPaths
279- snapshotWriteBuffer reg hfs hbio activeUc snapUc activeDir snapDir wb wbb = do
279+ snapshotWriteBuffer hfs hbio activeUc snapUc reg activeDir snapDir wb wbb = do
280280 -- Write the write buffer and write buffer blobs to the active directory.
281281 activeWriteBufferNumber <- uniqueToRunNumber <$> incrUniqCounter activeUc
282282 let activeWriteBufferPaths = WriteBufferFsPaths (getActiveDir activeDir) activeWriteBufferNumber
@@ -291,13 +291,13 @@ snapshotWriteBuffer reg hfs hbio activeUc snapUc activeDir snapDir wb wbb = do
291291 -- Hard link the write buffer and write buffer blobs to the snapshot directory.
292292 snapWriteBufferNumber <- uniqueToRunNumber <$> incrUniqCounter snapUc
293293 let snapWriteBufferPaths = WriteBufferFsPaths (getNamedSnapshotDir snapDir) snapWriteBufferNumber
294- hardLink reg hfs hbio
294+ hardLink hfs hbio reg
295295 (writeBufferKOpsPath activeWriteBufferPaths)
296296 (writeBufferKOpsPath snapWriteBufferPaths)
297- hardLink reg hfs hbio
297+ hardLink hfs hbio reg
298298 (writeBufferBlobPath activeWriteBufferPaths)
299299 (writeBufferBlobPath snapWriteBufferPaths)
300- hardLink reg hfs hbio
300+ hardLink hfs hbio reg
301301 (writeBufferChecksumsPath activeWriteBufferPaths)
302302 (writeBufferChecksumsPath snapWriteBufferPaths)
303303 pure snapWriteBufferPaths
@@ -336,7 +336,7 @@ openWriteBuffer reg resolve hfs hbio uc activeDir snapWriteBufferPaths = do
336336 activeWriteBufferNumber <- uniqueToInt <$> incrUniqCounter uc
337337 let activeWriteBufferBlobPath =
338338 getActiveDir activeDir </> FS. mkFsPath [show activeWriteBufferNumber] <.> " wbblobs"
339- copyFile reg hfs hbio (writeBufferBlobPath snapWriteBufferPaths) activeWriteBufferBlobPath
339+ copyFile hfs reg (writeBufferBlobPath snapWriteBufferPaths) activeWriteBufferBlobPath
340340 writeBufferBlobs <-
341341 withRollback reg
342342 (WBB. open hfs activeWriteBufferBlobPath FS. AllowExisting )
@@ -376,8 +376,8 @@ instance NFData SnapshotRun where
376376 -> NamedSnapshotDir
377377 -> Ref (Run IO h)
378378 -> IO SnapshotRun #-}
379- -- | @'snapshotRun' _ _ snapUc targetDir run@ creates hard links for all files
380- -- associated with the run, and puts the new directory entries in the
379+ -- | @'snapshotRun' _ _ snapUc _ targetDir run@ creates hard links for all files
380+ -- associated with the @ run@ , and puts the new directory entries in the
381381-- @targetDir@ directory. The entries are renamed using @snapUc@.
382382snapshotRun ::
383383 (MonadMask m , PrimMonad m )
@@ -392,7 +392,7 @@ snapshotRun hfs hbio snapUc reg (NamedSnapshotDir targetDir) run = do
392392 rn <- uniqueToRunNumber <$> incrUniqCounter snapUc
393393 let sourcePaths = Run. runFsPaths run
394394 let targetPaths = sourcePaths { runDir = targetDir , runNumber = rn}
395- hardLinkRunFiles reg hfs hbio sourcePaths targetPaths
395+ hardLinkRunFiles hfs hbio reg sourcePaths targetPaths
396396 pure SnapshotRun {
397397 snapRunNumber = runNumber targetPaths,
398398 snapRunCaching = Run. runDataCaching run,
@@ -408,7 +408,7 @@ snapshotRun hfs hbio snapUc reg (NamedSnapshotDir targetDir) run = do
408408 -> ActiveDir
409409 -> SnapshotRun
410410 -> IO (Ref (Run IO h)) #-}
411- -- | @'openRun' _ _ _ _ uniqCounter sourceDir targetDir snaprun@ takes all run
411+ -- | @'openRun' _ _ uniqCounter _ sourceDir targetDir snaprun@ takes all run
412412-- files that are referenced by @snaprun@, and hard links them from @sourceDir@
413413-- into @targetDir@ with new, unique names (using @uniqCounter@). Each set of
414414-- (hard linked) files that represents a run is opened and verified, returning
@@ -435,7 +435,7 @@ openRun hfs hbio uc reg
435435 let sourcePaths = RunFsPaths sourceDir runNum
436436 runNum' <- uniqueToRunNumber <$> incrUniqCounter uc
437437 let targetPaths = RunFsPaths targetDir runNum'
438- hardLinkRunFiles reg hfs hbio sourcePaths targetPaths
438+ hardLinkRunFiles hfs hbio reg sourcePaths targetPaths
439439
440440 withRollback reg
441441 (Run. openFromDisk hfs hbio caching indexType targetPaths)
@@ -446,29 +446,29 @@ openRun hfs hbio uc reg
446446-------------------------------------------------------------------------------}
447447
448448{-# SPECIALISE fromSnapLevels ::
449- ActionRegistry IO
450- -> HasFS IO h
449+ HasFS IO h
451450 -> HasBlockIO IO h
452- -> TableConfig
453451 -> UniqCounter IO
452+ -> TableConfig
454453 -> ResolveSerialisedValue
454+ -> ActionRegistry IO
455455 -> ActiveDir
456456 -> SnapLevels (Ref (Run IO h))
457457 -> IO (Levels IO h)
458458 #-}
459459-- | Duplicates runs and re-creates merging runs.
460460fromSnapLevels ::
461461 forall m h . (MonadMask m , MonadMVar m , MonadSTM m , MonadST m )
462- => ActionRegistry m
463- -> HasFS m h
462+ => HasFS m h
464463 -> HasBlockIO m h
465- -> TableConfig
466464 -> UniqCounter m
465+ -> TableConfig
467466 -> ResolveSerialisedValue
467+ -> ActionRegistry m
468468 -> ActiveDir
469469 -> SnapLevels (Ref (Run m h ))
470470 -> m (Levels m h )
471- fromSnapLevels reg hfs hbio conf uc resolve dir (SnapLevels levels) =
471+ fromSnapLevels hfs hbio uc conf resolve reg dir (SnapLevels levels) =
472472 V. iforM levels $ \ i -> fromSnapLevel (LevelNo (i+ 1 ))
473473 where
474474 -- TODO: we may wish to trace the merges created during snapshot restore:
@@ -546,9 +546,9 @@ fromSnapMergingRunState hfs hbio uc resolve dir
546546-------------------------------------------------------------------------------}
547547
548548{-# SPECIALISE hardLinkRunFiles ::
549- ActionRegistry IO
550- -> HasFS IO h
549+ HasFS IO h
551550 -> HasBlockIO IO h
551+ -> ActionRegistry IO
552552 -> RunFsPaths
553553 -> RunFsPaths
554554 -> IO () #-}
@@ -557,38 +557,38 @@ fromSnapMergingRunState hfs hbio uc resolve dir
557557-- name for the new directory entry.
558558hardLinkRunFiles ::
559559 (MonadMask m , PrimMonad m )
560- => ActionRegistry m
561- -> HasFS m h
560+ => HasFS m h
562561 -> HasBlockIO m h
562+ -> ActionRegistry m
563563 -> RunFsPaths
564564 -> RunFsPaths
565565 -> m ()
566- hardLinkRunFiles reg hfs hbio sourceRunFsPaths targetRunFsPaths = do
566+ hardLinkRunFiles hfs hbio reg sourceRunFsPaths targetRunFsPaths = do
567567 let sourcePaths = pathsForRunFiles sourceRunFsPaths
568568 targetPaths = pathsForRunFiles targetRunFsPaths
569- sequenceA_ (hardLink reg hfs hbio <$> sourcePaths <*> targetPaths)
570- hardLink reg hfs hbio (runChecksumsPath sourceRunFsPaths) (runChecksumsPath targetRunFsPaths)
569+ sequenceA_ (hardLink hfs hbio reg <$> sourcePaths <*> targetPaths)
570+ hardLink hfs hbio reg (runChecksumsPath sourceRunFsPaths) (runChecksumsPath targetRunFsPaths)
571571
572572{-# SPECIALISE
573573 hardLink ::
574- ActionRegistry IO
575- -> HasFS IO h
574+ HasFS IO h
576575 -> HasBlockIO IO h
576+ -> ActionRegistry IO
577577 -> FS.FsPath
578578 -> FS.FsPath
579579 -> IO ()
580580 #-}
581- -- | @'hardLink' reg hfs hbio sourcePath targetPath@ creates a hard link from
581+ -- | @'hardLink' hfs hbio reg sourcePath targetPath@ creates a hard link from
582582-- @sourcePath@ to @targetPath@.
583583hardLink ::
584584 (MonadMask m , PrimMonad m )
585- => ActionRegistry m
586- -> HasFS m h
585+ => HasFS m h
587586 -> HasBlockIO m h
587+ -> ActionRegistry m
588588 -> FS. FsPath
589589 -> FS. FsPath
590590 -> m ()
591- hardLink reg hfs hbio sourcePath targetPath = do
591+ hardLink hfs hbio reg sourcePath targetPath = do
592592 withRollback_ reg
593593 (FS. createHardLink hbio sourcePath targetPath)
594594 (FS. removeFile hfs targetPath)
@@ -599,23 +599,21 @@ hardLink reg hfs hbio sourcePath targetPath = do
599599
600600{-# SPECIALISE
601601 copyFile ::
602- ActionRegistry IO
603- -> HasFS IO h
604- -> HasBlockIO IO h
602+ HasFS IO h
603+ -> ActionRegistry IO
605604 -> FS.FsPath
606605 -> FS.FsPath
607606 -> IO ()
608607 #-}
609- -- | @'copyFile' reg hfs hbio source target@ copies the @source@ path to the @target@ path.
608+ -- | @'copyFile' hfs reg source target@ copies the @source@ path to the @target@ path.
610609copyFile ::
611610 (MonadMask m , PrimMonad m )
612- => ActionRegistry m
613- -> HasFS m h
614- -> HasBlockIO m h
611+ => HasFS m h
612+ -> ActionRegistry m
615613 -> FS. FsPath
616614 -> FS. FsPath
617615 -> m ()
618- copyFile reg hfs _hbio sourcePath targetPath =
616+ copyFile hfs reg sourcePath targetPath =
619617 flip (withRollback_ reg) (FS. removeFile hfs targetPath) $
620618 FS. withFile hfs sourcePath FS. ReadMode $ \ sourceHandle ->
621619 FS. withFile hfs targetPath (FS. WriteMode FS. MustBeNew ) $ \ targetHandle -> do
0 commit comments