thread State thru to backends
This commit is contained in:
parent
759f146d0f
commit
2ac47a3a59
8 changed files with 67 additions and 77 deletions
25
Types.hs
25
Types.hs
|
@ -1,14 +1,35 @@
|
|||
{- git-annex core data types -}
|
||||
|
||||
module Types (
|
||||
State(..)
|
||||
State(..),
|
||||
Key(..),
|
||||
Backend(..)
|
||||
) where
|
||||
|
||||
import BackendType
|
||||
import GitRepo
|
||||
|
||||
-- git-annex's runtime state
|
||||
data State = State {
|
||||
repo :: GitRepo,
|
||||
backends :: [Backend]
|
||||
} 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
|
||||
}
|
||||
|
||||
instance Show Backend where
|
||||
show backend = "Backend { name =\"" ++ (name backend) ++ "\" }"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue