start splitting out readonly values from AnnexState
Values in AnnexRead can be read more efficiently, without MVar overhead. Only a few things have been moved into there, and the performance increase so far is not likely to be noticable. This is groundwork for putting more stuff in there, particularly a value that indicates if debugging is enabled. The obvious next step is to change option parsing to not run in the Annex monad to set values in AnnexState, and instead return a pure value that gets stored in AnnexRead.
This commit is contained in:
parent
3204f0bbaa
commit
c2f612292a
20 changed files with 169 additions and 140 deletions
|
@ -26,14 +26,14 @@ import Control.Concurrent
|
|||
-- since only one liftAnnex can be running at a time, across all
|
||||
-- transports.
|
||||
liftAnnex :: TransportHandle -> Annex a -> IO a
|
||||
liftAnnex (TransportHandle _ annexstate) a = do
|
||||
st <- takeMVar annexstate
|
||||
(r, st') <- Annex.run st a
|
||||
putMVar annexstate st'
|
||||
liftAnnex (TransportHandle _ stmv rd) a = do
|
||||
st <- takeMVar stmv
|
||||
(r, (st', _rd)) <- Annex.run (st, rd) a
|
||||
putMVar stmv st'
|
||||
return r
|
||||
|
||||
inLocalRepo :: TransportHandle -> (Git.Repo -> IO a) -> IO a
|
||||
inLocalRepo (TransportHandle (LocalRepo g) _) a = a g
|
||||
inLocalRepo (TransportHandle (LocalRepo g) _ _) a = a g
|
||||
|
||||
-- Check if some shas should be fetched from the remote,
|
||||
-- and presumably later merged.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue