Commit graph

452 commits

Author SHA1 Message Date
Joey Hess
c78975babb avoid duplicate code with a more generic monadic matcher
Interesting type signature ghc derived for this:
forall o (m :: * -> *). Monad m => Matcher o -> (o -> m Bool) -> m Bool
2012-10-13 15:17:15 -04:00
Joey Hess
7aef34f501 implement saving of repository settings 2012-10-10 19:13:49 -04:00
Joey Hess
4e2e08b45a ui for selecting a repository group 2012-10-10 16:23:41 -04:00
Joey Hess
39be7eea40 add standard group selector to repo edit form 2012-10-10 16:04:28 -04:00
Joey Hess
9da7dd8874 webapp: configure new repos to use the standard preferred content settings 2012-10-10 15:35:10 -04:00
Joey Hess
3490977d97 webapp: put new repos in standard groups
I'm using transfer for most things, both removable drives and cloud
storage, because it's the safest choice. We'll see if it makes sense
to prompt for the group when setting this up, or let the user pick
something else after the fact.
2012-10-10 15:27:25 -04:00
Joey Hess
f9b81c7a75 refactor 2012-10-10 15:15:56 -04:00
Joey Hess
0c88d9395d standard preferred content settings for client, transfer, backup, and archive repositories
I've designed these to work well together, I hope. If I get it wrong,
I can just change the code in one place, since these expressions
won't be stored in the git-annex branch.
2012-10-10 13:54:40 -04:00
Joey Hess
b6ce003843 rename --ingroup to --inallgroup 2012-10-10 12:59:45 -04:00
Joey Hess
e375b931c0 add --ingroup limit 2012-10-08 15:18:58 -04:00
Joey Hess
7cd81bd978 Added --smallerthan and --largerthan limits 2012-10-08 13:39:18 -04:00
Joey Hess
71fd18a97f wired preferred content up to get, copy, and drop --auto 2012-10-08 13:16:53 -04:00
Joey Hess
7bb4d507ba add AssumeNotPresent parameter to limits
Solves the issue with preferred content expressions and dropping that
I mentioned yesterday. My solution was to add a parameter to specify a set
of repositories where content should be assumed not to be present. When
deciding whether to drop, it can put the current repository in, and then
if the expression fails to match, the content can be dropped.

Using yesterday's example "(not copies=trusted:2) and (not in=usbdrive)",
when the local repo is one of the 2 trusted copies, the drop check will
see only 1 trusted copy, so the expression matches, and so the content will
not be dropped.
2012-10-05 16:52:44 -04:00
Joey Hess
bc649a35ba added preferred-content log, and allow editing it with vicfg
This includes a full parser for the boolean expressions in the log,
that compiles them into Matchers. Those matchers are not used yet.

A complication is that matching against an expression should never
crash git-annex with an error. Instead, vicfg checks that the expressions
parse. If a bad expression (or an expression understood by some future
git-annex version) gets into the log, it'll be ignored.

Most of the code in Limit couldn't fail anyway, but I did have to make
limitCopies check its parameter first, and return an error if it's bad,
rather than erroring at runtime.
2012-10-04 16:00:19 -04:00
Joey Hess
7a7f63182c vicfg: New command, allows editing (or simply viewing) most of the repository configuration settings stored in the git-annex branch.
Incomplete; I need to finish parsing and saving. This will also be used
for editing transfer control expresssions.

Removed the group display from the status output, I didn't really
like that format, and vicfg can be used to see as well as edit rempository
group membership.
2012-10-03 17:04:52 -04:00
Joey Hess
717e008390 status: display repository groups 2012-10-02 13:45:30 -04:00
Joey Hess
5bd5bc094a simplify 2012-10-01 15:17:21 -04:00
Joey Hess
2a96b1aab3 group, ungroup: New commands to indicate groups of repositories. 2012-10-01 15:12:04 -04:00
Joey Hess
3887432c54 fixes for transfer resume
Fix resuming of downloads, which do not have a transfer info file to read.

