%(      !"#$%&'None()**()* Safe-Inferred +,-./012345,12345 +,-./012345 None 6789:;<=>?@A 6789:;<>?@ 6987:;<=>?@A None B3Read the lock and break it if the process is dead. C5Read the lock and return the process id if possible. D)Is this a permission error? If so we don't have permission to  remove the lock file, abort. EBWe have determined the locking process is gone, try to remove the  lock. F@An exception when we tried to break a lock, if it says the lock 7 file has already disappeared we are still good to go. G@Try to create lock by opening the file with the O_EXCL flag and B writing our PID into it. Verify by reading the pid back out and C matching, maybe some other process slipped in before we were done  and broke our lock. H;An exception saying the data is locked by another process. IAn exception saying we don'"t have permission to create lock. J=An exception saying another process broke our lock before we  finished creating it. KCRelinquish the lock by removing it and then verifying the removal. LMNOPQRSTUBCDVWEFGHIJKLNQRSTUKLMNOPQRSTUBCDVWEFGHIJK "non-portable (uses GHC extensions)lemmih@gmail.comNoneX(Collection of Methods indexed by a Tag. YDMethod container structure that hides the exact type of the method. ZJMethod tags must be unique and are most commonly 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. ?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. ]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. aAccess the state component. bFExecute 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 c. dJFind the state action that corresponds to a tagged and serialized method. c(Apply an in-memory method to the state. e?Find the state action that corresponds to an in-memory method. f Construct a X4 from a list of Methods using their associated tag. XYghZ[ijkl\0List of methods capable of modifying the state. Initial state value. ]^_`abdmncefXYgh[k\]^_`abdcefXYghZ[ijkl\]^_`abdmncef None"opqrstuvwxyz{|}~opqrsz~opqrstuvwxyz{|}~ "non-portable (uses GHC extensions)lemmih@gmail.comNone"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.  Context monad for Query events. !Context monad for Update events. !Run a query in the Update Monad.  :List of events capable of updating or querying the state.      None VState 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.  Consistency< No event or set of events will break your data invariants.  IsolationM Transactions cannot interfere with each other even when issued in parallel.  DurabilityN Successful transaction are guaranteed to survive unexpected system shutdowns A (both those caused by hardware and software). 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. -Close an AcidState and associated resources. B Any subsequent usage of the AcidState will throw an exception. 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 ESchedule multiple Update events and wait for them to be durable, but C throw away their results. This is useful for importing existing  datasets into an AcidState. OIssue 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. 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.  None7Create 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 :This function analyses an event function and extracts any B additional class contexts which need to be added to the IsAcidic  instance. For example, if we have:   data State a = ...  6 setState :: (Ord a) => a -> UpdateEvent (State a) () 4Then we need to generate an IsAcidic instance like:  @ instance (SafeCopy a, Typeable a, Ord a) => IsAcidic (State a) ?Note that we can only add constraints for type variables which 3 appear in the State type. If we tried to do this:  B setState :: (Ord a, Ord b) => a -> b -> UpdateEvent (State a) () AWe will get an ambigious type variable when trying to create the   6 instance, because there is no way to figure out what  type b should be. ?The tricky part of this code is that we need to unify the type  variables. Let''s say the user writes their code using b instead of a:  6 setState :: (Ord b) => b -> UpdateEvent (State b) () In the  % instance, we are still going to use a. So we 7 need to rename the variables in the context to match. HThe contexts returned by this function will have the variables renamed. find the type variables  | e.g. State a b ==> [a,b]  extract the  from a  %State type (used for error messages) Mtype variables that will be used for the State type in the IsAcidic instance  of the event  of the event extra context to add to   instance "non-portable (uses GHC extensions)lemmih@gmail.comNoneVState 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.  Consistency< No event or set of events will break your data invariants.  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). ,Create an AcidState given an initial value. 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 OIssue a Query event and wait for its result. Events may be issued in parallel. 'This is a nop with the memory backend. (Close an AcidState and associated logs. B Any subsequent usage of the AcidState will throw an exception. Initial state value.  "non-portable (uses GHC extensions)lemmih@gmail.comNoneVState 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.  Consistency< No event or set of events will break your data invariants.  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). OIssue 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. Same as  but ignoring the event result. -Issue a Query event and wait for its result. ,Create an AcidState given an initial value. Initial state value.     "non-portable (uses GHC extensions)lemmih@gmail.comNone Accept connections on port$ and serve requests using the given .  This call doesn' t return. !Connect to a remotely running .  ! ! ! !"non-portable (uses GHC extensions)lemmih@gmail.comNone    "non-portable (uses GHC extensions)lemmih@gmail.comNone VState 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.  Consistency< No event or set of events will break your data invariants.  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). 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 OIssue a Query event and wait for its result. Events may be issued in parallel. 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. $,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.  Running two AcidState'&s from the same directory is an error $ but will not result in dataloss. &,Create an AcidState given 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. (Close an AcidState and associated logs. B Any subsequent usage of the AcidState will throw an exception. 'OMove all log files that are no longer necessary for state restoration into the Archive b folder in the state directory. This folder can then be backed up or thrown out as you see fit. O Reverting to a state before the last checkpoint will not be possible if the Archive folder  has been thrown out. TThis method is idempotent and does not block the normal operation of the AcidState. "#AInitial state value. This value is only used if no checkpoint is  found. $AInitial state value. This value is only used if no checkpoint is  found. %2Location of the checkpoint and transaction files. AInitial state value. This value is only used if no checkpoint is  found. &2Location of the checkpoint and transaction files. AInitial state value. This value is only used if no checkpoint is  found. 2Location of the checkpoint and transaction files. AInitial state value. This value is only used if no checkpoint is  found. 3True => load checkpoint before acquiring the lock. '"#$%&'#%$&'""#$%&'"non-portable (uses GHC extensions)lemmih@gmail.comNone #%#%                   !"#$%&'(#)%*+,-./0123456789:;<=>?@ A B C D E F G H I J K L M N O P Q R S T U V W W X X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o  p d q r s t u v v w x y y z { | } ~    acid-state-0.8.3Data.Acid.AdvancedData.Acid.Memory.Pure Data.AcidData.Acid.MemoryData.Acid.RemoteData.Acid.Local Data.Acid.CRCPaths_acid_stateData.Acid.ArchiveFileIOData.Acid.Core Data.Acid.LogData.Acid.CommonData.Acid.AbstractData.Acid.TemplateHaskellMethod MethodResult MethodState methodTag QueryEvent UpdateEventEvent EventState EventResultQueryUpdateIsAcidic acidEventsrunQuery AcidStatecreateCheckpointcloseAcidStatescheduleUpdate groupUpdatesupdateupdate'queryquery' makeAcidicopenMemoryStateupdate_ openAcidState acidServeropenRemoteStatecreateCheckpointAndCloseopenLocalStateprepareLocalStateopenLocalStateFromprepareLocalStateFrom createArchive tableListtablecrc16catchIOversionbindirlibdirdatadir libexecdir getBinDir getLibDir getDataDir getLibexecDirgetDataFileNameEntriesFailNextDoneEntry entriesToListentriesToListNoFailputEntry putEntries packEntries readEntries readEntry checkLockreadLockcheckReadFileError breakLockcheckBreakErrortakeLocklockedBycantLock stolenLockreleasePrefixLockFHandle PrefixLockc_fsyncopenwriteflushcloseobtainPrefixLockmaybeBreakLockdoesProcessExist MethodMapMethodContainerTagCoremkCore closeCore closeCore'modifyCoreStatemodifyCoreState_ withCoreState runColdMethod runHotMethodlookupColdMethodlookupHotMethod mkMethodMapTagged coreState coreMethodsshowQualifiedTypeRep lazyDecode missingMethodLogKey logDirectory logPrefixFileLog logIdentifier logCurrentlogNextEntryIdlogQueue logThreadsEntryId formatLogFile findLogFilessaveVersionFile openFileLog fileWriterrepack writeToDisk closeFileLog readEntitiesensureLeastEntryIdreadEntriesFrom rollbackTo rollbackWhilefilterLogFilesarchiveFileLoggetNextDurableEntryId cutFileLog newestEntry pushEntry pushActionaskCurrentEntryIddecode'unQueryunUpdate runGetLazyFixeventsToMethods$fApplicativeQuery$fApplicativeUpdate_scheduleUpdatescheduleColdUpdate_query queryCold acidSubStateAnyState mkAnyStatedowncast eventCxts findTyVars tyVarBndrNametemplate-haskellLanguage.Haskell.TH.SyntaxName TyVarBndr makeAcidic' makeEvent getEventType makeIsAcidicTypemakeEventHandlermakeEventDataTypemakeSafeCopyInstancemkCxtFromTyVarsmakeMethodInstancemakeEventInstance analyseType MemoryStatescheduleMemoryUpdate memoryQuerycreateMemoryCheckpointcloseMemoryState localCore localCopyscheduleMemoryColdUpdatememoryQueryCold toAcidState localMethods localState RemoteStateResponseAcknowledgementResultCommandCreateCheckpoint RunUpdateRunQueryprocess remoteQueryremoteQueryColdscheduleRemoteUpdatescheduleRemoteColdUpdatecloseRemoteStatecreateRemoteCheckpoint$fSerializeResponse$fSerializeCommand LocalStatescheduleLocalUpdate localQuerycreateLocalCheckpointcloseLocalState Checkpoint localEventslocalCheckpoints localLockscheduleLocalColdUpdatelocalQueryColdresumeLocalStateFromcheckpointRestoreError$fSafeCopyCheckpoint