aboutsummaryrefslogtreecommitdiff
path: root/TypeInternals.hs
diff options
context:
space:
mode:
Diffstat (limited to 'TypeInternals.hs')
-rw-r--r--TypeInternals.hs19
1 files changed, 11 insertions, 8 deletions
diff --git a/TypeInternals.hs b/TypeInternals.hs
index 4a9d2653e..6d1c72d2e 100644
--- a/TypeInternals.hs
+++ b/TypeInternals.hs
@@ -7,12 +7,15 @@ module TypeInternals where
import Control.Monad.State (StateT)
import Data.String.Utils
+import qualified Data.Map as M
import qualified GitRepo as Git
-data Flag =
- Force | -- command-line flags
- RemotesRead -- indicates that remote repo configs have been read
+-- command-line flags
+type FlagName = String
+data Flag =
+ FlagBool Bool |
+ FlagString String
deriving (Eq, Read, Show)
-- git-annex's runtime state type doesn't really belong here,
@@ -21,7 +24,7 @@ data AnnexState = AnnexState {
repo :: Git.Repo,
backends :: [Backend],
supportedBackends :: [Backend],
- flags :: [Flag]
+ flags :: M.Map FlagName Flag
} deriving (Show)
-- git-annex's monad
@@ -32,6 +35,10 @@ type KeyFrag = String
type BackendName = String
data Key = Key (BackendName, KeyFrag) deriving (Eq)
+-- constructs a key in a backend
+genKey :: Backend -> KeyFrag -> Key
+genKey b f = Key (name b,f)
+
-- show a key to convert it to a string; the string includes the
-- name of the backend to avoid collisions between key strings
instance Show Key where
@@ -48,10 +55,6 @@ instance Read Key where
backendName :: Key -> BackendName
backendName (Key (b,k)) = b
--- pulls the key fragment out
-keyFrag :: Key -> KeyFrag
-keyFrag (Key (b,k)) = k
-
-- this structure represents a key-value backend
data Backend = Backend {
-- name of this backend