summaryrefslogtreecommitdiff
path: root/Types.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-12 16:06:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-12 16:06:10 -0400
commit2ac47a3a59b2b9b8980b4a9d3277bcb653bcb026 (patch)
tree2d40eae24513c5f895a9da771f0b34d228439c97 /Types.hs
parent759f146d0fd5857cbbb796367c3dd8c695550b46 (diff)
thread State thru to backends
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs25
1 files changed, 23 insertions, 2 deletions
diff --git a/Types.hs b/Types.hs
index df9588027..de6bff9ff 100644
--- a/Types.hs
+++ b/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) ++ "\" }"