summaryrefslogtreecommitdiff
path: root/Remote/S3.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-09 18:42:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-09 18:42:29 -0400
commit0c893f8743bab81077e3ee0fed0993b746d7a269 (patch)
treeb3ddc0665c28fadbfac58fbc43fc8a9dc85f3956 /Remote/S3.hs
parent680e6839ee42c754a58f8e57bf15a8063a16c6bb (diff)
Special remotes now all rollback storage of keys that get modified during the transfer, which can happen in direct mode.
Diffstat (limited to 'Remote/S3.hs')
-rw-r--r--Remote/S3.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index 7f1928608..1d24c4938 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -112,15 +112,16 @@ s3Setup u c = handlehost $ M.lookup "host" c
M.delete "bucket" defaults
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
-store r k _f p = s3Action r False $ \(conn, bucket) -> sendAnnex k $ \src -> do
- res <- storeHelper (conn, bucket) r k p src
- s3Bool res
+store r k _f p = s3Action r False $ \(conn, bucket) ->
+ sendAnnex k (void $ remove r k) $ \src -> do
+ res <- storeHelper (conn, bucket) r k p src
+ s3Bool res
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
storeEncrypted r (cipher, enck) k p = s3Action r False $ \(conn, bucket) ->
-- To get file size of the encrypted content, have to use a temp file.
-- (An alternative would be chunking to to a constant size.)
- withTmp enck $ \tmp -> sendAnnex k $ \src -> do
+ withTmp enck $ \tmp -> sendAnnex k (void $ remove r enck) $ \src -> do
liftIO $ encrypt cipher (feedFile src) $
readBytes $ L.writeFile tmp
res <- storeHelper (conn, bucket) r enck p tmp