summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Backend/Checksum.hs1
-rw-r--r--Backend/File.hs22
-rw-r--r--Backend/Worm.hs16
-rw-r--r--BackendList.hs4
-rw-r--r--git-annex.mdwn4
5 files changed, 30 insertions, 17 deletions
diff --git a/Backend/Checksum.hs b/Backend/Checksum.hs
index bfc789e40..de98fbf44 100644
--- a/Backend/Checksum.hs
+++ b/Backend/Checksum.hs
@@ -7,7 +7,6 @@ import qualified Backend.File
import Data.Digest.Pure.SHA
import BackendTypes
--- based on BackendFile just with a different key type
backend = Backend.File.backend {
name = "checksum",
getKey = keyValue
diff --git a/Backend/File.hs b/Backend/File.hs
index 6267b478a..eba4b88f8 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -1,5 +1,12 @@
-{- git-annex "file" backend
- - -}
+{- git-annex pseudo-backend
+ -
+ - This backend does not really do any independant data storage,
+ - it relies on the file contents in .git/annex/ in this repo,
+ - and other accessible repos.
+ -
+ - This is an abstract backend; getKey has to be implemented to complete
+ - it.
+ -}
module Backend.File (backend) where
@@ -19,22 +26,13 @@ import qualified Annex
import UUID
backend = Backend {
- name = "file",
- getKey = keyValue,
storeFileKey = dummyStore,
retrieveKeyFile = copyKeyFile,
removeKey = dummyRemove,
hasKey = checkKeyFile
}
--- direct mapping from filename to key
-keyValue :: FilePath -> Annex (Maybe Key)
-keyValue file = return $ Just $ Key ((name backend), file)
-
-{- This backend does not really do any independant data storage,
- - it relies on the file contents in .git/annex/ in this repo,
- - and other accessible repos. So storing a key is
- - a no-op. -}
+{- Storing a key is a no-op. -}
dummyStore :: FilePath -> Key -> Annex (Bool)
dummyStore file key = return True
diff --git a/Backend/Worm.hs b/Backend/Worm.hs
new file mode 100644
index 000000000..26fffab52
--- /dev/null
+++ b/Backend/Worm.hs
@@ -0,0 +1,16 @@
+{- git-annex "WORM" backend -- Write Once, Read Many
+ - -}
+
+module Backend.Worm (backend) where
+
+import qualified Backend.File
+import BackendTypes
+
+backend = Backend.File.backend {
+ name = "WORM",
+ getKey = keyValue
+}
+
+-- direct mapping from filename to key
+keyValue :: FilePath -> Annex (Maybe Key)
+keyValue file = return $ Just $ Key ((name backend), file)
diff --git a/BackendList.hs b/BackendList.hs
index b66110905..93c0464f1 100644
--- a/BackendList.hs
+++ b/BackendList.hs
@@ -10,11 +10,11 @@ module BackendList (
import BackendTypes
-- When adding a new backend, import it here and add it to the list.
-import qualified Backend.File
+import qualified Backend.Worm
import qualified Backend.Checksum
import qualified Backend.Url
supportedBackends =
- [ Backend.File.backend
+ [ Backend.Worm.backend
, Backend.Checksum.backend
, Backend.Url.backend
]
diff --git a/git-annex.mdwn b/git-annex.mdwn
index 70bd66e95..fba9648db 100644
--- a/git-annex.mdwn
+++ b/git-annex.mdwn
@@ -93,8 +93,8 @@ stable for a given file content, name, and size.
Multiple pluggable backends are supported, and more than one can be used
to store different files' contents in a given repository.
-* `file` -- This backend stores the file's content in
- `.git/annex/`, and assumes that any file with the same basename
+* `WORM` ("Write Once, Read Many") This backend stores the file's content
+ in `.git/annex/`, and assumes that any file with the same basename
has the same content. So with this backend, files can be moved around,
but should never be added to or changed. This is the default, and
the least expensive backend.