summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-27 01:24:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-27 01:24:34 -0400
commitfbc21b0a00c04651e1e56aeb5e10e7803ad3e6ce (patch)
tree145b879109e484dd4e6d034e61d50a771f1f21da /Remote/Helper
parenta9ab7c8a311270c45c851a7bba417cbca6b6616b (diff)
reorg
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Chunked.hs39
1 files changed, 18 insertions, 21 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs
index 65d5892c3..8790c6900 100644
--- a/Remote/Helper/Chunked.hs
+++ b/Remote/Helper/Chunked.hs
@@ -10,7 +10,6 @@ module Remote.Helper.Chunked (
ChunkConfig(..),
chunkConfig,
storeChunks,
- chunkKeys,
removeChunks,
retrieveChunks,
hasKeyChunks,
@@ -123,26 +122,6 @@ storeChunks u chunkconfig k f p storer = metered (Just p) k $ \meterupdate ->
- in previous chunks. -}
meterupdate' = offsetMeterUpdate meterupdate bytesprocessed
--- retrieveChunks :: UUID -> ChunkConfig -> Key -> Annex
-
-{- A key can be stored in a remote unchunked, or as a list of chunked keys.
- - It's even possible for a remote to have the same key stored multiple
- - times with different chunk sizes. This finds all possible lists of keys
- - that might be on the remote that can be combined to get back the
- - requested key.
- -}
-chunkKeys :: UUID -> ChunkConfig -> Key -> Annex [[Key]]
-chunkKeys u (UnpaddedChunks _) k | not (isChunkKey k) = do
- chunklists <- map (toChunkList k) <$> getCurrentChunks u k
- -- Probably using the chunklists, but the unchunked
- -- key could be present.
- return (chunklists ++ [[k]])
-chunkKeys _ _ k = pure [[k]]
-
-toChunkList :: Key -> (ChunkSize, ChunkCount) -> [Key]
-toChunkList k (chunksize, chunkcount) = takeChunkKeyStream chunkcount $
- chunkKeyStream k chunksize
-
{- Removes all chunks of a key from a remote, by calling a remover
- action on each.
-
@@ -247,3 +226,21 @@ hasKeyChunks checker u chunkconfig encryptor basek = do
else return v
impossible = "no recorded chunks"
+
+{- A key can be stored in a remote unchunked, or as a list of chunked keys.
+ - It's even possible for a remote to have the same key stored multiple
+ - times with different chunk sizes. This finds all possible lists of keys
+ - that might be on the remote that can be combined to get back the
+ - requested key.
+ -}
+chunkKeys :: UUID -> ChunkConfig -> Key -> Annex [[Key]]
+chunkKeys u (UnpaddedChunks _) k | not (isChunkKey k) = do
+ chunklists <- map (toChunkList k) <$> getCurrentChunks u k
+ -- Probably using the chunklists, but the unchunked
+ -- key could be present.
+ return (chunklists ++ [[k]])
+chunkKeys _ _ k = pure [[k]]
+
+toChunkList :: Key -> (ChunkSize, ChunkCount) -> [Key]
+toChunkList k (chunksize, chunkcount) = takeChunkKeyStream chunkcount $
+ chunkKeyStream k chunksize