diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-28 14:18:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-28 14:35:52 -0400 |
commit | 0f4098e4e8d13dbeb43b12a6de4449795224835e (patch) | |
tree | 7492fdffa4fba1b287cd96159f3d13159d7211cb /Types | |
parent | 094169ce58c798273929d5949576b1e4ccfb8d71 (diff) |
resume interrupted chunked uploads
Leverage the new chunked remotes to automatically resume uploads.
Sort of like rsync, although of course not as efficient since this
needs to start at a chunk boundry.
But, unlike rsync, this method will work for S3, WebDAV, external
special remotes, etc, etc. Only directory special remotes so far,
but many more soon!
This implementation will also allow starting an upload from one repository,
interrupting it, and then resuming the upload to the same remote from
an entirely different repository.
Note that I added a comment that storeKey should atomically move the content
into place once it's all received. This was already an undocumented
requirement -- it's necessary for hasKey to work reliably. This resume code
just uses hasKey to find the first chunk that's missing.
Note that if there are two uploads of the same key to the same chunked remote,
one might resume at the point the other had gotten to, but both will then
redundantly upload. As before.
In the non-resume case, this adds one hasKey call per storeKey, and only
if the remote is configured to use chunks. Future work: Try to eliminate that
hasKey. Notice that eg, `git annex copy --to` checks if the key is present
before sending it, so is already running hasKey.. which could perhaps
be cached and reused.
However, this additional overhead is not very large compared with
transferring an entire large file, and the ability to resume
is certianly worth it. There is an optimisation in place for small files,
that avoids trying to resume if the whole file fits within one chunk.
This commit was sponsored by Georg Bauer.
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Remote.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Types/Remote.hs b/Types/Remote.hs index 9c2a69eff..805b98474 100644 --- a/Types/Remote.hs +++ b/Types/Remote.hs @@ -57,6 +57,8 @@ data RemoteA a = Remote { -- Remotes have a use cost; higher is more expensive cost :: Cost, -- Transfers a key's contents from disk to the remote. + -- The key should not appear to be present on the remote until + -- all of its contents have been transferred. storeKey :: Key -> AssociatedFile -> MeterUpdate -> a Bool, -- Retrieves a key's contents to a file. -- (The MeterUpdate does not need to be used if it retrieves |