summaryrefslogtreecommitdiff
path: root/src/Storage.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-07-15 20:12:09 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-07-15 20:12:09 +0200
commit3c05d0cbd310af1c34d3731a15feb2a9508aded2 (patch)
tree8d77f0efbe61a569fc7ea3e685107cc20768aa27 /src/Storage.hs
parentb8e55c64a68763b0953945476cc75206f5354023 (diff)
Stored roots with caching
Diffstat (limited to 'src/Storage.hs')
-rw-r--r--src/Storage.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Storage.hs b/src/Storage.hs
index 84df213..cc2476f 100644
--- a/src/Storage.hs
+++ b/src/Storage.hs
@@ -115,13 +115,25 @@ openStorage path = do
createDirectoryIfMissing True $ path ++ "/heads"
watchers <- newMVar ([], WatchList 1 [])
refgen <- newMVar =<< HT.new
- return $ Storage { stBacking = StorageDir path watchers, stParent = Nothing, stRefGeneration = refgen }
+ refroots <- newMVar =<< HT.new
+ return $ Storage
+ { stBacking = StorageDir path watchers
+ , stParent = Nothing
+ , stRefGeneration = refgen
+ , stRefRoots = refroots
+ }
memoryStorage' :: IO (Storage' c')
memoryStorage' = do
backing <- StorageMemory <$> newMVar [] <*> newMVar M.empty <*> newMVar M.empty <*> newMVar (WatchList 1 [])
refgen <- newMVar =<< HT.new
- return $ Storage { stBacking = backing, stParent = Nothing, stRefGeneration = refgen }
+ refroots <- newMVar =<< HT.new
+ return $ Storage
+ { stBacking = backing
+ , stParent = Nothing
+ , stRefGeneration = refgen
+ , stRefRoots = refroots
+ }
memoryStorage :: IO Storage
memoryStorage = memoryStorage'