diff options
author | Joey Hess <joey@kitenet.net> | 2013-05-22 13:10:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-05-22 13:10:54 -0400 |
commit | dcbb9c33d5e82beb32a1068924f467d968ce9611 (patch) | |
tree | 3038293eca50007fb9c6c074ebd2aba6ae4640ec /Assistant.hs | |
parent | cd44bfb832996c68d80697c0711db402ffa4334e (diff) |
remove overview of threads an mvars
has become too long to be useful, and I find I don't need it anymore
to keep things straight
Diffstat (limited to 'Assistant.hs')
-rw-r--r-- | Assistant.hs | 114 |
1 files changed, 1 insertions, 113 deletions
diff --git a/Assistant.hs b/Assistant.hs index b5e902d56..36fef049d 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -1,120 +1,8 @@ {- git-annex assistant daemon - - - Copyright 2012 Joey Hess <joey@kitenet.net> + - Copyright 2012-2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. - - - - Overview of threads and MVars, etc: - - - - Thread 1: parent - - The initial thread run, double forks to background, starts other - - threads, and then stops, waiting for them to terminate, - - or for a ctrl-c. - - Thread 2: Watcher - - Notices new files, and calls handlers for events, queuing changes. - - Thread 3: inotify internal - - Used by haskell inotify library to ensure inotify event buffer is - - kept drained. - - Thread 4: inotify startup scanner - - Scans the tree and registers inotify watches for each directory. - - A MVar lock is used to prevent other inotify handlers from running - - until this is complete. - - Thread 5: Committer - - Waits for changes to occur, and runs the git queue to update its - - index, then commits. Also queues Transfer events to send added - - files to other remotes. - - Thread 6: Pusher - - Waits for commits to be made, and pushes updated branches to remotes, - - in parallel. (Forks a process for each git push.) - - Thread 7: PushRetryer - - Runs every 30 minutes when there are failed pushes, and retries - - them. - - Thread 8: Merger - - Waits for pushes to be received from remotes, and merges the - - updated branches into the current branch. - - (This uses inotify on .git/refs/heads, so there are additional - - inotify threads associated with it, too.) - - Thread 9: TransferWatcher - - Watches for transfer information files being created and removed, - - and maintains the DaemonStatus currentTransfers map. - - (This uses inotify on .git/annex/transfer/, so there are - - additional inotify threads associated with it, too.) - - Thread 10: TransferPoller - - Polls to determine how much of each ongoing transfer is complete. - - Thread 11: Transferrer - - Waits for Transfers to be queued and does them. - - Thread 12: StatusLogger - - Wakes up periodically and records the daemon's status to disk. - - Thread 13: SanityChecker - - Wakes up periodically (rarely) and does sanity checks. - - Thread 14: MountWatcher - - Either uses dbus to watch for drive mount events, or, when - - there's no dbus, polls to find newly mounted filesystems. - - Once a filesystem that contains a remote is mounted, updates - - state about that remote, pulls from it, and queues a push to it, - - as well as an update, and queues it onto the - - ConnectedRemoteChan - - Thread 15: NetWatcher - - Deals with network connection interruptions, which would cause - - transfers to fail, and can be recovered from by waiting for a - - network connection, and syncing with all network remotes. - - Uses dbus to watch for network connections, or when dbus - - cannot be used, assumes there's been one every 30 minutes. - - Thread 16: TransferScanner - - Does potentially expensive checks to find data that needs to be - - transferred from or to remotes, and queues Transfers. - - Uses the ScanRemotes map.a - - Thread 17: PairListener - - Listens for incoming pairing traffic, and takes action. - - Thread 18: ConfigMonitor - - Triggered by changes to the git-annex branch, checks for changed - - config files, and reloads configs. - - Thread 19: XMPPClient - - Built-in XMPP client. - - Thread 20: WebApp - - Spawns more threads as necessary to handle clients. - - Displays the DaemonStatus. - - Thread 21: Glacier - - Deals with retrieving files from Amazon Glacier. - - - - ThreadState: (MVar) - - The Annex state is stored here, which allows resuscitating the - - Annex monad in IO actions run by the watcher and committer - - threads. Thus, a single state is shared amoung the threads, and - - only one at a time can access it. - - DaemonStatusHandle: (STM TMVar) - - The daemon's current status. - - ChangeChan: (STM TChan) - - Changes are indicated by writing to this channel. The committer - - reads from it. - - CommitChan: (STM TChan) - - Commits are indicated by writing to this channel. The pusher reads - - from it. - - FailedPushMap (STM TMVar) - - Failed pushes are indicated by writing to this TMVar. The push - - retrier blocks until they're available. - - TransferQueue (STM TChan) - - Transfers to make are indicated by writing to this channel. - - TransferSlots (QSemN) - - Count of the number of currently available transfer slots. - - Updated by the transfer watcher, this allows other threads - - to block until a slot is available. - - This MVar should only be manipulated from inside the Annex monad, - - which ensures it's accessed only after the ThreadState MVar. - - ScanRemotes (STM TMVar) - - Remotes that have been disconnected, and should be scanned - - are indicated by writing to this TMVar. - - BranchChanged (STM SampleVar) - - Changes to the git-annex branch are indicated by updating this - - SampleVar. - - NetMessager (STM TChan, TMVar, SampleVar) - - Used to feed messages to the built-in XMPP client, handle - - pushes, and signal it when it needs to restart due to configuration - - or networking changes. - - UrlRenderer (MVar) - - A Yesod route rendering function is stored here. This allows - - things that need to render Yesod routes to block until the webapp - - has started up and such rendering is possible. -} {-# LANGUAGE CPP #-} |