Commit graph

20949 commits

Author SHA1 Message Date
Joey Hess
444944c7a9 fix cleanup of FileContents once done when them when retrieving 2014-07-29 20:27:13 -04:00
Joey Hess
53b87a859e 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.
2014-07-29 20:10:14 -04:00
Joey Hess
c0dc134cde support chunking for all external special remotes!
Removing code and at the same time adding great features, including
upload/download resuming.

This commit was sponsored by Romain Lenglet.
2014-07-29 18:50:20 -04:00
Joey Hess
bc9e4697b9 better type for Retriever
Putting a callback in the Retriever type allows for the callback to
remove the retrieved file when it's done with it.

I did not really want to make Retriever be fixed to Annex Bool,
but when I tried to use Annex a, I got into some type of type mess.
2014-07-29 18:41:41 -04:00
Joey Hess
47e522979c allow Retriever action to update the progress meter
Needed for eg, Remote.External.

Generally, any Retriever that stores content in a file is responsible for
updating the meter, while ones that procude a lazy bytestring cannot update
the meter, so are not asked to.
2014-07-29 17:18:49 -04:00
Joey Hess
1d263e1e7e lift types from IO to Annex
Some remotes like External need to run store and retrieve actions in Annex,
not IO. In order to do that lift, I had to dive pretty deep into the
utilities, making Utility.Gpg and Utility.Tmp be partly converted to using
MonadIO, and Control.Monad.Catch for exception handling.

There should be no behavior changes in this commit.

This commit was sponsored by Michael Barabanov.
2014-07-29 16:28:44 -04:00
https://www.google.com/accounts/o8/id?id=AItOawlYGpCG2u-0fVbpQhIDMX_ZfE64E-K2EMI
585d7a84bf 2014-07-29 20:11:30 +00:00
Joey Hess
f5af470875 add ContentSource type, for remotes that act on files rather than ByteStrings
Note that currently nothing cleans up a ContentSource's file, when eg,
retrieving chunks.
2014-07-29 15:16:12 -04:00
Joey Hess
216fdbd6bd fix non-checked hasKeyChunks 2014-07-29 15:07:32 -04:00
Xyem
bb0ddec05d 2014-07-29 15:38:40 +00:00
http://svario.it/gioele
ff9131c93a new wish: add repository name to commit messages 2014-07-29 15:29:30 +00:00
http://svario.it/gioele
53518beb1c new bug: whereis does not work in direct mode 2014-07-29 15:17:09 +00:00
http://svario.it/gioele
2695dfbab5 Added a comment 2014-07-29 14:25:19 +00:00
https://id.koumbit.net/anarcat
bc64ec4880 i hope this is not too silly 2014-07-28 23:02:39 +00:00
https://id.koumbit.net/anarcat
61c31be21e found some files in misctmp 2014-07-28 22:56:14 +00:00
https://id.koumbit.net/anarcat
d6b8d63e16 2014-07-28 22:50:39 +00:00
https://id.koumbit.net/anarcat
9cb01f3a6e 2014-07-28 22:47:54 +00:00
https://id.koumbit.net/anarcat
3a5da63dc3 back from the dead, or not 2014-07-28 22:40:43 +00:00
Joey Hess
68189cc519 Merge branch 'master' of ssh://git-annex.branchable.com 2014-07-28 17:26:29 -04:00
Joey Hess
e184e6c8ca devbog 2014-07-28 17:25:22 -04:00
Joey Hess
b39506d1cf expand to rolling hash based design 2014-07-28 17:11:37 -04:00
https://www.google.com/accounts/o8/id?id=AItOawkftzaCvV7EDKVDfJhsQZ3E1Vn-0db516w
100b44f46b Added a comment: One snag 2014-07-28 19:37:04 +00:00
Joey Hess
2474cf0032 make explicit the implicit requirement that CHECKPRESENT not say a key is present until it's all done being stored 2014-07-28 14:37:22 -04:00
Joey Hess
58f727afdd 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.
2014-07-28 14:35:52 -04:00
Joey Hess
153ace4524 fix handling of removal of keys that are not present 2014-07-28 14:14:01 -04:00
Joey Hess
80cc554c82 add ChunkMethod type and make Logs.Chunk use it, rather than assuming fixed size chunks (so eg, rolling hash chunks can be supported later)
If a newer git-annex starts logging something else in the chunk log, it
won't be used by this version, but it will be preserved when updating the
log.
2014-07-28 13:19:08 -04:00
gernot
955f2ab4c1 2014-07-28 17:16:24 +00:00
Joey Hess
406692c5be Merge branch 'master' of ssh://git-annex.branchable.com 2014-07-28 13:05:19 -04:00
Joey Hess
a33dafae5a Merge branch 'master' of ssh://git-annex.branchable.com into newchunks 2014-07-28 13:03:43 -04:00
Joey Hess
e47182920c chunk log format should be extensible to allow for eg, logging when rolling hash chunks are used 2014-07-28 13:00:46 -04:00
divB
6249c5f30b 2014-07-27 23:16:19 +00:00
divB
b886ed1e25 2014-07-27 23:15:25 +00:00
Joey Hess
6c46a92040 devblog 2014-07-27 19:12:45 -04:00
Joey Hess
9d4a766cd7 resume interrupted chunked downloads
Leverage the new chunked remotes to automatically resume downloads.
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 properly handle starting a download
from one remote, interrupting, and resuming from another one, and so on.

