add back git-annex branch read cache
The cache was removed way back in 2012,
commit 3417c55189
Then I forgot I had removed it! I remember clearly multiple times when I
thought, "this reads the same data twice, but the cache will avoid that
being very expensive".
The reason it was removed was it messed up the assistant noticing when
other processes made changes. That same kind of problem has recently
been addressed when adding the optimisation to avoid reading the journal
unnecessarily.
Indeed, enableInteractiveJournalAccess is run in just the
right places, so can just piggyback on it to know when it's not safe
to use the cache.
This commit is contained in:
parent
9a2fbc2ea8
commit
e72ec8b9b2
8 changed files with 68 additions and 19 deletions
|
@ -1,12 +1,16 @@
|
|||
{- git-annex BranchState data type
|
||||
-
|
||||
- Copyright 2011 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2011-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Types.BranchState where
|
||||
|
||||
import Common
|
||||
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
||||
data BranchState = BranchState
|
||||
{ branchUpdated :: Bool
|
||||
-- ^ has the branch been updated this run?
|
||||
|
@ -15,10 +19,16 @@ data BranchState = BranchState
|
|||
, journalIgnorable :: Bool
|
||||
-- ^ can reading the journal be skipped, while still getting
|
||||
-- sufficiently up-to-date information from the branch?
|
||||
, journalNeverIgnorable :: Bool
|
||||
-- ^ should the journal always be read even if it would normally
|
||||
-- be safe to skip it?
|
||||
, cachedFile :: Maybe RawFilePath
|
||||
-- ^ a file recently read from the branch
|
||||
, cachedContent :: L.ByteString
|
||||
-- ^ content of the cachedFile
|
||||
, needInteractiveAccess :: Bool
|
||||
-- ^ do new changes written to the journal or branch by another
|
||||
-- process need to be noticed while the current process is running?
|
||||
-- (This makes the journal always be read, and avoids using the
|
||||
-- cache.)
|
||||
}
|
||||
|
||||
startBranchState :: BranchState
|
||||
startBranchState = BranchState False False False False
|
||||
startBranchState = BranchState False False False Nothing mempty False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue