more state
This commit is contained in:
parent
2ac47a3a59
commit
20acda0423
5 changed files with 12 additions and 14 deletions
|
@ -68,7 +68,7 @@ retrieveFile backends state file dest = do
|
|||
Nothing -> return False
|
||||
Just b -> do
|
||||
key <- lookupKey b state file
|
||||
(retrieveKeyFile b) key dest
|
||||
(retrieveKeyFile b) state key dest
|
||||
|
||||
{- Drops the key for a file from the backend that has it. -}
|
||||
dropFile :: [Backend] -> State -> FilePath -> IO (Maybe Key)
|
||||
|
@ -78,7 +78,7 @@ dropFile backends state file = do
|
|||
Nothing -> return Nothing
|
||||
Just b -> do
|
||||
key <- lookupKey b state file
|
||||
(removeKey b) key
|
||||
(removeKey b) state key
|
||||
removeFile $ backendFile b state file
|
||||
return $ Just key
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ module BackendChecksum (backend) where
|
|||
import qualified BackendFile
|
||||
import Data.Digest.Pure.SHA
|
||||
import Types
|
||||
import GitRepo
|
||||
|
||||
-- based on BackendFile just with a different key type
|
||||
backend = BackendFile.backend {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
module BackendFile (backend) where
|
||||
|
||||
import Types
|
||||
import GitRepo
|
||||
|
||||
backend = Backend {
|
||||
name = "file",
|
||||
|
@ -24,10 +23,10 @@ keyValue state file = return $ Just file
|
|||
- a no-op. -}
|
||||
dummyStore :: State -> FilePath -> Key -> IO (Bool)
|
||||
dummyStore state file key = return True
|
||||
dummyRemove :: Key -> IO Bool
|
||||
dummyRemove url = return False
|
||||
dummyRemove :: State -> Key -> IO Bool
|
||||
dummyRemove state url = return False
|
||||
|
||||
{- Try to find a copy of the file in one of the other repos,
|
||||
- and copy it over to this one. -}
|
||||
copyFromOtherRepo :: Key -> FilePath -> IO (Bool)
|
||||
copyFromOtherRepo key file = error "copyFromOtherRepo unimplemented" -- TODO
|
||||
copyFromOtherRepo :: State -> Key -> FilePath -> IO (Bool)
|
||||
copyFromOtherRepo state key file = error "copyFromOtherRepo unimplemented" -- TODO
|
||||
|
|
|
@ -20,8 +20,8 @@ keyValue repo file = return Nothing
|
|||
-- cannot change urls
|
||||
dummyStore :: State -> FilePath -> Key -> IO Bool
|
||||
dummyStore repo file url = return False
|
||||
dummyRemove :: Key -> IO Bool
|
||||
dummyRemove url = return False
|
||||
dummyRemove :: State -> Key -> IO Bool
|
||||
dummyRemove state url = return False
|
||||
|
||||
downloadUrl :: Key -> FilePath -> IO Bool
|
||||
downloadUrl url file = error "downloadUrl unimplemented"
|
||||
downloadUrl :: State -> Key -> FilePath -> IO Bool
|
||||
downloadUrl state url file = error "downloadUrl unimplemented"
|
||||
|
|
4
Types.hs
4
Types.hs
|
@ -26,9 +26,9 @@ data Backend = Backend {
|
|||
-- stores a file's contents to a key
|
||||
storeFileKey :: State -> FilePath -> Key -> IO Bool,
|
||||
-- retrieves a key's contents to a file
|
||||
retrieveKeyFile :: Key -> FilePath -> IO Bool,
|
||||
retrieveKeyFile :: State -> Key -> FilePath -> IO Bool,
|
||||
-- removes a key
|
||||
removeKey :: Key -> IO Bool
|
||||
removeKey :: State -> Key -> IO Bool
|
||||
}
|
||||
|
||||
instance Show Backend where
|
||||
|
|
Loading…
Reference in a new issue