2011-06-01 23:10:38 +00:00
|
|
|
{- git-annex UUID type
|
|
|
|
-
|
|
|
|
- Copyright 2011 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2011-06-02 01:56:04 +00:00
|
|
|
module Types.UUID where
|
2011-06-01 23:10:38 +00:00
|
|
|
|
add ConfigMonitor thread
Monitors git-annex branch for changes, which are noticed by the Merger
thread whenever the branch ref is changed (either due to an incoming push,
or a local change), and refreshes cached config values for modified config
files.
Rate limited to run no more often than once per minute. This is important
because frequent git-annex branch changes happen when files are being
added, or transferred, etc.
A primary use case is that, when preferred content changes are made,
and get pushed to remotes, the remotes start honoring those settings.
Other use cases include propigating repository description and trust
changes to remotes, and learning when a remote has added a new special
remote, so the webapp can present the GUI to enable that special remote
locally.
Also added a uuid.log cache. All other config files already had caches.
2012-10-20 20:37:06 +00:00
|
|
|
import qualified Data.Map as M
|
2014-04-16 00:13:35 +00:00
|
|
|
import qualified Data.UUID as U
|
|
|
|
import Data.Maybe
|
add ConfigMonitor thread
Monitors git-annex branch for changes, which are noticed by the Merger
thread whenever the branch ref is changed (either due to an incoming push,
or a local change), and refreshes cached config values for modified config
files.
Rate limited to run no more often than once per minute. This is important
because frequent git-annex branch changes happen when files are being
added, or transferred, etc.
A primary use case is that, when preferred content changes are made,
and get pushed to remotes, the remotes start honoring those settings.
Other use cases include propigating repository description and trust
changes to remotes, and learning when a remote has added a new special
remote, so the webapp can present the GUI to enable that special remote
locally.
Also added a uuid.log cache. All other config files already had caches.
2012-10-20 20:37:06 +00:00
|
|
|
|
2011-11-07 18:46:01 +00:00
|
|
|
-- A UUID is either an arbitrary opaque string, or UUID info may be missing.
|
|
|
|
data UUID = NoUUID | UUID String
|
2012-08-08 20:06:01 +00:00
|
|
|
deriving (Eq, Ord, Show, Read)
|
2011-11-07 18:46:01 +00:00
|
|
|
|
2011-11-08 03:21:22 +00:00
|
|
|
fromUUID :: UUID -> String
|
|
|
|
fromUUID (UUID u) = u
|
|
|
|
fromUUID NoUUID = ""
|
2011-11-07 18:46:01 +00:00
|
|
|
|
2011-11-08 03:21:22 +00:00
|
|
|
toUUID :: String -> UUID
|
|
|
|
toUUID [] = NoUUID
|
|
|
|
toUUID s = UUID s
|
add ConfigMonitor thread
Monitors git-annex branch for changes, which are noticed by the Merger
thread whenever the branch ref is changed (either due to an incoming push,
or a local change), and refreshes cached config values for modified config
files.
Rate limited to run no more often than once per minute. This is important
because frequent git-annex branch changes happen when files are being
added, or transferred, etc.
A primary use case is that, when preferred content changes are made,
and get pushed to remotes, the remotes start honoring those settings.
Other use cases include propigating repository description and trust
changes to remotes, and learning when a remote has added a new special
remote, so the webapp can present the GUI to enable that special remote
locally.
Also added a uuid.log cache. All other config files already had caches.
2012-10-20 20:37:06 +00:00
|
|
|
|
2014-04-16 00:13:35 +00:00
|
|
|
isUUID :: String -> Bool
|
|
|
|
isUUID = isJust . U.fromString
|
|
|
|
|
add ConfigMonitor thread
Monitors git-annex branch for changes, which are noticed by the Merger
thread whenever the branch ref is changed (either due to an incoming push,
or a local change), and refreshes cached config values for modified config
files.
Rate limited to run no more often than once per minute. This is important
because frequent git-annex branch changes happen when files are being
added, or transferred, etc.
A primary use case is that, when preferred content changes are made,
and get pushed to remotes, the remotes start honoring those settings.
Other use cases include propigating repository description and trust
changes to remotes, and learning when a remote has added a new special
remote, so the webapp can present the GUI to enable that special remote
locally.
Also added a uuid.log cache. All other config files already had caches.
2012-10-20 20:37:06 +00:00
|
|
|
type UUIDMap = M.Map UUID String
|