When checking upload progress, use the MVar, rather than re-reading
the info file.

Catch exceptions in the transfer action. Required a tryAnnex.
2012-09-24 13:18:16 -04:00
Joey Hess
d77ff5dadd changelog and minor cleanup to fix mixed spaces/tabs 2012-09-23 15:42:05 -04:00
Joey Hess
0732d4c8ef Merge remote-tracking branch 'npouillard/trustedcopies' 2012-09-23 15:35:00 -04:00
Nicolas Pouillard
f0bcc77fb2 Limiting the number of copies per trustlevel
The --copies flag now takes an argument of the form:
  trustlevel:number or number

If a trust level is specified the command is limited to files
with at least 'number' copies of this 'trustlevel'.
2012-09-23 19:57:21 +02:00
Joey Hess
df07ccf404 make the assistant retry failed transfers
When a transfer fails, the progress info can be used to intelligently
retry it. If the transfer managed to make some progress, but did not
fully complete, then there's a good chance that a retry will finish it
(or at least make more progress).
2012-09-23 13:27:13 -04:00
Joey Hess
77af38ec6c git-annex-shell transferinfo command
TODO: Use this when running sendkey, to feed back transfer info from the
client side rsync.
2012-09-21 16:23:25 -04:00
Joey Hess
34ca1d698c avoid updating transfer info file until another 1% of the total has been transferred 2012-09-21 15:11:45 -04:00
Joey Hess
226781c047 unify types 2012-09-21 14:50:14 -04:00
Joey Hess
06ed6ceac4 fix reading of transfer info files with a bytesComplete value 2012-09-20 16:40:48 -04:00
Joey Hess
aff09a1f33 add a progress callback to storeKey, and threaded it all the way through
Transfer info files are updated when the callback is called, updating
the number of bytes transferred.

Left unused p variables at every place the callback should be used.
Which is rather a lot..
2012-09-19 16:08:37 -04:00
Joey Hess
18bae020ed make other repositories list list all autostarted repos
And add a form to add another, unrelated repository
2012-09-18 17:50:07 -04:00
Joey Hess
7a86dc9443 cleanup 2012-09-17 14:58:43 -04:00
Joey Hess
e8188ea611 flip catchDefaultIO 2012-09-17 00:18:07 -04:00
Joey Hess
0b12db64d8 Avoid crashing on encoding errors in filenames when writing transfer info files and reading from checksum commands. 2012-09-16 01:53:06 -04:00
Joey Hess
476d36ed16 stupid typo 2012-08-29 15:32:57 -04:00
Joey Hess
99525f8454 when canceling a transfer, also cancel all other downloads of the same key 2012-08-29 15:24:09 -04:00
Joey Hess
93037580b6 fix resume button
Change alterTransferInfo to not merge in old values, including
transferPaused.
2012-08-29 14:14:57 -04:00
Joey Hess
19e8f1ca0e don't show "unknown" as the percent complete for transferinfo with no bytesComplete value 2012-08-28 14:31:30 -04:00
Joey Hess
1296cfb09a avoid possibly re-adding a removed transfer when updating its info
Doesn't fix the bug I thought it'd fix, but is clearly correct.
2012-08-28 14:19:11 -04:00
Joey Hess
ab5e409a95 keep track of which remotes have been scanned in process state
Since it turned out to make sense to always scan all remotes on startup,
there's no need to persist the info about which have been scanned.
2012-08-24 15:52:23 -04:00
Joey Hess
715a9a2f8e keep logs of failed transfers, and requeue them when doing a non-full scan
of a remote
2012-08-23 15:24:15 -04:00
Joey Hess
487bdf0e24 add transfer scanned flag files 2012-08-23 13:42:26 -04:00
Joey Hess
8ba9830653 implement pausing of transfers
A paused transfer's thread keeps running, keeping the slot in use.
This is intentional; pausing a transfer should not let other
queued transfers to run in its place.
2012-08-10 18:42:44 -04:00
Joey Hess
94fcd0cf59 add routes to pause/start/cancel transfers
This commit includes a paydown on technical debt incurred two years ago,
when I didn't know that it was bad to make custom Read and Show instances
for types. As the routes need Read and Show for Transfer, which includes a
Key, and deriving my own Read instance of key was not practical,
I had to finally clean that up.

