gdritter repos tansu / 2d9c780
Limited exports from Ephemeral backend Getty Ritter 8 years ago
1 changed file(s) with 4 addition(s) and 3 deletion(s). Collapse all Expand all
1 module Database.Tansu.Backend.Ephemeral where
1 module Database.Tansu.Backend.Ephemeral
2 (withEphemeralDb) where
23
34 import Control.Concurrent.MVar
45 import Data.ByteString (ByteString)
1718 ephemeralGet :: IORef Table -> ByteString -> IO (Maybe ByteString)
1819 ephemeralGet table key = M.lookup key `fmap` readIORef table
1920
20 withEphemeralDatabase :: (Database -> IO a) -> IO a
21 withEphemeralDatabase comp = do
21 withEphemeralDb :: (Database -> IO a) -> IO a
22 withEphemeralDb comp = do
2223 lock <- newMVar ()
2324 table <- newIORef M.empty
2425 comp $ Database