diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-29 20:10:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-29 20:10:14 -0400 |
commit | af777a1134bfd21cebff29dadcdf0d3f8ac05c48 (patch) | |
tree | 4d62738d8bce0e34e51df3e6510441dc0fb2987f /Types | |
parent | ca0d8f09bdd9f8cbcf77b1c29272418cd68deeb1 (diff) |
optimise case of remote that retrieves FileContent, when chunks and encryption are not being used
No need to read whole FileContent only to write it back out to a file in
this case. Can just rename! Yay.
Also indidentially, fixed an attempt to open a file for write that was
already opened for write, which caused a crash and deadlock.
Diffstat (limited to 'Types')
-rw-r--r-- | Types/StoreRetrieve.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Types/StoreRetrieve.hs b/Types/StoreRetrieve.hs index 0ee2fd501..33f66efb1 100644 --- a/Types/StoreRetrieve.hs +++ b/Types/StoreRetrieve.hs @@ -23,6 +23,10 @@ data ContentSource = FileContent FilePath | ByteContent L.ByteString +isByteContent :: ContentSource -> Bool +isByteContent (ByteContent _) = True +isByteContent (FileContent _) = False + -- Action that stores a Key's content on a remote. -- Can throw exceptions. type Storer = Key -> ContentSource -> MeterUpdate -> Annex Bool |