summaryrefslogtreecommitdiff
path: root/BackendType.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-11 18:15:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-11 18:15:14 -0400
commitf516b820caa702ee76c85b005fef285b8372c4da (patch)
tree9d0706c709c80cfd378bb164de99c904fbc25d4c /BackendType.hs
parent104fe9132af2553a29631b1cd38cc79169e9d9f2 (diff)
add
Diffstat (limited to 'BackendType.hs')
-rw-r--r--BackendType.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/BackendType.hs b/BackendType.hs
new file mode 100644
index 000000000..3bc822f32
--- /dev/null
+++ b/BackendType.hs
@@ -0,0 +1,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) ++ "\" }"
+