summaryrefslogtreecommitdiff
path: root/BackendFile.hs
blob: 92f708696bdfbeae794faa72255d9e6ef903c184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{- git-annex "file" backend
 - -}

module BackendFile (backend) where

import Backend
import GitRepo

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