git-annex/Types.hs

32 lines
684 B
Haskell
Raw Normal View History

2010-10-10 22:05:37 +00:00
{- git-annex data types
- -}
module Types where
2010-10-10 22:25:31 +00:00
-- annexed filenames are mapped into keys
2010-10-10 22:05:37 +00:00
type Key = String
2010-10-10 22:25:31 +00:00
-- this structure represents a key/value backend
2010-10-10 22:05:37 +00:00
data Backend = Backend {
-- name of this backend
name :: String,
-- converts a filename to a key
getKey :: GitRepo -> FilePath -> IO (Maybe Key),
-- stores a file's contents to a key
storeFileKey :: GitRepo -> FilePath -> Key -> IO (Bool),
-- retrieves a key's contents to a file
retrieveKeyFile :: IO Key -> FilePath -> IO (Bool)
}
2010-10-10 22:25:31 +00:00
-- a git repository
2010-10-10 22:05:37 +00:00
data GitRepo = GitRepo {
top :: FilePath,
2010-10-10 22:25:31 +00:00
remotes :: [GitRepo]
2010-10-10 22:05:37 +00:00
}
2010-10-10 22:25:31 +00:00
-- git-annex's runtime state
data State = State {
repo :: GitRepo,
backends :: [Backend]
}