So the compact Key read and show functions are now file2key and key2file,
and Read and Show are now derived instances.

Changed all code that used the old instances, compiler checked.
(There were a few places, particularly in Command.Unused, and the test
suite where the Show instance continue to be used for legitimate
comparisons; ie show key_x == show key_y (though really in a bloom filter))
2012-08-08 16:20:24 -04:00
Joey Hess
7e2d07484f Merge branch 'master' into assistant 2012-08-07 13:31:43 -04:00
Joey Hess
2a9077f4e9 fix transfer log cleanup crash
Avoid crashing when "git annex get" fails to download from one location,
and falls back to downloading from a second location.

The problem is that git annex get calls download recursively from within
itself if the first download attempt fails. So the first time through, it
writes a transfer info file, which is then overwritten on the second,
recursive call. Then on cleanup, it tries to delete the file twice, which
of course doesn't work.

Fixed both by not crashing if the transfer file is removed, and by
changing Get to not run download recursively like that. It's the only
thing that did so, and it just seems like a bad idea.
2012-08-07 13:30:08 -04:00
Joey Hess
0f6292920a webapp now displays the real running and queued transfers
yowza!!!
2012-07-27 11:47:34 -04:00
Joey Hess
21d35f88d8 pull in transfer log code from assistant branch
New log file format.
2012-07-18 21:45:41 -04:00
Joey Hess
549f861999 fix parsing of startedTime 2012-07-18 20:48:08 -04:00
Joey Hess
cf47bb3f50 run file transfers in threads, not processes
This should fix OSX/BSD issues with not noticing transfer information
files with kqueue. Now that threads are used, the thread can manage the
transfer slot allocation and deallocation by itself; much cleaner.
2012-07-18 19:15:34 -04:00
Joey Hess
eea0a3616c add thread id field to transferinfo
Also converted its timestand to posix seconds, like is used in the other
log files.
2012-07-18 18:42:41 -04:00
Joey Hess
d53f70e203 avoid parsing lock files as transfer files
This seems to happen with kqueue, not inotify. The newly added lck file
triggers an add event and was then parsed as a transfer file.
2012-07-17 17:26:53 -04:00
Joey Hess
b702bae950 bugfix 2012-07-17 17:22:00 -04:00
Joey Hess
9ab9ef3ebd change transfer lock filenames to avoid ambiguity
foo.lck could be a lock file for a transfer of foo, or a transfer of a key
that happened to end in ".lck". Fix this by using "lck.foo" instead.
2012-07-17 17:16:30 -04:00
Joey Hess
9379c77fb3 split transfer info and lock files
Since the lock file has to be kept open, this prevented the TransferWatcher
from noticing when it appeared, since inotify (and more importantly kqueue)
events happen when a new file is closed. Writing a separate info file fixes
that problem.
2012-07-07 11:47:36 -06:00
Joey Hess
62876502c5 wait on child transfer processes, and invalidate cache
There's still a bug; if the child updates its transfer info file,
then the data from it will superscede the TransferInfo, losing the
info that we should wait on this child.
2012-07-06 16:44:13 -06:00
Joey Hess
a92f5589fc unfinished (and unbuildable) work toward separate transfer processes 2012-07-05 18:57:06 -06:00
Joey Hess
71b5ad8398 wrote transfer thread
finally!
2012-07-05 14:34:20 -06:00
Joey Hess
4845b59413 startedTime needs to be a Maybe to handle transfers that have not started yet
This changes the file format.
2012-07-02 16:17:06 -04:00
Joey Hess
c9d7e9f6bd startedTime needs to be a Maybe to handle transfers that have not started yet
This changes the file format.
2012-07-02 16:06:52 -04:00
Joey Hess
0c0fd0c54c update 2012-07-02 13:49:27 -04:00
Joey Hess
8f6c2e6081 fix reading of empty filename from transfer info file 2012-07-02 11:02:47 -04:00
Joey Hess
9517fbb948 cleanup 2012-07-02 08:35:15 -04:00
Joey Hess
bea0ac0274 record transfers for git-annex-shell
Not yet tested and places git-annex-shell is run need to be modified to
pass the new field settings.

