summaryrefslogtreecommitdiff
path: root/Types.hs
blob: 6e3727e25a18f09e95c68faaf17b40a6129fe7b3 (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
30
31
32
33
34
{- git-annex data types
 - -}

module Types where

-- annexed filenames are mapped into keys
type Key = String

-- this structure represents a key/value backend
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 :: Key -> FilePath -> IO Bool,
	-- removes a key
	removeKey :: Key -> IO Bool
}

-- a git repository
data GitRepo = GitRepo {
	top :: FilePath,
	bare :: Bool,
	remotes :: [GitRepo]
}

-- git-annex's runtime state
data State = State {
	repo :: GitRepo,
	backends :: [Backend]
}