Commit graph

95 commits

Author SHA1 Message Date
Joey Hess
f78ca9bc58 split out daemonstatus types 2012-10-30 14:11:14 -04:00
Joey Hess
d5a5c05a79 tweak 2012-10-29 17:02:50 -04:00
Joey Hess
e18b733c81 move alert display functions 2012-10-29 16:34:11 -04:00
Joey Hess
4dbdc2b666 Assistant monad, stage 2.5
Converted several threads to run in the monad.

Added a lot of useful combinators for working with the monad.

Now the monad includes the name of the thread.

Some debugging messages are disabled pending converting other threads.
2012-10-29 02:21:04 -04:00
Joey Hess
6ea6a2e71c better variable name 2012-10-14 14:50:03 -04:00
Joey Hess
0b266f970f set/unset annex-sync, rather than annex-ignore
This reserves annex.ignore for repos that should not be visible at all;
repos with syncing disabled are now skipped by the assistant, but are
displayed in the list and can be configured.
2012-10-11 19:22:29 -04:00
Joey Hess
e8188ea611 flip catchDefaultIO 2012-09-17 00:18:07 -04:00
Joey Hess
16cefae7f2 add an alert while a locally initiated pairing request is in progress
Has a button to cancel the request.
2012-09-09 16:24:34 -04:00
Joey Hess
e59b0a1c88 first pass at alert buttons
They work fine. But I had to go to a lot of trouble to get Yesod to render
routes in a pure function. It may instead make more sense to have each
alert have an assocated IO action, and a single route that runs the IO
action of a given alert id. I just wish I'd realized that before the past
several hours of struggling with something Yesod really doesn't want to
allow.
2012-09-08 19:57:15 -04:00
Joey Hess
3dd4b4058f implement pair request broadcasts
Pair requests are sent on all network interfaces, and contain the best
available hostname to use to contact the host on that interface.

Added a pairing in progress page.

Revert "reduce some boilerplate using ghc extensions", because it caused
overlapping instances for Text.
2012-09-08 13:04:19 -04:00
Joey Hess
a00f1d26bc display errors when any named thread crashes 2012-09-06 14:56:04 -04:00
Joey Hess
38a292fd36 preserve bytesComplete when updating a transfer info
Avoids flicker to 0% when resuming a paused transfer.
2012-08-31 13:06:27 -04:00
Joey Hess
4004baafaf fix alterTransferInfo
don't want to stomp over fields other than the ones being changed
2012-08-31 12:14:16 -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
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
271ea49978 add support for readonly remotes
Currently only the web special remote is readonly, but it'd be possible to
also have readonly drives, or other remotes. These are handled in the
assistant by only downloading from them, and never trying to upload to
them.
2012-08-26 15:39:02 -04:00
Joey Hess
4d269db520 don't exclude special remotes from the knownRemotes list used by the assistant
But do exclude them when pushing out changes.
2012-08-26 14:56:56 -04:00
Joey Hess
72e110ce5d avoid requeueing a download from a remote that no longer has a key 2012-08-24 13:08:38 -04:00
Joey Hess
6420fa6c08 remove pointless bracket 2012-08-23 15:48:14 -04:00
Joey Hess
5c3e14649e avoid unnecessary transfer scans when syncing a disconnected remote
Found a very cheap way to determine when a disconnected remote has
diverged, and has new content that needs to be transferred: Piggyback on
the git-annex branch update, which already checks for divergence.

However, this does not check if new content has appeared locally while
disconnected, that should be transferred to the remote.

Also, this does not handle cases where the two git repos are in sync,
but their content syncing has not caught up yet.

This code could have its efficiency improved:

* When multiple remotes are synced, if any one has diverged, they're
  all queued for transfer scans.
* The transfer scanner could be told whether the remote has new content,
  the local repo has new content, or both, and could optimise its scan
  accordingly.
2012-08-22 15:05:57 -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
a76078a78e process group killing
This seems to work pretty well.