Note that rsyncServerSend was changed to fork, rather than directly exec
rsync, because it needs to keep the transfer lock held, and clean up the
transfer log when done.
2012-07-02 01:31:10 -04:00
Joey Hess
7225c2bfc0 record transfer information on local git remotes
In order to record a semi-useful filename associated with the key,
this required plumbing the filename all the way through to the remotes'
storeKey and retrieveKeyFile.

Note that there is potential for deadlock here, narrowly avoided.
Suppose the repos are A and B. A sends file foo to B, and at the same
time, B gets file foo from A. So, A locks its upload transfer info file,
and then locks B's download transfer info file. At the same time,
B is taking the two locks in the opposite order. This is only not a
deadlock because the lock code does not wait, and aborts. So one of A or
B's transfers will be aborted and the other transfer will continue.
Whew!
2012-07-01 17:15:11 -04:00
Joey Hess
8c10f37714 bugfixes
fdToHandle seems to close the fd

avoid excess trailing newline
2012-07-01 17:15:11 -04:00
Joey Hess
72988bae34 tested; bugfixes 2012-07-01 17:15:11 -04:00
Joey Hess
be0e38bcc3 add transfer information files 2012-07-01 17:15:11 -04:00
Joey Hess
29335bf326 pointlessness 2012-06-29 10:00:05 -04:00
Joey Hess
8c09c17f6b use strict insertWith 2012-05-04 00:44:11 -04:00
Joey Hess
32de288c35 syntax tweaks
Although I hate to lose one of the only places I've ever used the list monad..
2012-05-02 19:51:41 -04:00
Joey Hess
392931eca9 addunused: New command, the opposite of dropunused, it relinks unused content into the git repository. 2012-05-02 14:59:05 -04:00
Joey Hess
ed79596b75 noop 2012-04-21 23:32:33 -04:00
Joey Hess
184a69171d removed another 10 lines via ifM 2012-03-16 01:59:07 -04:00
Joey Hess
7e17151e69 revert hlint change
broke a test
2012-02-20 15:37:31 -04:00
Joey Hess
0cbbf0da79 warning 2012-02-18 11:54:47 -04:00
Joey Hess
0fada43808 avoid unnecessary log changes when re-adding the same url 2012-02-17 23:58:56 -04:00
Joey Hess
5bf07b3b5c Store web special remote url info in a more efficient location.
storing it in remotes/web/xx/yy/foo.log meant lots of extra directory
objects in git. Now I use xx/yy/foo.log.web, which is just as unique, but
more efficient since foo.log is there anyway.

Of course, it still looks in the old location too.
2012-02-17 23:15:29 -04:00
Joey Hess
a1e52f0ce5 hlint 2012-02-16 00:44:51 -04:00
Joey Hess
abdacf58ed tweaks 2012-01-11 00:06:54 -04:00
Joey Hess
07cacbeee9 break module dependancy loop
A PITA but worth it to clean up the trust configuration code.
2012-01-10 13:32:38 -04:00
Joey Hess
0d5c402210 Add annex-trustlevel configuration settings, which can be used to override the trust level of a remote.
This overrides the trust.log, and is overridden by the command-line trust
parameters.

It would have been nicer to have Logs.Trust.trustMap just look up the
configuration for all remotes, but a dependency loop prevented that
(Remotes depends on Logs.Trust in several ways). So instead, look up
the configuration when building remotes, storing it in the same forcetrust
field used for the command-line trust parameters.
2012-01-09 23:31:44 -04:00
Joey Hess
a3a9f87047 log: New command that displays the location log for file, showing each repository they were added to and removed from.
This needs to run git log on the location log files to get at all past
versions of the file, which tends to be a bit slow.

