4ac2fd0a22
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.
31 lines
730 B
Haskell
31 lines
730 B
Haskell
{- git-annex assistant commit tracking
|
|
-
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Assistant.Commits where
|
|
|
|
import Utility.TSet
|
|
|
|
type CommitChan = TSet Commit
|
|
|
|
data Commit = Commit
|
|
|
|
newCommitChan :: IO CommitChan
|
|
newCommitChan = newTSet
|
|
|
|
{- Gets all unhandled commits.
|
|
- Blocks until at least one commit is made. -}
|
|
getCommits :: CommitChan -> IO [Commit]
|
|
getCommits = getTSet
|
|
|
|
{- Puts unhandled commits back into the channel.
|
|
- Note: Original order is not preserved. -}
|
|
refillCommits :: CommitChan -> [Commit] -> IO ()
|
|
refillCommits = putTSet
|
|
|
|
{- Records a commit in the channel. -}
|
|
recordCommit :: CommitChan -> IO ()
|
|
recordCommit = flip putTSet1 Commit
|