diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-24 16:13:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-24 16:13:22 -0400 |
commit | 5c49f7ef10b8d61cfabd8ca9602d852ae5abe452 (patch) | |
tree | 259f4088b02c3ed08d488572bfde314dec21b181 /Assistant/Changes.hs | |
parent | 6148b926959ce5cbbc12aafc60a119788ca6d97f (diff) |
use TList for ChangePool
Diffstat (limited to 'Assistant/Changes.hs')
-rw-r--r-- | Assistant/Changes.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Assistant/Changes.hs b/Assistant/Changes.hs index 05f2795d3..0a93d6335 100644 --- a/Assistant/Changes.hs +++ b/Assistant/Changes.hs @@ -1,6 +1,6 @@ {- git-annex assistant change tracking - - - Copyright 2012 Joey Hess <joey@kitenet.net> + - Copyright 2012-2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -9,7 +9,7 @@ module Assistant.Changes where import Assistant.Common import Assistant.Types.Changes -import Utility.TSet +import Utility.TList import Data.Time.Clock import Control.Concurrent.STM @@ -28,17 +28,17 @@ pendingAddChange f = Just <$> (PendingAddChange <$> liftIO getCurrentTime <*> pu {- Gets all unhandled changes. - Blocks until at least one change is made. -} getChanges :: Assistant [Change] -getChanges = fmap concat $ (atomically . getTSet) <<~ changeChan +getChanges = (atomically . getTList) <<~ changePool {- Gets all unhandled changes, without blocking. -} getAnyChanges :: Assistant [Change] -getAnyChanges = fmap concat $ (atomically . readTSet) <<~ changeChan +getAnyChanges = (atomically . readTList) <<~ changePool -{- Puts unhandled changes back into the channel. +{- Puts unhandled changes back into the pool. - Note: Original order is not preserved. -} refillChanges :: [Change] -> Assistant () -refillChanges cs = (atomically . flip putTSet1 cs) <<~ changeChan +refillChanges cs = (atomically . flip appendTList cs) <<~ changePool -{- Records a change in the channel. -} +{- Records a change to the pool. -} recordChange :: Change -> Assistant () -recordChange c = (atomically . flip putTSet1 [c]) <<~ changeChan +recordChange c = (atomically . flip snocTList c) <<~ changePool |