acid-state-0.6.2: Add ACID guarantees to any serializable Haskell data structure.

Portabilitynon-portable (uses GHC extensions)
Maintainerlemmih@gmail.com

Data.Acid.Local

Description

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

Synopsis

Documentation

openLocalStateSource

Arguments

:: (Typeable st, IsAcidic st) 
=> st

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

-> IO (AcidState st) 

Create an AcidState given an initial value.

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

openLocalStateFromSource

Arguments

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

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.

createArchive :: AcidState st -> IO ()Source

Move all log files that are no longer necessary for state restoration into the Archive folder in the state directory. This folder can then be backed up or thrown out as you see fit. Reverting to a state before the last checkpoint will not be possible if the Archive folder has been thrown out.

This method is idempotent and does not block the normal operation of the AcidState.

createCheckpointAndClose :: SafeCopy st => AcidState st -> IO ()Source

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.