summaryrefslogtreecommitdiff
path: root/BackendType.hs
blob: 3bc822f3296f257379e72e4b7e27893a68eae968 (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
{- git-annex backend data types
 - -}

module BackendType (
	-- the entire types are exported, for use in backend implementations
	Key(..),
	Backend(..)
) where

import GitRepo

-- 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 :: 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
}

instance Show Backend where
	show backend = "Backend { name =\"" ++ (name backend) ++ "\" }"