It would be possible to make a version optimised for showing the location
logs for every key. That would only need to run git log once, so would be
faster, but it would need to process an enormous amount of data, so
would not speed up the individual file case.

In the future it would be nice to support log --format. log --json also
doesn't work right yet.
2012-01-06 15:40:07 -04:00
Joey Hess
95d2391f58 more partial function removal
Left a few Prelude.head's in where it was checked not null and too hard to
remove, etc.
2011-12-15 18:19:36 -04:00
Joey Hess
b7e0d39abb remove some partial functions
A few were too hard to get rid of, and safe since the code
does check for an empty line.
2011-12-15 16:59:48 -04:00
Joey Hess
d64132a43a hslint 2011-12-09 01:57:13 -04:00
Joey Hess
f0cc42685e fix display of dead repositories in status 2011-12-02 19:21:56 -04:00
Joey Hess
251c01d51e dead: A command which says that a repository is gone for good and you don't want git-annex to mention it again. 2011-12-02 16:59:55 -04:00
Mark Wright
041d324125 Remove haskell98 to build with ghc 7.2.2, also built with ghc 7.0.4
Signed-off-by: Joey Hess <joey@kitenet.net>
2011-11-26 12:05:08 -04:00
Joey Hess
c50a5fbeb4 status: Include all special remotes in the list of repositories.
Special remotes do not always have a description listed in uuid.log,
and such ones were not listed before.
2011-11-18 13:22:48 -04:00
Joey Hess
2bb6b02948 When not run in a git repository, git-annex can still display a usage message, and "git annex version" even works.
Things that sound simple, but are made hard by the Annex monad being built
with the assumption that there will always be a git repo.
2011-11-16 00:49:09 -04:00
Joey Hess
9b71b5f26c fix display of semitrusted repos in status
semitrusted uuids rarely are listed in trust.log, so a special case
is needed to get a list of them. Take the difference of all known uuids
with non-semitrusted uuids.
2011-11-16 00:01:07 -04:00
Joey Hess
826d5887b2 Automatically fix up badly formatted uuid.log entries produced by 3.20111105, whenever the uuid.log is changed (ie, by init or describe). 2011-11-11 13:42:31 -04:00
Joey Hess
637b5feb45 lint 2011-11-11 01:52:58 -04:00
Joey Hess
56b8194470 cleanup 2011-11-09 01:33:20 -04:00
Joey Hess
b11a63a860 clean up read/show abuse
Avoid ever using read to parse a non-haskell formatted input string.

show :: Key is arguably still show abuse, but displaying Keys as filenames
is just too useful to give up.
2011-11-08 00:17:54 -04:00
Joey Hess
63a292324d add a UUID type
Should have done this a long time ago.
2011-11-07 15:59:16 -04:00
Joey Hess
eec137f33a Record uuid when auto-initializing a remote so it shows in status. 2011-11-02 14:18:21 -04:00
Joey Hess
2566eb85fe fsck: Now works in bare repositories.
Checks location log information, and file contents.

Does not check that numcopies is satisfied, as .gitattributes information
about numcopies is not available in a bare repository. In practice, that
should not be a problem, since fsck is also run in a checkout and will
check numcopies there.
2011-10-29 18:03:28 -04:00
Joey Hess
ab738a403a status: Now always shows the current repository, even when it does not appear in uuid.log. 2011-10-28 19:49:01 -04:00
Joey Hess
ee9af605bc break out non-log stuff to separate module 2011-10-15 17:47:03 -04:00
Joey Hess
ec169f84b1 migrate: Copy url logs for keys when migrating. 2011-10-15 16:36:56 -04:00
Joey Hess
b4015064e1 break web log handling into a separate module 2011-10-15 16:25:51 -04:00
Joey Hess
1a29b5b52e reorganize log modules
no code changes
2011-10-15 16:21:08 -04:00