99b7a0cfe9
Only clusters still need to be fixed to close this todo.
34 lines
762 B
Haskell
34 lines
762 B
Haskell
{- git-annex safe drop proof
|
|
-
|
|
- Copyright 2014-2024 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Annex.SafeDropProof (
|
|
SafeDropProof,
|
|
safeDropProofEndTime,
|
|
safeDropProofExpired,
|
|
checkSafeDropProofEndTime,
|
|
) where
|
|
|
|
import Annex.Common
|
|
import Types.NumCopies
|
|
|
|
import Data.Time.Clock.POSIX
|
|
|
|
safeDropProofExpired :: Annex ()
|
|
safeDropProofExpired = do
|
|
showNote "unsafe"
|
|
showLongNote $ UnquotedString
|
|
"Dropping took too long, and locks may have expired."
|
|
|
|
checkSafeDropProofEndTime :: Maybe SafeDropProof -> IO Bool
|
|
checkSafeDropProofEndTime p = case safeDropProofEndTime =<< p of
|
|
Nothing -> return True
|
|
Just endtime -> do
|
|
now <- getPOSIXTime
|
|
return (endtime > now)
|
|
|