summaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-22 14:18:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-22 14:18:49 -0400
commit78a325b09315efd593e6b729de18f15871a0d643 (patch)
tree22516f01e3fcccde1d1c2ade57315d2ba6e95d64 /Types
parent1cca8b4edb963b980e64ed0b7de7814b5380e214 (diff)
add a small cache of the most recently accessed item from the git-annex branch
This will speed up typical cases like git-annex get, which currently has to read the location log once, then read it a second time in order to add a line to it. Since these reads now involve more than just reading in a file, it seemed good to add a cache layer. Only the most recent thing needs to be cached, because git-annex has good locality; it operates on one file at a time, and only cares about one item from the branch per file.
Diffstat (limited to 'Types')
-rw-r--r--Types/Branch.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/Types/Branch.hs b/Types/Branch.hs
new file mode 100644
index 000000000..c0ccb5ca0
--- /dev/null
+++ b/Types/Branch.hs
@@ -0,0 +1,16 @@
+{- git-annex branch data types
+ -
+ - Copyright 2011 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Types.Branch where
+
+data BranchCache = BranchCache {
+ cachedFile :: Maybe FilePath,
+ cachedContent :: String
+}
+
+emptyBranchCache :: BranchCache
+emptyBranchCache = BranchCache Nothing ""