commit more transactions when fscking

This makes interrupt and resume work, robustly.

But, incremental fsck is slowed down by all those transactions..
This commit is contained in:
Joey Hess 2015-02-16 16:04:23 -04:00
parent 91e9146d1b
commit d2766df914
3 changed files with 34 additions and 19 deletions

View file

@ -11,6 +11,7 @@
module Database.Fsck (
newPass,
openDb,
H.commitDb,
H.closeDb,
H.DbHandle,
addDb,
@ -60,11 +61,11 @@ openDb = do
liftIO $ renameFile newdb db
liftIO $ H.openDb db
addDb :: H.DbHandle -> Key -> Annex ()
addDb h = void . liftIO . H.runDb h . insert . Fscked . toSKey
addDb :: H.DbHandle -> Key -> IO ()
addDb h = void . H.runDb h . insert . Fscked . toSKey
inDb :: H.DbHandle -> Key -> Annex Bool
inDb h k = liftIO $ H.runDb h $ do
inDb :: H.DbHandle -> Key -> IO Bool
inDb h k = H.runDb h $ do
r <- select $ from $ \r -> do
where_ (r ^. FsckedKey ==. val (toSKey k))
return (r ^. FsckedKey)