openLocalState Create an AcidState given an initial value.
This will create or resume a log found in the "state/[typeOf state]/" directory.
:: a typeCtrl KGHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19
Moduleacid-state-0.16.1.4Haskell2010
AcidState container using a transaction log on disk. The term 'Event' is loosely used for transactions with ACID guarantees. 'Method' is loosely used for state operations without ACID guarantees (see Data.Acid.Core).
openLocalState Create an AcidState given an initial value.
This will create or resume a log found in the "state/[typeOf state]/" directory.
openLocalStateFrom Create an AcidState given a log directory and an initial value.
This will create or resume a log found in directory.
Running two AcidState's from the same directory is an error
but will not result in dataloss.
openLocalStateWithSerialiser :: IsAcidic st=> FilePathLocation of the checkpoint and transaction files.
-> stInitial state value. This value is only used if no checkpoint is found.
-> SerialisationLayer stSerialisation layer to use for checkpoints, events and archives.
-> IO (AcidState st)Create an AcidState given a log directory, an initial value and a serialisation layer.
This will create or resume a log found in directory.
Running two AcidState's from the same directory is an error
but will not result in dataloss.
prepareLocalState 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.
Create an AcidState given a log directory and an initial value.
This will create or resume a log found in directory.
The most recent checkpoint will be loaded immediately but the AcidState will not be opened
until the returned function is executed.
Create an AcidState given a log directory, an initial value and a serialisation layer.
This will create or resume a log found in directory.
The most recent checkpoint will be loaded immediately but the AcidState will not be opened
until the returned function is executed.
Directory to load the state from unless otherwise specified, namely "state/[typeOf state]/".
Same as scheduleLocalUpdate but does not immediately change the localCopy and return the result mvar - returns an IO action to do this instead. Take care to run actions of multiple Updates in the correct order as otherwise Queries will operate on outdated state.
Same as scheduleLocalColdUpdate but does not immediately change the localCopy and return the result mvar - returns an IO action to do this instead. Take care to run actions of multiple Updates in the correct order as otherwise Queries will operate on outdated state.
Save a snapshot to disk and close the AcidState as a single atomic action. This is useful when you want to make sure that no events are saved to disk after a checkpoint.
State container offering full ACID (Atomicity, Consistency, Isolation and Durability) guarantees.
AtomicityState changes are all-or-nothing. This is what you'd expect of any state variable in Haskell and AcidState doesn't change that.
ConsistencyNo event or set of events will break your data invariants.
IsolationTransactions cannot interfere with each other even when issued in parallel.
DurabilitySuccessful transaction are guaranteed to survive system failure (both hardware and software).
LocalStatelocalCore :: Core stlocalCopy :: IORef stlocalEvents :: FileLog (Tagged ByteString)localCheckpoints :: FileLog (Checkpoint st)localLock :: FileLockSafeCopy s => SafeCopy (Checkpoint s)Defined in acid-state-0.16.1.4 · Data.Acid.LocalPrevious versions of acid-state had
data Checkpoint = Checkpoint EntryId ByteStringwhere the ByteString is the safecopy-serialization of the
original checkpoint data. Thus we give a SafeCopy instance that
is backwards-compatible with this by making nested calls to
safePut and safeGet.
Note that if the inner data cannot be deserialised, getCopy will not report an error immediately but will return a Checkpoint whose payload is an error thunk. This means consumers can skip deserialising intermediate checkpoint data when they care only about the last checkpoint in a file. However, they must be sure to force the returned data promptly.
SerialisationLayercheckpointSerialiser :: Serialiser (Checkpoint st)Serialisation strategy for checkpoints.
Use safeCopySerialiser for the backwards-compatible implementation using Data.SafeCopy.
eventSerialiser :: Serialiser (Tagged ByteString)Serialisation strategy for events.
Use safeCopySerialiser for the backwards-compatible implementation using Data.SafeCopy.
archiver :: ArchiverSerialisation strategy for archive log files.
Use defaultArchiver for the backwards-compatible implementation using Data.Serialize.
Standard (and historically the only) serialisation layer, using safeCopySerialiser and defaultArchiver.