summaryrefslogtreecommitdiff
path: root/Remote/Web.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-15 16:25:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-15 16:25:51 -0400
commitb4015064e1492c6591f69499d8d745989999ba53 (patch)
treec4de51ccdee63baa32263b4f030c8d18873fae5e /Remote/Web.hs
parent1a29b5b52eec641a5456d7c8dc24356c90107bc0 (diff)
break web log handling into a separate module
Diffstat (limited to 'Remote/Web.hs')
-rw-r--r--Remote/Web.hs34
1 files changed, 1 insertions, 33 deletions
diff --git a/Remote/Web.hs b/Remote/Web.hs
index 51373a49c..e46937ba5 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -14,13 +14,10 @@ import Common.Annex
import Types.Remote
import qualified Git
import Config
-import Logs.Presence
-import Logs.Location
import Logs.UUID
+import Logs.Web
import qualified Utility.Url as Url
-type URLString = String
-
remote :: RemoteType Annex
remote = RemoteType {
typename = "web",
@@ -35,10 +32,6 @@ remote = RemoteType {
list :: Annex [Git.Repo]
list = return [Git.repoRemoteNameSet Git.repoFromUnknown "web"]
--- Dummy uuid for the whole web. Do not alter.
-webUUID :: UUID
-webUUID = "00000000-0000-0000-0000-000000000001"
-
gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex (Remote Annex)
gen r _ _ =
return Remote {
@@ -54,31 +47,6 @@ gen r _ _ =
repo = r
}
-{- The urls for a key are stored in remote/web/hash/key.log
- - in the git-annex branch. -}
-urlLog :: Key -> FilePath
-urlLog key = "remote/web" </> hashDirLower key </> keyFile key ++ ".log"
-oldurlLog :: Key -> FilePath
-{- A bug used to store the urls elsewhere. -}
-oldurlLog key = "remote/web" </> hashDirLower key </> show key ++ ".log"
-
-getUrls :: Key -> Annex [URLString]
-getUrls key = do
- us <- currentLog (urlLog key)
- if null us
- then currentLog (oldurlLog key)
- else return us
-
-{- Records a change in an url for a key. -}
-setUrl :: Key -> URLString -> LogStatus -> Annex ()
-setUrl key url status = do
- g <- gitRepo
- addLog (urlLog key) =<< logNow status url
-
- -- update location log to indicate that the web has the key, or not
- us <- getUrls key
- logChange g key webUUID (if null us then InfoMissing else InfoPresent)
-
downloadKey :: Key -> FilePath -> Annex Bool
downloadKey key file = get =<< getUrls key
where