Commit graph

60 commits

Author SHA1 Message Date
Joey Hess
bcf8a679b4 build fix for non-webapp enabled build 2012-09-23 11:48:09 -04:00
Joey Hess
3a0cffcfed when a Download finishes, queue Uploads
This ensures file propigate takes place in situations such as: Usb drive A
is connected to B. A's master branch is already in sync with B, but it is
being used to sneakernet some files around, so B downloads those. There is no
master branch change, so C does not request these files. B needs to upload
the files it just downloaded on to C, etc.

My first try at this, I saw loops happen. B uploaded to C, which then
tried to upload back to B (because it had not received the updated
git-annex branch from B yet). B already had the file, but it still created
a transfer info file from the incoming transfer, and its watcher saw
that be removed, and tried to upload back to C.

These loops should have been fixed by my previous commit. (They never
affected ssh remotes, only local ones, it seemed.) While C might still try
to upload to B, or to some other remote that already has the file, the
extra work dies out there.
2012-09-18 14:10:33 -04:00
Joey Hess
3c22977e44 deferred downloads
Now when a download is queued and there's no known remote to get it from,
it's added to a deferred download list, which will be retried later.

The Merger thread tries to queue any deferred downloads when it receives
a push to the git-annex branch.

Note that the Merger thread now also forces an update of the git-annex
branch. The assistant was not updating this branch before, and it saw a
(mostly) correct view of state, but now that incoming pushes go to
synced/git-annex, it needs to be merged in.
2012-09-17 21:05:50 -04:00
Joey Hess
df337bb63b hlint 2012-09-13 00:57:52 -04:00
Joey Hess
d19bbd29d8 pairing probably works now (untested) 2012-09-10 21:55:59 -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
0f0c7f8d70 added pair listener thread 2012-09-08 15:07:44 -04:00
Joey Hess
a00f1d26bc display errors when any named thread crashes 2012-09-06 14:56:04 -04:00
Joey Hess
031c44e7d5 fix build without the webapp 2012-08-30 13:29:06 -04:00
Joey Hess
7024a973b2 add download progress polling thread 2012-08-28 14:04:28 -04:00
Joey Hess
5a68acb521 add NetWatcher thread
This deals with interruptions in network connectevity, by listening
for a new network interface coming up (using dbus to see when
network-manager or wicd do it), and forcing a rescan of
2012-08-21 19:58:53 -04:00
Joey Hess
b6b8f6da9c implement resuming of paused transfers
Currently waits for a new transfer slot to open up, which probably needs to
change..
2012-08-12 12:11:20 -04:00
Joey Hess
3add2cd3ba wire up scan and transfer to newly added removable drive
remote setup still todo
2012-08-04 21:18:57 -04:00
Joey Hess
520a0463a7 start webapp thread earlier so it opens ASAP 2012-08-02 09:09:06 -04:00
Joey Hess
bdd5fe4170 fix the watch command to not run the whole assistant
heh :)
2012-08-01 17:01:04 -04:00
Joey Hess
8181b38ef6 write pid file even when running in foreground
This prevents multiple runs of the assistant in the foreground, and lets
--stop stop foregrounded runs too.

The webapp firstrun case also now writes a pid file, once it's made the git
repo to put it in.
2012-08-01 16:30:53 -04:00
Joey Hess
ecc168aba3 implemented firstrun repository creation and redirection to full webapp
Some of the trickiest code I've possibly ever written.
2012-08-01 16:10:26 -04:00
Joey Hess
04794eafc0 webapp now starts up when run not in a git repo 2012-07-31 12:17:31 -04:00
Joey Hess
b2dc8fdb06 add more alerts
Nearly all long-running actions now display an alert.
2012-07-29 17:53:18 -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
02ec8ea012 much better webapp startup of the assistant
This avoids forking another process, avoids polling, fixes a race,
and avoids a rare forkProcess thread hang that I saw once time
when starting the webapp.
2012-07-27 15:33:24 -04:00
Joey Hess
f1f90cb30b add warning when building without the webapp 2012-07-27 12:14:57 -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
77c3bf7f88 update thread list 2012-07-26 21:51:47 -04:00
Joey Hess
1ffef3ad75 git annex webapp now opens a browser to the webapp
Also, starts the assistant if it wasn't already running.
2012-07-25 23:13:01 -04:00
Joey Hess
32d3cffc4c run yesod, and launch webapp on startup 2012-07-25 21:26:13 -04:00
Joey Hess
522f568450 add TransferScanner thread
Efficiently finding transfers that need to be done to get two repos back
in sync seems like an interesting problem.
2012-07-22 23:16:56 -04:00
Joey Hess
b48d7747a3 debugging improvements
add timestamps to debug messages

