rename file -> WORM
This commit is contained in:
parent
0e8cb63aab
commit
395625d0a7
5 changed files with 30 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
16
Backend/Worm.hs
Normal file
16
Backend/Worm.hs
Normal file
|
@ -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)
|
|
@ -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
|
||||
]
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue