aboutsummaryrefslogtreecommitdiff
path: root/Backend/WORM.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-05 19:51:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-05 19:51:03 -0400
commitd3cee987caf20b309334b37bd1b89e8b9115cf0a (patch)
tree8c1a244545efed3b2fd9e48ea28faac12aa326fe /Backend/WORM.hs
parent77188ff04d8d4d42b25daac9eeffbf10d8b663ac (diff)
separate source of content from the filename associated with the key when generating a key
This already made migrate's code a lot simpler.
Diffstat (limited to 'Backend/WORM.hs')
-rw-r--r--Backend/WORM.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Backend/WORM.hs b/Backend/WORM.hs
index c022fd413..630000fa2 100644
--- a/Backend/WORM.hs
+++ b/Backend/WORM.hs
@@ -15,11 +15,11 @@ backends :: [Backend]
backends = [backend]
backend :: Backend
-backend = Backend {
- name = "WORM",
- getKey = keyValue,
- fsckKey = Nothing
-}
+backend = Backend
+ { name = "WORM"
+ , getKey = keyValue
+ , fsckKey = Nothing
+ }
{- The key includes the file size, modification time, and the
- basename of the filename.
@@ -28,11 +28,11 @@ backend = Backend {
- while also allowing a file to be moved around while retaining the
- same key.
-}
-keyValue :: FilePath -> Annex (Maybe Key)
-keyValue file = do
- stat <- liftIO $ getFileStatus file
+keyValue :: KeySource -> Annex (Maybe Key)
+keyValue source = do
+ stat <- liftIO $ getFileStatus $ contentLocation source
return $ Just Key {
- keyName = takeFileName file,
+ keyName = takeFileName $ keyFilename source,
keyBackendName = name backend,
keySize = Just $ fromIntegral $ fileSize stat,
keyMtime = Just $ modificationTime stat