packages feed

acid-state 0.7.6 → 0.7.7

raw patch · 5 files changed

+18/−6 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Acid.Advanced: groupUpdates :: UpdateEvent event => AcidState (EventState event) -> [event] -> IO ()

Files

acid-state.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.7.6+Version:             0.7.7  -- A short (one-line) description of the package. Synopsis:            Add ACID guarantees to any serializable Haskell data structure.
examples/StressTest.hs view
@@ -2,7 +2,7 @@ module Main (main) where  import Data.Acid-import Data.Acid.Advanced (scheduleUpdate)+import Data.Acid.Advanced (groupUpdates)  import Control.Monad.State import Control.Monad.Reader@@ -51,8 +51,7 @@             ["poke"]               -> do putStr "Issuing 100k transactions... "                     hFlush stdout-                    replicateM_ (100000-1) (scheduleUpdate acid PokeState)-                    update acid PokeState+                    groupUpdates acid (replicate 100000 PokeState)                     putStrLn "Done"             ["clear"]               -> do update acid ClearState
examples/StressTestNoTH.hs view
@@ -49,8 +49,7 @@             ["poke"]               -> do putStr "Issuing 100k transactions... "                     hFlush stdout-                    replicateM_ (100000-1) (scheduleUpdate acid PokeState)-                    update acid PokeState+                    groupUpdates acid (replicate 100000 PokeState)                     putStrLn "Done"             _ -> do putStrLn $ "Commands:"                     putStrLn $ "  query            Prints out the current state."
src/Data/Acid/Abstract.hs view
@@ -2,6 +2,7 @@ module Data.Acid.Abstract     ( AcidState(..)     , scheduleUpdate+    , groupUpdates     , update     , update'     , query@@ -15,6 +16,7 @@  import Control.Concurrent      ( MVar, takeMVar ) import Data.ByteString.Lazy    ( ByteString )+import Control.Monad           ( void ) import Control.Monad.Trans     ( MonadIO(liftIO) ) import Data.Typeable           ( Typeable1, gcast1, typeOf1 ) @@ -68,6 +70,17 @@ --   @ scheduleUpdate :: UpdateEvent event => AcidState (EventState event) -> event -> IO (MVar (EventResult event)) scheduleUpdate = _scheduleUpdate -- Redirection to make Haddock happy.++-- | Schedule multiple Update events and wait for them to be durable, but+--   throw away their results. This is useful for importing existing+--   datasets into an AcidState.+groupUpdates :: UpdateEvent event => AcidState (EventState event) -> [event] -> IO ()+groupUpdates acidState events+  = go events+  where+    go []     = return ()+    go [x]    = void $ update acidState x+    go (x:xs) = scheduleUpdate acidState x >> go xs  -- | Issue an Update event and wait for its result. Once this call returns, you are --   guaranteed that the changes to the state are durable. Events may be issued in
src/Data/Acid/Advanced.hs view
@@ -11,6 +11,7 @@ -} module Data.Acid.Advanced     ( scheduleUpdate+    , groupUpdates     , update'     , query'     , Method(..)