summaryrefslogtreecommitdiff
path: root/Remote/Helper/Chunked.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-26 12:04:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-26 12:04:35 -0400
commitabf47bf25aea42a96fffc4cd8ca4e3c9406d4fbd (patch)
tree46ab77ee730c4aab5618219bf34d07c88e1c74e5 /Remote/Helper/Chunked.hs
parentc3c63e48dfb3c981786bd3178e5f5689d3c60abf (diff)
reorg
Diffstat (limited to 'Remote/Helper/Chunked.hs')
-rw-r--r--Remote/Helper/Chunked.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs
index e98400100..e298299ce 100644
--- a/Remote/Helper/Chunked.hs
+++ b/Remote/Helper/Chunked.hs
@@ -63,16 +63,12 @@ takeChunkKeyStream n (ChunkKeyStream l) = genericTake n l
numChunks :: ChunkKeyStream -> Integer
numChunks = pred . fromJust . keyChunkNum . fst . nextChunkKeyStream
-{- Slits up the key's content into chunks, passing each chunk to
- - the storer action, along with a unique chunk key.
+{- Splits up the key's content into chunks, passing each chunk to
+ - the storer action, along with a corresponding chunk key and a
+ - progress meter update callback.
-
- Note that the storer action is responsible for catching any
- exceptions it may encounter.
- -
- - A progress meter display is set up, and the storer action
- - is passed a callback to update it.
- -
- - Once all chunks are successfully stored, updates the chunk log.
-}
storeChunks :: UUID -> ChunkConfig -> Key -> FilePath -> MeterUpdate -> (Key -> L.ByteString -> MeterUpdate -> Annex Bool) -> Annex Bool
storeChunks u chunkconfig k f p storer = metered (Just p) k $ \meterupdate ->
@@ -93,6 +89,8 @@ storeChunks u chunkconfig k f p storer = metered (Just p) k $ \meterupdate ->
-- even for empty content.
| not (null c) || numchunks == 0 =
storechunk bytesprocessed sz [] c chunkkeys
+ -- Once all chunks are successfully stored,
+ -- update the chunk log.
| otherwise = do
chunksStored u k chunksize numchunks
return True