(Resuming interrupted chunked uploads is similarly doable, although
slightly more expensive.)

This commit was sponsored by Thomas Djärv.
2014-07-27 18:56:32 -04:00
Joey Hess
13bbb61a51 add key stability checking interface
Needed for resuming from chunks.

Url keys are considered not stable. I considered treating url keys with a
known size as stable, but just don't feel that is enough information.
2014-07-27 12:33:46 -04:00
Joey Hess
aad8cfe718 use map for faster backend name lookup 2014-07-27 12:24:12 -04:00
Joey Hess
85d17a698d Merge branch 'master' into newchunks
Conflicts:
	doc/design/assistant/chunks.mdwn
2014-07-27 12:24:03 -04:00
Joey Hess
729d38a763 update 2014-07-27 12:23:28 -04:00
Joey Hess
2996f0eb05 use existing chunks even when chunk=0
When chunk=0, always try the unchunked key first. This avoids the overhead
of needing to read the git-annex branch to find the chunkcount.

However, if the unchunked key is not present, go on and try the chunks.

Also, when removing a chunked key, update the chunkcounts even when
chunk=0.
2014-07-27 02:13:51 -04:00
Joey Hess
7afb057d60 reorg 2014-07-27 01:24:34 -04:00
Joey Hess
bffd0e34b3 comment typo 2014-07-27 01:22:51 -04:00
Joey Hess
c3af4897c0 faster storeChunks
No need to process each L.ByteString chunk, instead ask it to split.

Doesn't seem to have really sped things up much, but it also made the code
simpler.

Note that this does (and already did) buffer in memory. It seems that only
the directory special remote could take advantage of streaming chunks to
files w/o buffering, so probably won't add an interface to allow for that.
2014-07-27 01:18:38 -04:00
Joey Hess
f3e47b16a5 better Preparer interface
This will allow things like WebDAV to opean a single persistent connection
and reuse it for all the chunked data.

The crazy types allow for some nice code reuse.
2014-07-27 00:30:04 -04:00
Joey Hess
7db60269eb update does for chunking 2014-07-26 23:39:51 -04:00
Joey Hess
9a8c4bb21f improve exception handling
Push it down from needing to be done in every Storer,
to being checked once inside ChunkedEncryptable.

Also, catch exceptions from PrepareStorer and PrepareRetriever,
just in case..
2014-07-26 23:26:10 -04:00
Joey Hess
7496355031 add some more exception handling primitives 2014-07-26 23:24:27 -04:00
Joey Hess
867fd116a7 better exception display 2014-07-26 23:01:44 -04:00
Joey Hess
0d89b65bfc fix key checking when a directory special remote's directory is missing
The best thing to do in this case is return Left, so that anything that
tries to access it will fail.
2014-07-26 22:52:47 -04:00
Joey Hess
93be3296fc fix another fallback bug 2014-07-26 22:47:52 -04:00
Joey Hess
86e8532c0a allM has slightly better memory use 2014-07-26 22:34:40 -04:00