acid-state 0.7.10 → 0.8.0
raw patch · 2 files changed
+5/−38 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Acid.Local: continueLocalState :: (Typeable st, IsAcidic st) => st -> IO (AcidState st)
- Data.Acid.Local: continueLocalStateFrom :: IsAcidic st => FilePath -> st -> IO (AcidState st)
Files
- acid-state.cabal +1/−1
- src/Data/Acid/Local.hs +4/−37
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.10+Version: 0.8.0 -- A short (one-line) description of the package. Synopsis: Add ACID guarantees to any serializable Haskell data structure.
src/Data/Acid/Local.hs view
@@ -15,8 +15,6 @@ module Data.Acid.Local ( openLocalState , openLocalStateFrom- , continueLocalState- , continueLocalStateFrom , prepareLocalState , prepareLocalStateFrom , createArchive@@ -181,17 +179,6 @@ -- | Create an AcidState given an initial value. -- -- This will create or resume a log found in the \"state\/[typeOf state]\/\" directory.--- If another application has already opened the AcidState, this call will block until it has been closed.-continueLocalState :: (Typeable st, IsAcidic st)- => st -- ^ Initial state value. This value is only used if no checkpoint is- -- found.- -> IO (AcidState st)-continueLocalState initialState =- continueLocalStateFrom ("state" </> show (typeOf initialState)) initialState---- | Create an AcidState given an initial value.------ This will create or resume a log found in the \"state\/[typeOf state]\/\" directory. -- The most recent checkpoint will be loaded immediately but the AcidState will not be opened -- until the returned function is executed. prepareLocalState :: (Typeable st, IsAcidic st)@@ -215,19 +202,6 @@ openLocalStateFrom directory initialState = join $ resumeLocalStateFrom directory initialState False --- | Create an AcidState given a log directory and an initial value.------ This will create or resume a log found in @directory@.--- If another application has already opened the AcidState, this call will block until it has been closed.-continueLocalStateFrom :: (IsAcidic st)- => FilePath -- ^ Location of the checkpoint and transaction files.- -> st -- ^ Initial state value. This value is only used if no checkpoint is- -- found.- -> IO (AcidState st)-continueLocalStateFrom directory initialState =- join $ resumeLocalStateFrom directory initialState True-- -- | Create an AcidState given an initial value. -- -- This will create or resume a log found in @directory@.@@ -247,14 +221,14 @@ => FilePath -- ^ Location of the checkpoint and transaction files. -> st -- ^ Initial state value. This value is only used if no checkpoint is -- found.- -> Bool -- ^ True if we should wait for the lock to be released.+ -> Bool -- ^ True => load checkpoint before acquiring the lock. -> IO (IO (AcidState st))-resumeLocalStateFrom directory initialState doWaitForLock =- case doWaitForLock of+resumeLocalStateFrom directory initialState delayLocking =+ case delayLocking of True -> do (n, st) <- loadCheckpoint return $ do- lock <- waitForLock lockFile+ lock <- obtainPrefixLock lockFile replayEvents lock n st False -> do lock <- obtainPrefixLock lockFile@@ -293,13 +267,6 @@ , localCheckpoints = checkpointsLog , localLock = lock }--waitForLock :: FilePath -> IO PrefixLock-waitForLock path = go undefined- where- go :: SomeException -> IO PrefixLock- go _ = handle (\e -> threadDelay delay >> go e) (obtainPrefixLock path)- delay = 10^6 checkpointRestoreError msg = error $ "Could not parse saved checkpoint due to the following error: " ++ msg