git-annex/Types.hs

36 lines
802 B
Haskell
Raw Normal View History

2010-10-12 19:52:18 +00:00
{- git-annex core data types -}
module Types (
2010-10-12 20:06:10 +00:00
State(..),
Key(..),
Backend(..)
2010-10-12 19:52:18 +00:00
) where
import GitRepo
-- git-annex's runtime state
data State = State {
repo :: GitRepo,
backends :: [Backend]
2010-10-12 20:06:10 +00:00
} deriving (Show)
-- annexed filenames are mapped into keys
type Key = FilePath
-- this structure represents a key/value backend
data Backend = Backend {
-- name of this backend
name :: String,
-- converts a filename to a key
getKey :: State -> FilePath -> IO (Maybe Key),
-- 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,
-- removes a key
removeKey :: Key -> IO Bool
2010-10-12 19:52:18 +00:00
}
2010-10-12 20:06:10 +00:00
instance Show Backend where
show backend = "Backend { name =\"" ++ (name backend) ++ "\" }"