acid-state 0.3.1 → 0.3.2
raw patch · 3 files changed
+11/−7 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- acid-state.cabal +1/−1
- src/Data/Acid/Core.hs +2/−0
- src/Data/Acid/Local.hs +8/−6
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.3.1+Version: 0.3.2 -- A short (one-line) description of the package. Synopsis: Add ACID guarantees to any serializable Haskell data structure.
src/Data/Acid/Core.hs view
@@ -60,7 +60,9 @@ -- methods. No efforts towards durability, checkpointing or -- sharding happens at this level. -- Important things to keep in mind in this module:+-- -- * We don't distinguish between updates and queries.+-- -- * We allow direct access to the core state as well -- as through events. data Core st
src/Data/Acid/Local.hs view
@@ -108,12 +108,14 @@ update :: UpdateEvent event => AcidState (EventState event) -> event -> IO (EventResult event) update acidState event = do mvar <- newEmptyMVar- modifyCoreState_ (localCore acidState) $ \st ->- do let (result, st') = State.runState hotMethod st- -- Schedule the log entry. Very important that it happens when 'localCore' is locked- -- to ensure that events are logged in the same order that they are executed.- pushEntry (localEvents acidState) (methodTag event, encode event) $ putMVar mvar result- return st'+ let encodedEvent = encode event+ Lazy.length encodedEvent `seq`+ modifyCoreState_ (localCore acidState) $ \st ->+ do let !(result, st') = State.runState hotMethod st+ -- Schedule the log entry. Very important that it happens when 'localCore' is locked+ -- to ensure that events are logged in the same order that they are executed.+ pushEntry (localEvents acidState) (methodTag event, encodedEvent) $ putMVar mvar result+ return st' takeMVar mvar where hotMethod = lookupHotMethod (localCore acidState) event