Handled the process groups like this:

- git-annex processes started by the assistant for transfers are run in their
  own process groups.
- otherwise, rely on the shell to allocate a process group for git-annex

There is potentially a problem if some other program runs git-annex
directly (not using sh -c) The program and git-annex would then be in
the same process group. If that git-annex starts a transfer and it's
canceled, the program would also get killed. May or may not be a desired
result.

Also, the new updateTransferInfo probably closes a race where it was
possible for the thread id to not be recorded in the transfer info, if
the transfer info file from the transfer process is read first.
2012-08-10 15:52:22 -04:00
Joey Hess
8f1a9ef8b5 added an alert after a file transfer 2012-08-06 17:09:23 -04:00
Joey Hess
b2e359a15d fix kqueue build 2012-07-30 16:32:32 -04:00
Joey Hess
a994130843 implement server-side alert closing
Rather than using bootstrap's client-side closing.
Now closed alerts stay closed.
2012-07-30 14:08:22 -04:00
Joey Hess
8d2667715b prune old filler alerts 2012-07-30 12:21:53 -04:00
Joey Hess
3dce75fb23 make old activiy alerts stay visible
They're updated to show whether the activity succeeded or failed.

This adds several TODOs to the code to fix later.
2012-07-30 02:39:24 -04:00
Joey Hess
d62b157194 better ordering of alerts 2012-07-29 19:05:51 -04:00
Joey Hess
5271d699d2 add alerts to DaemonStatus 2012-07-29 09:35:50 -04:00
Joey Hess
57203e3981 refactor 2012-07-29 08:52:57 -04:00
Joey Hess
e31277d38a send notifications when the TransferQueue is changed
The fun part was making it move things from TransferQueue to currentTransfers
entirely atomically. Which will avoid inconsistent display if the WebApp
renders the current status at just the wrong time. STM to the rescue!
2012-07-28 18:47:24 -04:00
Joey Hess
3cc1885793 move DaemonStatus manipulation out of the Annex monad to IO
I've convinced myself that nothing in DaemonStatus can deadlock,
as it always keepts the TMVar full. That was the only reason it was in the
Annex monad.
2012-07-28 18:02:11 -04:00
Joey Hess
a17fde22fa add a NotificationBroadcaster to DaemonStatus
First use of it is to make the status checkpointer thread block until
there is really a change to the status.
2012-07-28 16:09:34 -04:00
Joey Hess
e4f714d1be pull from newly mounted git remotes 2012-07-22 15:06:18 -04: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
71b5ad8398 wrote transfer thread
finally!
2012-07-05 14:34:20 -06:00
Joey Hess
83c66ccaf8 queue Uploads of newly added files to remotes
Added knownRemotes to DaemonStatus. This list is not entirely trivial to
calculate, and having it here should make it easier to add/remove remotes
on the fly later on. It did require plumbing the daemonstatus through to
some more threads.
2012-07-05 10:21:22 -06:00
Joey Hess
32e5e02e43 added currentTransfers 2012-07-02 16:12:55 -04:00
Joey Hess
38df4ed44f license 2012-06-23 01:20:40 -04:00
Joey Hess
8919c2e4da check for unstaged old symlinks in the sanity checker 2012-06-13 19:25:47 -04:00
Joey Hess
4b9b9b4947 add sanity checker thread
Currently wakes up once a day, and does nothing. :)
2012-06-13 17:54:23 -04:00
Joey Hess
7575c5bb56 tweak 2012-06-13 14:19:21 -04:00
Joey Hess
59a7b3a51a finish daemon status thread 2012-06-13 14:02:40 -04:00
Joey Hess
ff2414427b implement daemon status serialization to a file
Also afterLastDaemonRun, with 10 minute slop to handle majority of clock
skew issues.
2012-06-13 13:35:15 -04:00
Joey Hess
ccc5005245 reorganize 2012-06-13 12:46:39 -04:00