diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-28 13:19:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-28 13:19:08 -0400 |
commit | c25686d17f4b1c7850b8b733b5e63cb829becb3f (patch) | |
tree | f8aded3f06947a194a51d65659d6c02b470dafa8 /Remote | |
parent | 188fbb1d937db0f63841dcc55cea9999e16aff52 (diff) |
add ChunkMethod type and make Logs.Chunk use it, rather than assuming fixed size chunks (so eg, rolling hash chunks can be supported later)
If a newer git-annex starts logging something else in the chunk log, it
won't be used by this version, but it will be preserved when updating the
log.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Helper/Chunked.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs index 9ba6d9cbd..11cd42c90 100644 --- a/Remote/Helper/Chunked.hs +++ b/Remote/Helper/Chunked.hs @@ -19,7 +19,6 @@ import Common.Annex import Utility.DataUnits import Types.Remote import Types.Key -import Logs.Chunk.Pure (ChunkSize, ChunkCount) import Logs.Chunk import Utility.Metered import Crypto (EncKey) @@ -108,7 +107,7 @@ storeChunks u chunkconfig k f p storer = metered (Just p) k $ \meterupdate -> | L.null chunk && numchunks > 0 = do -- Once all chunks are successfully -- stored, update the chunk log. - chunksStored u k chunksize numchunks + chunksStored u k (FixedSizeChunks chunksize) numchunks return True | otherwise = do let (chunkkey, chunkkeys') = nextChunkKeyStream chunkkeys @@ -140,7 +139,7 @@ removeChunks remover u chunkconfig encryptor k = do ok <- allM (remover . encryptor) (concat ls) when ok $ do let chunksizes = catMaybes $ map (keyChunkSize <=< headMaybe) ls - forM_ chunksizes $ chunksRemoved u k . fromIntegral + forM_ chunksizes $ chunksRemoved u k . FixedSizeChunks . fromIntegral return ok {- Retrieves a key from a remote, using a retriever action that @@ -313,6 +312,7 @@ chunkKeys u chunkconfig k = do chunkKeysOnly :: UUID -> Key -> Annex [[Key]] chunkKeysOnly u k = map (toChunkList k) <$> getCurrentChunks u k -toChunkList :: Key -> (ChunkSize, ChunkCount) -> [Key] -toChunkList k (chunksize, chunkcount) = takeChunkKeyStream chunkcount $ - chunkKeyStream k chunksize +toChunkList :: Key -> (ChunkMethod, ChunkCount) -> [Key] +toChunkList k (FixedSizeChunks chunksize, chunkcount) = + takeChunkKeyStream chunkcount $ chunkKeyStream k chunksize +toChunkList _ (UnknownChunks _, _) = [] |