1{- git-cat file handles pools 2 - 3 - Copyright 2020 Joey Hess <id@joeyh.name> 4 - 5 - Licensed under the GNU AGPL version 3 or higher. 6 -} 7 8module Types.CatFileHandles ( 9 CatFileHandles(..), 10 catFileHandlesNonConcurrent, 11 catFileHandlesPool, 12) where 13 14import Control.Concurrent.STM 15import qualified Data.Map as M 16 17import Utility.ResourcePool 18import Git.CatFile (CatFileHandle) 19 20data CatFileHandles 21 = CatFileHandlesNonConcurrent CatMap 22 | CatFileHandlesPool (TMVar CatMap) 23 24type CatMap = M.Map FilePath (ResourcePool CatFileHandle) 25 26catFileHandlesNonConcurrent :: CatFileHandles 27catFileHandlesNonConcurrent = CatFileHandlesNonConcurrent M.empty 28 29catFileHandlesPool :: IO CatFileHandles 30catFileHandlesPool = CatFileHandlesPool <$> newTMVarIO M.empty 31