improve chunk data types
This commit is contained in:
parent
9e2d49d441
commit
bbdb2c04d5
4 changed files with 20 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue