acid-state 0.16.1 → 0.16.1.1
raw patch · 27 files changed
+127/−50 lines, 27 filesdep ~basedep ~criteriondep ~mtlnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, criterion, mtl, template-haskell
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- acid-state.cabal +26/−6
- examples/CheckpointCutsEvent.hs +3/−3
- examples/HelloWorldNoTH.hs +3/−2
- examples/KeyValueNoTH.hs +2/−1
- examples/Proxy.hs +3/−2
- examples/RemoteClient.hs +1/−1
- examples/SlowCheckpoint.hs +3/−2
- examples/StressTestNoTH.hs +3/−2
- examples/errors/ChangeState.hs +2/−2
- examples/errors/ChangeVersion.hs +1/−1
- examples/errors/Exceptions.hs +6/−1
- examples/errors/RemoveEvent.hs +1/−1
- src/Data/Acid/Common.hs +6/−2
- src/Data/Acid/Core.hs +2/−0
- src/Data/Acid/Local.hs +2/−0
- src/Data/Acid/Log.hs +8/−4
- src/Data/Acid/Memory.hs +4/−3
- src/Data/Acid/Memory/Pure.hs +7/−12
- src/Data/Acid/Remote.hs +5/−0
- src/Data/Acid/Repair.hs +1/−1
- src/Data/Acid/TemplateHaskell.hs +4/−0
- test-state/OldStateTest1/events-0000000681.log +0/−0
- test-state/OldStateTest2/events-0000000149.log +0/−0
- test-state/OldStateTest3/events-0000000100.log +0/−0
- test/Data/Acid/KeyValueStateMachine.hs +3/−2
- test/Data/Acid/StateMachineTest.hs +24/−2
CHANGELOG.md view
@@ -1,3 +1,10 @@+0.16.1.1+========++- Adapt to changes in hedgehog-1.1 related to barbies+- Support mtl-2.3+- Tested with GHC 7.8 - 9.2.3+ 0.16.1 ======
acid-state.cabal view
@@ -1,5 +1,5 @@ Name: acid-state-Version: 0.16.1+Version: 0.16.1.1 Synopsis: Add ACID guarantees to any serializable Haskell data structure. Description: Use regular Haskell data structures as your database and get stronger ACID guarantees than most RDBMS offer. Homepage: https://github.com/acid-state/acid-state@@ -10,7 +10,19 @@ Category: Database Build-type: Simple Cabal-version: >=1.10-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.3, GHC == 8.8.3, GHC == 8.10.1++tested-with:+ GHC == 9.2.3+ GHC == 9.0.2+ GHC == 8.10.7+ GHC == 8.8.4+ GHC == 8.6.5+ GHC == 8.4.4+ GHC == 8.2.2+ GHC == 8.0.2+ GHC == 7.10.3+ GHC == 7.8.4+ Extra-source-files: CHANGELOG.md test-state/OldStateTest1/*.log@@ -27,7 +39,7 @@ flag skip-state-machine-test description: If enabled, do not build/run the state-machine test default: False- manual: True+ manual: False Library Exposed-Modules: Data.Acid,@@ -45,7 +57,7 @@ FileIO Build-depends: array,- base >= 4.5.1.0 && < 5,+ base >= 4.7 && < 5, bytestring >= 0.10.2, cereal >= 0.4.1.0, containers,@@ -73,7 +85,14 @@ Hs-Source-Dirs: src-unix/ default-language: Haskell2010- GHC-Options: -fwarn-unused-imports -fwarn-unused-binds+ GHC-Options: -Wall+ -fno-warn-dodgy-imports+ -fno-warn-missing-signatures+ -fno-warn-name-shadowing+ -fno-warn-unused-do-bind+ -fno-warn-unused-matches+ if impl(ghc >= 8.0)+ ghc-options: -Wcompat executable acid-state-repair hs-source-dirs: repair@@ -175,7 +194,8 @@ directory, system-fileio == 0.3.*, system-filepath,- criterion >= 1.0.0.0 && < 1.6,+ -- perRunEnv was added in criterion-1.2.0.0+ criterion >= 1.2.0.0 && < 1.6, mtl, base, acid-state
examples/CheckpointCutsEvent.hs view
@@ -22,10 +22,10 @@ -- import Control.Concurrent import Control.Applicative-import Control.Monad.Reader-import Control.Monad.State+import Control.Monad+import Control.Monad.State ( get, put ) import Data.Acid-import Data.List+import Data.List ( sort ) import Data.SafeCopy import Data.Typeable import System.Directory
examples/HelloWorldNoTH.hs view
@@ -7,8 +7,9 @@ import Data.Acid import Data.Acid.Advanced -import Control.Monad.Reader-import Control.Monad.State+import Control.Monad+import Control.Monad.Reader (ask)+import Control.Monad.State (put) import Data.SafeCopy import System.Environment
examples/KeyValueNoTH.hs view
@@ -8,7 +8,8 @@ import Data.Acid.Advanced import Control.Applicative-import Control.Monad.Reader+import Control.Monad+import Control.Monad.Reader (ask) import qualified Control.Monad.State as State import Data.SafeCopy import System.Environment
examples/Proxy.hs view
@@ -8,8 +8,9 @@ import Data.Acid.Advanced (scheduleUpdate) import Data.Acid.Remote -import Control.Monad.Reader-import Control.Monad.State+import Control.Monad+import Control.Monad.Reader (ask)+import Control.Monad.State (get, put) import Data.SafeCopy import System.Environment import System.IO
examples/RemoteClient.hs view
@@ -1,6 +1,6 @@ module RemoteClient (main) where -import Control.Monad.Reader+import Control.Monad import Data.Acid import Data.Acid.Advanced import Data.Acid.Remote
examples/SlowCheckpoint.hs view
@@ -10,8 +10,9 @@ import Data.Acid import Control.Concurrent-import Control.Monad.Reader-import Control.Monad.State+import Control.Monad+import Control.Monad.Reader (ask)+import Control.Monad.State (get, put) import Data.SafeCopy import Data.Time import System.Directory
examples/StressTestNoTH.hs view
@@ -7,8 +7,9 @@ import Data.Acid import Data.Acid.Advanced -import Control.Monad.Reader-import Control.Monad.State+import Control.Monad+import Control.Monad.Reader (ask)+import Control.Monad.State (get, put) import Data.SafeCopy import System.Environment import System.IO
examples/errors/ChangeState.hs view
@@ -6,7 +6,7 @@ import Data.Acid import Control.Exception-import Control.Monad.State+import Control.Monad import Data.SafeCopy import System.Directory import System.Environment@@ -56,7 +56,7 @@ putStrLn "ChangeState done" where hdl (ErrorCall msg)- | "Could not parse saved checkpoint due to the following error: too few bytes\nFrom:\tChangeState.SecondState:\n\tdemandInput\n\n" `isSuffixOf` msg + | "Could not parse saved checkpoint due to the following error: too few bytes\nFrom:\tChangeState.SecondState:\n\tdemandInput\n\n" `isSuffixOf` msg = putStrLn $ "Caught error: " ++ msg hdl e = throwIO e
examples/errors/ChangeVersion.hs view
@@ -6,7 +6,7 @@ import Data.Acid import Control.Exception-import Control.Monad.State+import Control.Monad import Data.SafeCopy import System.Directory import System.Environment
examples/errors/Exceptions.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-}@@ -7,7 +8,11 @@ import Data.Acid import Data.Acid.Local (createCheckpointAndClose) -import Control.Monad.State+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif+import Control.Monad+import Control.Monad.State ( get, put ) import Data.SafeCopy import System.Directory import System.Environment
examples/errors/RemoveEvent.hs view
@@ -6,7 +6,7 @@ import Data.Acid -import Control.Monad.State+import Control.Monad import Data.SafeCopy import System.Directory import System.Environment
src/Data/Acid/Common.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving, GADTs #-} ----------------------------------------------------------------------------- -- |@@ -13,9 +14,12 @@ import Data.Acid.Core -import Control.Monad.State-import Control.Monad.Reader+import Control.Monad+import Control.Monad.State (MonadState, get, State)+import Control.Monad.Reader (MonadReader, Reader, runReader)+#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif class IsAcidic st where
src/Data/Acid/Core.hs view
@@ -51,7 +51,9 @@ import Control.Monad ( liftM ) import Control.Monad.State ( State, runState ) import qualified Data.Map as Map+#if !MIN_VERSION_base(4,11,0) import Data.Monoid ((<>))+#endif import Data.ByteString.Lazy as Lazy ( ByteString ) import Data.ByteString.Lazy.Char8 as Lazy ( pack, unpack )
src/Data/Acid/Local.hs view
@@ -41,7 +41,9 @@ import Control.Exception ( onException, evaluate, Exception, throwIO ) import Control.Monad.State ( runState ) import Control.Monad ( join )+#if !MIN_VERSION_base(4,8,0) import Control.Applicative ( (<$>), (<*>) )+#endif import Data.ByteString.Lazy ( ByteString ) import qualified Data.ByteString.Lazy as Lazy ( length )
src/Data/Acid/Log.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -- | A log is a stack of entries that supports efficient pushing of new entries -- and fetching of old. It can be considered an extendible array of entries. --@@ -34,9 +36,11 @@ import qualified Data.ByteString.Lazy as Lazy import qualified Data.ByteString as Strict import qualified Data.ByteString.Unsafe as Strict-import Data.List+import Data.List ( (\\), stripPrefix, sort ) import Data.Maybe-import Data.Monoid ((<>))+#if !MIN_VERSION_base(4,11,0)+import Data.Monoid ( (<>) )+#endif import Text.Printf ( printf ) import Paths_acid_state ( version )@@ -268,8 +272,8 @@ archiveFileLog fLog entryId = do logFiles <- findLogFiles (logIdentifier fLog) let sorted = sort logFiles- relevant = filterLogFiles Nothing (Just entryId) sorted \\- filterLogFiles (Just entryId) (Just (entryId+1)) sorted+ relevant = filterLogFiles Nothing (Just entryId) sorted+ \\ filterLogFiles (Just entryId) (Just (entryId+1)) sorted createDirectoryIfMissing True archiveDir forM_ relevant $ \(_startEntry, logFilePath) ->
src/Data/Acid/Memory.hs view
@@ -8,6 +8,7 @@ -- Portability : non-portable (uses GHC extensions) -- -- AcidState container without a transaction log. Mostly used for testing.+-- Supports Atomicity, Consistency and Isolation, but not Durability. -- module Data.Acid.Memory@@ -43,7 +44,8 @@ , localCopy :: IORef st } deriving (Typeable) --- | Create an AcidState given an initial value.+-- | Create an 'AcidState' given an initial value. The state is kept only in+-- memory, so it is not durable. openMemoryState :: (IsAcidic st) => st -- ^ Initial state value. -> IO (AcidState st)@@ -53,8 +55,7 @@ return $ toAcidState MemoryState { localCore = core, localCopy = ref } --- | Issue an Update event and return immediately. The event is not durable--- before the MVar has been filled but the order of events is honored.+-- | Issue an Update event and return immediately. The order of events is honored. -- The behavior in case of exceptions is exactly the same as for 'update'. -- -- If EventA is scheduled before EventB, EventA /will/ be executed before EventB:
src/Data/Acid/Memory/Pure.hs view
@@ -9,6 +9,11 @@ -- -- AcidState container without a transaction log. Mostly used for testing. --+-- This module consists of internal implementation details for+-- "Data.Acid.Memory". You should not normally need to import it. Call+-- 'Data.Acid.Memory.openMemoryState' and thereafter use the API from+-- "Data.Acid" instead.+-- module Data.Acid.Memory.Pure ( IsAcidic(..)@@ -35,18 +40,8 @@ import Control.Monad.State import Control.Monad.Reader -{-| State container offering full ACID (Atomicity, Consistency, Isolation and Durability)- guarantees.-- [@Atomicity@] State changes are all-or-nothing. This is what you'd expect of any state- variable in Haskell and AcidState doesn't change that.-- [@Consistency@] No event or set of events will break your data invariants.-- [@Isolation@] Transactions cannot interfere with each other even when issued in parallel.-- [@Durability@] Successful transaction are guaranteed to survive system failure (both- hardware and software).+{-| Pure state value used internally. This is not the same as+ 'Data.Acid.AcidState' from "Data.Acid". -} data AcidState st = AcidState { localMethods :: MethodMap st
src/Data/Acid/Remote.hs view
@@ -96,6 +96,9 @@ ) where import Prelude hiding ( catch )+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif import Control.Concurrent.STM ( atomically ) import Control.Concurrent.STM.TMVar ( newEmptyTMVar, readTMVar, takeTMVar, tryTakeTMVar, putTMVar ) import Control.Concurrent.STM.TQueue@@ -110,7 +113,9 @@ import Data.Acid.Abstract import Data.Acid.Core import Data.Acid.Common+#if !MIN_VERSION_base(4,11,0) import Data.Monoid ((<>))+#endif import qualified Data.ByteString as Strict import Data.ByteString.Char8 ( pack ) import qualified Data.ByteString.Lazy as Lazy
src/Data/Acid/Repair.hs view
@@ -11,7 +11,7 @@ import Data.Acid.Log (LogKey) import qualified Data.Acid.Log as Log import qualified Data.ByteString.Lazy as Lazy-import Data.List+import Data.List (sort) import System.Directory import System.FilePath.Posix import System.IO (hClose, openTempFile)
src/Data/Acid/TemplateHaskell.hs view
@@ -14,8 +14,12 @@ import Data.SafeCopy import Data.Typeable import Data.Char+#if !MIN_VERSION_base(4,11,0) import Data.Monoid ((<>))+#endif+#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.Monad import Control.Monad.State (MonadState) import Control.Monad.Reader (MonadReader)
+ test-state/OldStateTest1/events-0000000681.log view
+ test-state/OldStateTest2/events-0000000149.log view
+ test-state/OldStateTest3/events-0000000100.log view
test/Data/Acid/KeyValueStateMachine.hs view
@@ -10,8 +10,9 @@ import Control.DeepSeq import Control.Exception-import Control.Monad.Reader-import Control.Monad.State+import Control.Monad.IO.Class ( MonadIO(..) )+import Control.Monad.Reader ( ask )+import Control.Monad.State ( get, put ) import Data.Acid import Data.Acid.StateMachineTest import Data.SafeCopy
test/Data/Acid/StateMachineTest.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RecordWildCards #-}@@ -40,8 +41,8 @@ import Control.DeepSeq import Control.Exception (Exception, IOException, throw, catch, try, evaluate)-import Control.Monad.Reader-import Control.Monad.State+import Control.Monad.IO.Class ( MonadIO(..) )+import Control.Monad.State ( State, evalState, execState ) import qualified Data.Acid as Acid import qualified Data.Acid.Common as Common import qualified Data.Acid.Core as Core@@ -177,8 +178,15 @@ data Open s (v :: * -> *) = Open s deriving Show +#if MIN_VERSION_hedgehog(1,1,0)+instance FunctorB (Open s) where+ bmap _ (Open s) = Open s+instance TraversableB (Open s) where+ btraverse _ (Open s) = pure (Open s)+#else instance HTraversable (Open s) where htraverse _ (Open s) = pure (Open s)+#endif -- | Command to open the state, given the interface to use and a -- generator for possible initial state values.@@ -202,8 +210,15 @@ data WithState s (v :: * -> *) = WithState String (Var (Opaque (Acid.AcidState s)) v) deriving (Show) +#if MIN_VERSION_hedgehog(1,1,0)+instance FunctorB (WithState s) where+ bmap k (WithState l v) = WithState l (bmap k v)+instance TraversableB (WithState s) where+ btraverse k (WithState l v) = WithState l <$> btraverse k v+#else instance HTraversable (WithState s) where htraverse k (WithState l v) = WithState l <$> htraverse k v+#endif genWithState :: Applicative g => String -> Model s v -> Maybe (g (WithState s v)) genWithState l model = pure . WithState l <$> modelHandle model@@ -256,8 +271,15 @@ data AcidCommand s e (v :: * -> *) = AcidCommand e (Var (Opaque (Acid.AcidState s)) v) deriving (Show) +#if MIN_VERSION_hedgehog(1,1,0)+instance FunctorB (AcidCommand s e) where+ bmap k (AcidCommand e s) = AcidCommand e (bmap k s)+instance TraversableB (AcidCommand s e) where+ btraverse k (AcidCommand e s) = AcidCommand e <$> btraverse k s+#else instance HTraversable (AcidCommand s e) where htraverse k (AcidCommand e s) = AcidCommand e <$> htraverse k s+#endif -- | Translate an acid-state update into a command that executes the -- update, given a generator of inputs. If the update fails, the