2012-10-10 19:15:56 +00:00
|
|
|
{- git-annex standard repository groups
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2012-10-10 20:04:28 +00:00
|
|
|
module Types.StandardGroups where
|
2012-10-10 19:27:25 +00:00
|
|
|
|
2012-10-10 19:15:56 +00:00
|
|
|
data StandardGroup = ClientGroup | TransferGroup | ArchiveGroup | BackupGroup
|
2012-10-10 20:04:28 +00:00
|
|
|
deriving (Eq, Ord, Enum, Bounded, Show)
|
2012-10-10 19:15:56 +00:00
|
|
|
|
|
|
|
fromStandardGroup :: StandardGroup -> String
|
|
|
|
fromStandardGroup ClientGroup = "client"
|
|
|
|
fromStandardGroup TransferGroup = "transfer"
|
|
|
|
fromStandardGroup ArchiveGroup = "archive"
|
|
|
|
fromStandardGroup BackupGroup = "backup"
|
|
|
|
|
|
|
|
toStandardGroup :: String -> Maybe StandardGroup
|
|
|
|
toStandardGroup "client" = Just ClientGroup
|
|
|
|
toStandardGroup "transfer" = Just TransferGroup
|
|
|
|
toStandardGroup "archive" = Just ArchiveGroup
|
|
|
|
toStandardGroup "backup" = Just BackupGroup
|
|
|
|
toStandardGroup _ = Nothing
|
|
|
|
|
2012-10-10 20:04:28 +00:00
|
|
|
descStandardGroup :: StandardGroup -> String
|
|
|
|
descStandardGroup ClientGroup = "client: a repository on your computer"
|
2012-10-10 20:23:41 +00:00
|
|
|
descStandardGroup TransferGroup = "transfer: distributes files to clients"
|
|
|
|
descStandardGroup ArchiveGroup = "archive: collects files that are not archived elsewhere"
|
|
|
|
descStandardGroup BackupGroup = "backup: collects all files"
|
2012-10-10 20:04:28 +00:00
|
|
|
|
2012-10-10 19:15:56 +00:00
|
|
|
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
|
|
|
|
preferredContent :: StandardGroup -> String
|
|
|
|
preferredContent ClientGroup = "exclude=*/archive/*"
|
2012-10-14 20:21:18 +00:00
|
|
|
preferredContent TransferGroup = "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
|
2012-10-10 19:15:56 +00:00
|
|
|
preferredContent ArchiveGroup = "not copies=archive:1"
|
|
|
|
preferredContent BackupGroup = "" -- all content is preferred
|