git-annex/BackendFile.hs
2010-10-10 18:05:37 -04:00

28 lines
852 B
Haskell

{- git-annex "file" backend
- -}
module BackendFile (backend) where
import Types
backend = Backend {
name = "file",
getKey = keyValue,
storeFileKey = dummyStore,
retrieveKeyFile = copyFromOtherRepo
}
-- direct mapping from filename to key
keyValue :: GitRepo -> FilePath -> IO (Maybe Key)
keyValue repo file = return $ Just file
{- This backend does not really do any independant data storage,
- it relies on the file contents in .git/annex/ in this repo,
- and other accessible repos. So storing a file is a no-op. -}
dummyStore :: GitRepo -> FilePath -> Key -> IO (Bool)
dummyStore repo file key = return True
{- Try to find a copy of the file in one of the other repos,
- and copy it over to this one. -}
copyFromOtherRepo :: IO Key -> FilePath -> IO (Bool)
copyFromOtherRepo key file = error "copyFromOtherRepo unimplemented" -- TODO