HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Moduleacid-state-0.16.1.4Haskell2010

Data.Acid.Local

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).

  • 3 types
  • 13 values
  • Packageacid-state-0.16.1.4
  • Exports16
  • LanguageHaskell2010
  • LicenceLicenseRef-PublicDomain
  • SourceLocal.hs
valueopenLocalState
  1. :: (Typeable st, IsAcidic st, SafeCopy st)
  2. => st

    Initial state value. This value is only used if no checkpoint is found.

  3. -> IO (AcidState st)
#

Create an AcidState given an initial value.

This will create or resume a log found in the "state/[typeOf state]/" directory.

valueopenLocalStateFrom
  1. :: (IsAcidic st, SafeCopy st)
  2. => FilePath

    Location of the checkpoint and transaction files.

  3. -> st

    Initial state value. This value is only used if no checkpoint is found.

  4. -> IO (AcidState st)
#

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.

valueopenLocalStateWithSerialiser
  1. :: IsAcidic st
  2. => FilePath

    Location of the checkpoint and transaction files.

  3. -> st

    Initial state value. This value is only used if no checkpoint is found.

  4. -> SerialisationLayer st

    Serialisation layer to use for checkpoints, events and archives.

  5. -> 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.

valueprepareLocalState
  1. :: (Typeable st, IsAcidic st, SafeCopy st)
  2. => st

    Initial state value. This value is only used if no checkpoint is found.

  3. -> IO (IO (AcidState st))
#

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.

valueprepareLocalStateFrom
  1. :: (IsAcidic st, SafeCopy st)
  2. => FilePath

    Location of the checkpoint and transaction files.

  3. -> st

    Initial state value. This value is only used if no checkpoint is found.

  4. -> IO (IO (AcidState st))
#

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.

valueprepareLocalStateWithSerialiser
  1. :: IsAcidic st
  2. => FilePath

    Location of the checkpoint and transaction files.

  3. -> st

    Initial state value. This value is only used if no checkpoint is found.

  4. -> SerialisationLayer st

    Serialisation layer to use for checkpoints, events and archives.

  5. -> IO (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. The most recent checkpoint will be loaded immediately but the AcidState will not be opened until the returned function is executed.

valuescheduleLocalUpdate'
  1. :: UpdateEvent event
  2. => LocalState (EventState event)
  3. -> event
  4. -> MVar (EventResult event)
  5. -> IO (IO ())
#

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.

datadata LocalState st
#

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).

datadata Checkpoint s
#

Constructors

Instances1SafeCopy
  • SafeCopy s => SafeCopy (Checkpoint s)Defined in acid-state-0.16.1.4 · Data.Acid.Local

    Previous versions of acid-state had

    data Checkpoint = Checkpoint EntryId ByteString

    where 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.

datadata SerialisationLayer st
#

Constructors