úÎeå_Ò)      !"#$%&'()*+++ ,-./012345,12345,12345 6789:;<=>?@A 6789:;<>?@ 6987789:;<>?@BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ CDEFGNRVXZ[\] CDEFDEFGNRVXZ[\]"non-portable (uses GHC extensions)lemmih@gmail.com_(Collection of Methods indexed by a Tag. DMethod container structure that hides the exact type of the method. `JMethod tags must be unique and are most commenly generated automatically. 8The control structure at the very center of acid-state. : This module provides access to a mutable state through < methods. No efforts towards durability, checkpointing or # sharding happens at this level. 4 Important things to keep in mind in this module:  * We don'+t distinguish between updates and queries. 8 * We allow direct access to the core state as well  as through events. abc?The basic Method class. Each Method has an indexed result type  and a unique tag. CConstruct a new Core using an initial state and a list of Methods. 0List of methods capable of modifying the state. Initial state value. AMark Core as closed. Any subsequent use will throw an exception. FAccess the state and then mark the Core as closed. Any subsequent use  will throw an exception. DModify the state component. The resulting state is ensured to be in  WHNF. DModify the state component. The resulting state is ensured to be in  WHNF. Access the state component. FExecute a method as given by a type identifier and an encoded string. J The exact format of the encoded string depends on the type identifier. 2 Results are encoded and type tagged before they're handed back out. M This function is used when running events from a log-file or from another G server. Events that originate locally are most likely executed with  the faster . JFind the state action that corresponds to a tagged and serialized method. de(Apply an in-memory method to the state. ?Find the state action that corresponds to an in-memory method. f Construct a _4 from a list of Methods using their associated tag.    "non-portable (uses GHC extensions)lemmih@gmail.com!:List of events capable of updating or querying the state. gh Context monad for Query events. ij!Context monad for Update events. klVState container offering full ACID (Atomicity, Consistency, Isolation and Durability)  guarantees.  Atomicity4 State changes are all-or-nothing. This is what you'd expect of any state : variable in Haskell and AcidState doesn't change that.  ConsistencyJ No event or set of events will break your data invariants. This includes $ power outages,  IsolationM Transactions cannot interfere with each other even when issued in parallel.  DurabilityG Successful transaction are guaranteed to survive system failure (both + hardware and software). mnop"All QueryEvents are also Methods. #All UpdateEvents are also Methods. KWe distinguish between events that modify the state and those that do not. LUpdateEvents are executed in a MonadState context and have to be serialized / to disk before they are considered durable. LQueryEvents are executed in a MonadReader context and obviously do not have  to be serialized to disk. ;Events return the same thing as Methods. The exact type of   depends on the event. qOIssue an Update event and wait for its result. Once this call returns, you are Q guaranteed that the changes to the state are durable. Events may be issued in  parallel. It',s a run-time error to issue events that aren't supported by the AcidState. GIssue an Update event and return immediately. The event is not durable G before the MVar has been filled but the order of events is honored. A The behavior in case of exceptions is exactly the same as for . -If EventA is scheduled before EventB, EventA will be executed before EventB:  do scheduleUpdate acid EventA  scheduleUpdate acid EventB  Same as 0 but lifted into any monad capable of doing IO. !OIssue a Query event and wait for its result. Events may be issued in parallel. "Same as !0 but lifted into any monad capable of doing IO. #GTake a snapshot of the state and save it to disk. Creating checkpoints / makes it faster to resume AcidStates and you're free to create them as I often or seldom as fits your needs. Transactions can run concurrently  with this call. =This call will not return until the operation has succeeded. $CSave a snapshot to disk and close the AcidState as a single atomic D action. This is useful when you want to make sure that no events ) are saved to disk after a checkpoint. %,Create an AcidState given an initial value. .This will create or resume a log found in the "state/ [typeOf state]/" directory. AInitial state value. This value is only used if no checkpoint is  found. &@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. 2Location of the checkpoint and transaction files. AInitial state value. This value is only used if no checkpoint is  found. '(Close an AcidState and associated logs. B Any subsequent usage of the AcidState will throw an exception.  !"#$%&'%&'#$! " !"#$%&'(7Create the control structures required for acid states  using Template Haskell.  This code:   ,myUpdate :: Argument -> Update State Result myUpdate arg = ...  *myQuery :: Argument -> Query State Result myQuery arg = ...   $(makeAcidic ''State [' myUpdate, 'myQuery])  will make State an instance of  and provide the following events:  "data MyUpdate = MyUpdate Argument !data MyQuery = MyQuery Argument rstuv(("non-portable (uses GHC extensions)lemmih@gmail.com !"#$%&'(%&'#$! "(w       ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIJKLLMNOPQRSTUVWXYZ[\]^_`abcd efghijjklmnopqrstuvacid-state-0.4Data.Acid.CoreData.Acid.Local Data.Acid Data.Acid.CRCPaths_acid_stateData.Acid.Archive Data.Acid.LogData.Acid.TemplateHaskellMethodContainerMethodTaggedCore MethodResult MethodState methodTagmkCore closeCore closeCore'modifyCoreStatemodifyCoreState_ withCoreState runColdMethodlookupColdMethod runHotMethodlookupHotMethodIsAcidic acidEventsQueryUpdate AcidState QueryEvent UpdateEventEvent EventState EventResultupdatescheduleUpdateupdate'queryquery'createCheckpointcreateCheckpointAndClose openAcidStateopenAcidStateFromcloseAcidState makeAcidic tableListtablecrc16versionbindirlibdirdatadir libexecdir getBinDir getLibDir getDataDir getLibexecDirgetDataFileNameEntriesFailNextDoneEntry entriesToListentriesToListNoFailputEntry putEntries packEntries readEntries readEntryc_fsyncLogKey logDirectory logPrefixFileLog logIdentifier logCurrentlogNextEntryIdlogQueue logThreadsEntryId formatLogFile findLogFilessaveVersionFile openFileLog fileWriterrepack writeToDisk closeFileLog readEntitiesreadEntriesFrom cutFileLog newestEntry pushEntry pushActionaskCurrentEntryIddecode' MethodMapTag coreState coreMethods lazyDecode missingMethod mkMethodMap CheckpointunQueryunUpdate localCore localEventslocalCheckpointseventsToMethods makeEvent getEventTypemakeEventHandler analyseType makeAcidic'