summaryrefslogtreecommitdiff
path: root/Logs/Web.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-17 23:15:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-17 23:15:29 -0400
commit5bf07b3b5c9a798c3a50a775f42888e497f48732 (patch)
tree4387bfee5cf49da02f3d168dcbe11487b45548c1 /Logs/Web.hs
parent1ed5e4d9e3084f5371eb318c500254e1547240e7 (diff)
Store web special remote url info in a more efficient location.
storing it in remotes/web/xx/yy/foo.log meant lots of extra directory objects in git. Now I use xx/yy/foo.log.web, which is just as unique, but more efficient since foo.log is there anyway. Of course, it still looks in the old location too.
Diffstat (limited to 'Logs/Web.hs')
-rw-r--r--Logs/Web.hs27
1 files changed, 16 insertions, 11 deletions
diff --git a/Logs/Web.hs b/Logs/Web.hs
index 62656b7ed..bd8777250 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -23,21 +23,26 @@ type URLString = String
webUUID :: UUID
webUUID = UUID "00000000-0000-0000-0000-000000000001"
-{- 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"
+urlLog key = hashDirLower key </> keyFile key ++ ".log.web"
+
+{- Used to store the urls elsewhere. -}
+oldurlLogs :: Key -> [FilePath]
+oldurlLogs key =
+ [ "remote/web" </> hashDirLower key </> show key ++ ".log"
+ , "remote/web" </> hashDirLower key </> keyFile key ++ ".log"
+ ]
{- Gets all urls that a key might be available from. -}
getUrls :: Key -> Annex [URLString]
-getUrls key = do
- us <- currentLog (urlLog key)
- if null us
- then currentLog (oldurlLog key)
- else return us
+getUrls key = go $ urlLog key : oldurlLogs key
+ where
+ go [] = return []
+ go (l:ls) = do
+ us <- currentLog l
+ if null us
+ then go ls
+ else return us
{- Records a change in an url for a key. -}
setUrl :: Key -> URLString -> LogStatus -> Annex ()