diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-18 21:48:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-18 21:50:16 -0400 |
commit | 3d6fb239dd88ec7f105b8066b5c5476bb9c2aeec (patch) | |
tree | a04c6aeffdbf2ad7756ac5ac6abf704090bf763a /Remote/WebDAV.hs | |
parent | 6aa68125b6d476f0ad9372a0f0fbaa5c118e7096 (diff) |
refactor
Diffstat (limited to 'Remote/WebDAV.hs')
-rw-r--r-- | Remote/WebDAV.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index 2dce15499..e7da3af19 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -31,7 +31,7 @@ import Remote.Helper.Encryptable import Remote.Helper.Chunked import Crypto import Creds -import Utility.Observed +import Meters type DavUrl = String type DavUser = B8.ByteString @@ -89,16 +89,15 @@ store r k _f p = metered (Just p) k $ \meterupdate -> davAction r False $ \(baseurl, user, pass) -> do let url = davLocation baseurl k f <- inRepo $ gitAnnexLocation k - liftIO $ withBinaryFile f ReadMode $ \h -> do - b <- hGetContentsObserved h $ meterupdate . toInteger - storeHelper r url user pass b + liftIO $ withMeteredFile f meterupdate $ + storeHelper r url user pass storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool storeEncrypted r (cipher, enck) k p = metered (Just p) k $ \meterupdate -> davAction r False $ \(baseurl, user, pass) -> do let url = davLocation baseurl enck f <- inRepo $ gitAnnexLocation k - liftIO $ encrypt cipher (feedFileMetered f meterupdate) $ + liftIO $ encrypt cipher (sendMeteredFile f meterupdate) $ readBytes $ storeHelper r url user pass storeHelper :: Remote -> DavUrl -> DavUser -> DavPass -> L.ByteString -> IO Bool |