2012-07-05 14:34:20 -06:00
|
|
|
{- git-annex assistant data transferrer thread
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Assistant.Threads.Transferrer where
|
|
|
|
|
2012-07-20 19:29:59 -04:00
|
|
|
import Assistant.Common
|
2012-07-05 14:34:20 -06:00
|
|
|
import Assistant.DaemonStatus
|
|
|
|
import Assistant.TransferQueue
|
2012-07-06 16:39:07 -04:00
|
|
|
import Assistant.TransferSlots
|
2012-08-06 17:09:23 -04:00
|
|
|
import Assistant.Alert
|
2013-04-04 01:48:26 -04:00
|
|
|
import Assistant.Alert.Utility
|
ensure that git-annex branch is pushed after a successful transfer
I now have this topology working:
assistant ---> {bare repo, special remote} <--- assistant
And, I think, also this one:
+----------- bare repo --------+
v v
assistant ---> special remote <--- assistant
While before with assistant <---> assistant connections, both sides got
location info updated after a transfer, in this topology, the bare repo
*might* get its location info updated, but the other assistant has no way to
know that it did. And a special remote doesn't record location info,
so transfers to it won't propigate out location log changes at all.
So, for these to work, after a transfer succeeds, the git-annex branch
needs to be pushed. This is done by recording a synthetic commit has
occurred, which lets the pusher handle pushing out the change (which will
include actually committing any still journalled changes to the git-annex
branch).
Of course, this means rather a lot more syncing action than happened
before. At least the pusher bundles together very close together pushes,
somewhat. Currently it just waits 2 seconds between each push.
2012-10-28 16:05:34 -04:00
|
|
|
import Assistant.Commits
|
2012-11-24 16:30:15 -04:00
|
|
|
import Assistant.Drop
|
2013-03-19 18:46:29 -04:00
|
|
|
import Assistant.TransferrerPool
|
2012-07-05 14:34:20 -06:00
|
|
|
import Logs.Transfer
|
2012-07-07 10:50:20 -06:00
|
|
|
import Logs.Location
|
2012-07-05 14:34:20 -06:00
|
|
|
import Annex.Content
|
2012-07-07 10:50:20 -06:00
|
|
|
import qualified Remote
|
2013-03-18 20:34:56 -04:00
|
|
|
import qualified Types.Remote as Remote
|
|
|
|
import qualified Git
|
2013-04-23 11:38:52 -04:00
|
|
|
import Config.Files
|
2013-03-01 16:46:36 -04:00
|
|
|
import Assistant.Threads.TransferWatcher
|
2013-03-13 13:36:02 -04:00
|
|
|
import Annex.Wanted
|
2012-07-05 14:34:20 -06:00
|
|
|
|
2012-07-05 18:57:06 -06:00
|
|
|
{- Dispatches transfers from the queue. -}
|
2012-10-29 14:07:12 -04:00
|
|
|
transfererThread :: NamedThread
|
2013-01-26 17:09:33 +11:00
|
|
|
transfererThread = namedThread "Transferrer" $ do
|
2012-10-29 14:07:12 -04:00
|
|
|
program <- liftIO readProgramFile
|
2013-03-19 18:46:29 -04:00
|
|
|
forever $ inTransferSlot program $
|
2013-10-02 22:59:07 -04:00
|
|
|
maybe (return Nothing) (uncurry genTransfer)
|
2012-10-30 17:14:26 -04:00
|
|
|
=<< getNextTransfer notrunning
|
2012-10-29 14:07:12 -04:00
|
|
|
where
|
|
|
|
{- Skip transfers that are already running. -}
|
|
|
|
notrunning = isNothing . startedTime
|