diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-24 15:08:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-24 15:08:07 -0400 |
commit | 35b31b00e4efbf84bcfb814acc477bbb89b50107 (patch) | |
tree | 73ff2a919db27556617739b132889acc702f6d43 /Remote/Helper | |
parent | 28961c83eb80cbc874b0d5bcd232912ef0b455ff (diff) |
improve chunk data types
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Chunked.hs | 10 | ||||
-rw-r--r-- | Remote/Helper/Chunked/Legacy.hs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs index aafa6b700..a71c39fbc 100644 --- a/Remote/Helper/Chunked.hs +++ b/Remote/Helper/Chunked.hs @@ -13,18 +13,20 @@ import Types.Remote import qualified Data.Map as M import Data.Int +type ChunkSize = Int64 + data ChunkConfig = NoChunks - | ChunkSize Int64 - | LegacyChunkSize Int64 + | UnpaddedChunks ChunkSize + | LegacyChunks ChunkSize chunkConfig :: RemoteConfig -> ChunkConfig chunkConfig m = case M.lookup "chunksize" m of Nothing -> case M.lookup "chunk" m of Nothing -> NoChunks - Just v -> ChunkSize $ readsz v "chunk" - Just v -> LegacyChunkSize $ readsz v "chunksize" + Just v -> UnpaddedChunks $ readsz v "chunk" + Just v -> LegacyChunks $ readsz v "chunksize" where readsz v f = case readSize dataUnits v of Just size | size > 0 -> fromInteger size diff --git a/Remote/Helper/Chunked/Legacy.hs b/Remote/Helper/Chunked/Legacy.hs index b35bc92a0..3b6b0d47f 100644 --- a/Remote/Helper/Chunked/Legacy.hs +++ b/Remote/Helper/Chunked/Legacy.hs @@ -9,13 +9,11 @@ module Remote.Helper.Chunked.Legacy where import Common.Annex import Utility.Metered +import Remote.Helper.Chunked (ChunkSize) import qualified Data.ByteString.Lazy as L -import Data.Int import qualified Control.Exception as E -type ChunkSize = Int64 - {- This is an extension that's added to the usual file (or whatever) - where the remote stores a key. -} type ChunkExt = String |