diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-01-28 17:17:26 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-01-28 17:17:26 -0400 |
commit | 20a8350e36f6e38b55603e6578fa7b1c4967c1a9 (patch) | |
tree | 6c6b884cbc52496d614be996d702e0b8f6dc9300 /Logs/Chunk.hs | |
parent | 6e765717650f0270cdc497d38245bcbc4180e60c (diff) |
implement annex.tune.branchhash1
I hope this doesn't impact speed much -- it does have to pull out a value
from Annex state every time it accesses the branch now.
The test case I dropped has never caught any problems that I can remember,
and would have been rather difficult to convert.
Diffstat (limited to 'Logs/Chunk.hs')
-rw-r--r-- | Logs/Chunk.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Logs/Chunk.hs b/Logs/Chunk.hs index 8ca3ffed3..8f0e7cedb 100644 --- a/Logs/Chunk.hs +++ b/Logs/Chunk.hs @@ -29,6 +29,7 @@ import Logs import Logs.MapLog import qualified Annex.Branch import Logs.Chunk.Pure +import qualified Annex import qualified Data.Map as M import Data.Time.Clock.POSIX @@ -36,14 +37,17 @@ import Data.Time.Clock.POSIX chunksStored :: UUID -> Key -> ChunkMethod -> ChunkCount -> Annex () chunksStored u k chunkmethod chunkcount = do ts <- liftIO getPOSIXTime - Annex.Branch.change (chunkLogFile k) $ + config <- Annex.getGitConfig + Annex.Branch.change (chunkLogFile config k) $ showLog . changeMapLog ts (u, chunkmethod) chunkcount . parseLog chunksRemoved :: UUID -> Key -> ChunkMethod -> Annex () chunksRemoved u k chunkmethod = chunksStored u k chunkmethod 0 getCurrentChunks :: UUID -> Key -> Annex [(ChunkMethod, ChunkCount)] -getCurrentChunks u k = select . parseLog <$> Annex.Branch.get (chunkLogFile k) +getCurrentChunks u k = do + config <- Annex.getGitConfig + select . parseLog <$> Annex.Branch.get (chunkLogFile config k) where select = filter (\(_m, ct) -> ct > 0) . map (\((_ku, m), l) -> (m, value l)) |