Add lots of debug output in the assistant's threads.
2012-07-20 19:29:59 -04:00
Joey Hess
833bd24a33 tweak 2012-07-20 12:01:28 -04:00
Joey Hess
f20a40f9d4 MountWatcher thread
Currently only prints mount points when mounts happen.
2012-07-19 13:04:33 -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
cc6f660752 fix transfer slots blocking and refilling when transfers are stopped
There's a bug, if a transfer process notices it needs to do nothing,
it never starts the transfer, so the slot is never freed.
2012-07-06 21:59:45 -06:00
Joey Hess
430ad8ce85 it builds again
Currently nothing waits on transfer processes.

(Second drive of the day fried. Not concentrating very well.)
2012-07-06 16:41:37 -04: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
6af319d8cd enqueue Downloads when new symlinks appear to content we don't have 2012-07-05 10:58:49 -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
b4917bd18f add transfer watching thread
Worked the 1st try!
2012-07-03 10:58:40 -04:00
Joey Hess
247099f628 refactor 2012-06-28 20:01:03 -04:00
Joey Hess
4888c5b042 improve thread termination handling
The reason the DirWatcher had to wait for program termination was because
it used withINotify, so when it finished, its watcher threads were killed.
But since I have two DirWatcher threads now, that was not good, and could
perhaps explain the MVar problem I saw yesterday. In any case, fixed this
part of the code by making the DirWatcher return a handle that can be used
to stop it, and now the main Assistant thread is the only one calling
waitForTermination.
2012-06-28 13:37:03 -04:00
Joey Hess
40f357fdcf tweak 2012-06-28 13:04:02 -04:00
Joey Hess
67c8ef7de2 use a TMVar
SampleMVar won't work; between getting the current value and changing
it, another thread could made a change, which would get lost.

TMVar works well; this update situation is handled by atomic transactions.
2012-06-26 19:21:44 -04:00
Joey Hess
5cfe91f06d add a push retry thread 2012-06-25 16:38:12 -04:00
Joey Hess
0b146f9ecc reorg threads 2012-06-25 16:10:24 -04:00
Joey Hess
e699ce1841 added a merger thread
Wow! I can create a file in repo a, and it instantly* shows up in repo b!

* under 1 second anyway
2012-06-22 17:01:08 -04:00
Joey Hess
28e28bc043 stub syncer thread and commit channel 2012-06-22 14:10:25 -04:00
Joey Hess
3ee44cf8fe add assistant command
like watch, but more magic
2012-06-22 13:04:03 -04:00
Joey Hess
33b914bcf1 pending adds now retried for kqueue
Rethought how to keep track of pending adds that need to be retried later.
The commit thread already run up every second when there are changes,
so let's keep pending adds queued as changes until they're safe to add.

Also, the committer is now smarter about avoiding empty commits when
all the adds are currently unsafe, or in the rare case that an add event
for a symlink is not received in time. It may avoid them entirely.

This seems to work as before for inotify, and is untested for kqueue.

(Actually commit batching seems to be improved for inotify, although I'm
not sure why. I'm seeing only two commits made during large batch
operations, and the first of those is the non-batch mode commit.)
2012-06-20 19:29:53 -04:00
Joey Hess
e0fdfb2e70 maintain set of files pendingAdd
Kqueue needs to remember which files failed to be added due to being open,
and retry them. This commit gets the data in place for such a retry thread.

Broke KeySource out into its own file, and added Eq and Ord instances
so it can be stored in a Set.
2012-06-20 16:31:46 -04:00