2010-10-10 17:47:04 +00:00
|
|
|
{- git-annex "file" backend
|
|
|
|
- -}
|
|
|
|
|
|
|
|
module BackendFile (backend) where
|
|
|
|
|
2010-10-12 20:06:10 +00:00
|
|
|
import Types
|
2010-10-10 17:47:04 +00:00
|
|
|
|
|
|
|
backend = Backend {
|
|
|
|
name = "file",
|
2010-10-10 19:04:18 +00:00
|
|
|
getKey = keyValue,
|
2010-10-10 19:41:35 +00:00
|
|
|
storeFileKey = dummyStore,
|
2010-10-10 23:53:31 +00:00
|
|
|
retrieveKeyFile = copyFromOtherRepo,
|
|
|
|
removeKey = dummyRemove
|
2010-10-10 17:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-- direct mapping from filename to key
|
2010-10-12 20:06:10 +00:00
|
|
|
keyValue :: State -> FilePath -> IO (Maybe Key)
|
|
|
|
keyValue state file = return $ Just file
|
2010-10-10 19:04:18 +00:00
|
|
|
|
2010-10-10 19:54:02 +00:00
|
|
|
{- This backend does not really do any independant data storage,
|
|
|
|
- it relies on the file contents in .git/annex/ in this repo,
|
2010-10-10 23:53:31 +00:00
|
|
|
- and other accessible repos. So storing or removing a key is
|
|
|
|
- a no-op. -}
|
2010-10-12 20:06:10 +00:00
|
|
|
dummyStore :: State -> FilePath -> Key -> IO (Bool)
|
|
|
|
dummyStore state file key = return True
|
2010-10-12 20:10:15 +00:00
|
|
|
dummyRemove :: State -> Key -> IO Bool
|
|
|
|
dummyRemove state url = return False
|
2010-10-10 19:04:18 +00:00
|
|
|
|
2010-10-10 19:54:02 +00:00
|
|
|
{- Try to find a copy of the file in one of the other repos,
|
|
|
|
- and copy it over to this one. -}
|
2010-10-12 20:10:15 +00:00
|
|
|
copyFromOtherRepo :: State -> Key -> FilePath -> IO (Bool)
|
|
|
|
copyFromOtherRepo state key file = error "copyFromOtherRepo unimplemented" -- TODO
|