Commit graph

51 commits

Author SHA1 Message Date
Joey Hess
362ed9f0e3 use DList for the transfer queue
Some nice efficiency gains here for list appending, although mostly
the small size of the transfer queue makes them irrelivant.
2013-04-25 01:33:44 -04:00
Joey Hess
c6da464051 use a DList for the deferred downloads queue 2013-04-25 01:26:23 -04:00
Joey Hess
69a80a9a4d avoid queuing transfers that are currently running 2013-04-02 16:17:06 -04:00
Joey Hess
1f4fe92f61 avoid queuing transfer that is already queued, with a different associated file 2013-04-02 16:04:49 -04:00
Joey Hess
0f6a6f2a8b avoid queueing uploads to remotes that already have the content 2013-04-02 15:51:58 -04:00
Joey Hess
60760cb430 tweak 2013-03-13 13:11:49 -04:00
Joey Hess
99989bcc8e logic error 2013-03-07 14:08:50 -04:00
Joey Hess
265e440d22 avoid queuing transfers that are already queued
I saw this happen in real life, when syncing to a newly added usb drive.
I think it got scanned twice, and files were doubled in the queue.

This could be optimised a little bit more, to only read from the mvar
once, rather than twice.
2013-03-07 12:35:42 -04:00
Joey Hess
46c9cbeb1e add additional debug info about reasons for transfers 2013-03-01 15:23:59 -04:00
Joey Hess
99a8a5297c --auto fixes
* get/copy --auto: Transfer data even if it would exceed numcopies,
  when preferred content settings want it.
* drop --auto: Fix dropping content when there are no preferred content
  settings.
2012-12-06 13:22:16 -04:00
Joey Hess
5e44ab177c don't try to transfer data to/from XMPP remotes
Partition syncRemotes into ones needing git sync (ie, non-special remotes),
and ones needing data sync (ie, non-XMPP remotes).
2012-11-11 16:23:16 -04:00
Joey Hess
93ffd47d76 finished pushing Assistant monad into all relevant files
All temporary and old functions are removed.
2012-10-30 17:14:51 -04:00
Joey Hess
47d94eb9a4 pushed Assistant monad down into DaemonStatus code
Currently have three old versions of functions that more reworking is
needed to remove: getDaemonStatusOld, modifyDaemonStatusOld_, and
modifyDaemonStatusOld
2012-10-30 15:39:15 -04:00
Joey Hess
ea8df8fe9f cleanup daemonStatus accessors 2012-10-30 14:44:18 -04:00
Joey Hess
68118b8986 split remaining assistant types 2012-10-30 14:34:48 -04:00
Joey Hess
f78ca9bc58 split out daemonstatus types 2012-10-30 14:11:14 -04:00
Joey Hess
6144f325b9 reorder
get list of remotes after, rather than before, a potentially blocking action
2012-10-14 15:09:37 -04:00
Joey Hess
6ea6a2e71c better variable name 2012-10-14 14:50:03 -04:00
Joey Hess
5ac15149cc assistant: Now honors preferred content settings when deciding what to transfer.
Both when queueing downloads, and uploads, consults the preferred content
settings.

I didn't make it check yet when requeing failed transfers or queuing
deferred downloads; dealing with the preferred content settings (or indeed,
other settings) changing while the assistant is running still needs work.
2012-10-09 12:18:41 -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
9f05d19108 avoid sending uploads right back to where the download came from
Just an optimisation.
2012-09-18 14:24:51 -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
8335a7ff7a remove the TChan component from the data structure
The code to maintain that TChan in parallel with the list was buggy,
the two were not always the same. And all that TChan was needed for was
blocking on the next transfer, which can be accomplished just as well by
checking the size and retrying, thanks to STM.

Also, this is faster, and uses less memory. Total win.
2012-08-31 12:59:00 -04:00
Joey Hess
8d32d54320 make start button work on queued transfers
When multiple downloads of a key are queued, it starts the first, but leaves the
other downloads in the queue. This ensures that we don't lose a queued
download if the one that got started failed.
2012-08-29 16:30:40 -04:00
Joey Hess
c21a9fe04a more generic 2012-08-29 15:56:47 -04:00
Joey Hess
0842e99637 forgot to update the tchan when dequeuing transfers 2012-08-29 15:46:42 -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
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
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
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
21bd92f077 send update notificaton when removing a queued transfer 2012-08-10 16:00:24 -04:00
Joey Hess
20203b45b9 transfer canceling
Should work (untested) for transfers being run by other processes.

Not yet by transfers being run by the assistant. killThread does not
kill processes forked off by a thread. To fix this, will probably
need to make `git annex getkey` and `git annex sendkey` commands that
operate on keys, and write their own transfer info. Then the assistant
can run them, and kill them, as needed.
2012-08-08 17:55:56 -04:00
Joey Hess
ebd8362d58 fix bug in transfer initiation checking
Putting the transfer on the currentTransfers atomically introduced a bug:
It checks to see if the transfer is in progress, and cancels it.

Fixed by moving that check inside the STM transaction.
2012-07-29 13:37:26 -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
0f6292920a webapp now displays the real running and queued transfers
yowza!!!
2012-07-27 11:47:34 -04:00
Joey Hess
95c80b6440 laziness fix
Now scanning runs fully interleaved with transferring.
2012-07-25 14:54:09 -04:00
Joey Hess
2b7f9c8442 fix including of remote in TransferInfo when queueing new transfers 2012-07-25 14:02:50 -04:00
Joey Hess
a9dbfdf28d better transfer queue management
Allow transfers to be added with blocking until the queue is sufficiently
small.

Better control over which end of the queue to add a transfer to.
2012-07-25 13:12:34 -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
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
c34d8ae088 avoid enqueing downloads from remotes that don't have the key 2012-07-17 12:17:01 -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
721748135b fix build (almost) 2012-07-06 14:42:45 -04:00
Joey Hess
71b5ad8398 wrote transfer thread
finally!
2012-07-05 14:34:20 -06:00
Joey Hess
c8135ea0a8 split logic for uploads and downloads 2012-07-05 10:44:07 -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