<      !"#$%&'()*+,-./0123456789:;None<=>><=> Safe-Inferred ?@ABCDEFGHI@EFGHI ?@ABCDEFGHI NoneJ=Read a lazy bytestring WITHOUT any copying or concatenation. KLMNOPQRSTUVJ KLMNOPQSTU KNMLOPQRSTUVJ None W3Read the lock and break it if the process is dead. X5Read the lock and return the process id if possible. Y)Is this a permission error? If so we don't have permission to  remove the lock file, abort. ZBWe have determined the locking process is gone, try to remove the  lock. [@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. \@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. ];An exception saying the data is locked by another process. ^An exception saying we don'"t have permission to create lock. _=An exception saying another process broke our lock before we  finished creating it. `CRelinquish the lock by removing it and then verifying the removal. abcdefghijWXYklZ[\]^_`acfghij`abcdefghijWXYklZ[\]^_` "non-portable (uses GHC extensions)lemmih@gmail.comNonem(Collection of Methods indexed by a Tag. nDMethod container structure that hides the exact type of the method. oJMethod tags must be unique and are most commonly generated automatically. p8The 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. qCConstruct a new Core using an initial state and a list of Methods. rAMark Core as closed. Any subsequent use will throw an exception. sFAccess the state and then mark the Core as closed. Any subsequent use  will throw an exception. tDModify the state component. The resulting state is ensured to be in  WHNF. uDModify the state component. The resulting state is ensured to be in  WHNF. vAccess the state component. wFExecute 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 x. yJFind the state action that corresponds to a tagged and serialized method. x(Apply an in-memory method to the state. z?Find the state action that corresponds to an in-memory method. { Construct a m4 from a list of Methods using their associated tag. mn|}op~q0List of methods capable of modifying the state. Initial state value. rstuvwyxz{mn|}pqrstuvwyxz{mn|}op~qrstuvwyxz{ None" "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. '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. ! Execute the   monad in a pure environment. " Execute the   monad in a pure environment.  Initial state value. !"  !"   !" !""non-portable (uses GHC extensions)lemmih@gmail.comNone ((b is a record containing the IO functions we need for communication between the server and client. ^We abstract this out of the core processing function so that we can easily add support for SSL/TLS and Unit testing.  create a ( from a . The  should be 6 some two-way communication channel, such as a socket  connection. Passing in a ! to a normal is file is unlikely  to do anything useful.  create a ( from a . The  should be . an accepted socket, not a listen socket. -4skip server-side authentication checking entirely. .+skip client-side authentication entirely. /-check that the client knows a shared secret. The function takes a * of shared secrets. If a client knows any )of them, it is considered to be trusted. The shared secret is any  ByteString of your choice. ?If you give each client a different shared secret then you can revoke access individually.  see also: 0 0?attempt to authenticate with the server using a shared secret. 1Accept connections on port% and handle requests using the given .  This call doesn' t return. !On Unix-like systems you can use to communicate L using a socket file. To control access, you can set the permissions of : the parent directory which contains the socket file.  see also: 4 and /. 2Works the same way as 1, but uses pre-binded socket  listenSocket. FCan be useful when fine-tuning of socket binding parameters is needed D (for example, listening on a particular network interface, IPv4/IPv6 options). 3Server inner-loop VThis function is generally only needed if you are adding a new communication channel. 44Connect to an acid-state server which is sharing an . 5Client inner-loop VThis function is generally only needed if you are adding a new communication channel. ,#$%&'()*+,-./set of shared secrets 0shared secret 1check authentication, see 0 Port to listen on state to serve 2check authentication, see 0 )binded socket to accept connections from state to serve 31a connected, authenticated communication channel state to share 4authentication function, see 0 (remote host to connect to (ignored when  is ) remote port to connect to 5(re-)connect function #$%&'()*+,-./012345124-./0#'&%$()*+,35#'&%$()*+,-./012345"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. 6CSave 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. 7,Create an AcidState given an initial value. .This will create or resume a log found in the "state/ [typeOf state]/" directory. 8,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. 9@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. 67AInitial state value. This value is only used if no checkpoint is  found. 8AInitial state value. This value is only used if no checkpoint is  found. 92Location 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. ;6789:;798:;66789:;"non-portable (uses GHC extensions)lemmih@gmail.comNone 7979                   !"#$%&'()$*&+,-./01233456789:;<=>?@ABCDEFGHIJKLMNOPQRS T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k k l l m n o p q r s t u v w x y z { | } ~    x         acid-state-0.12.1Data.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 acidEvents liftQuery AcidStatecreateCheckpoint createArchivecloseAcidStatescheduleUpdate groupUpdatesupdateupdate'queryquery' makeAcidicopenMemoryStateupdate_ openAcidState runUpdaterunQueryAcidRemoteExceptionAuthenticationErrorSerializeErrorAcidStateClosedRemoteConnectionError CommChannelccPut ccGetSomeccCloseskipAuthenticationCheckskipAuthenticationPerformsharedSecretChecksharedSecretPerform acidServer acidServer'processopenRemoteStateprocessRemoteStatecreateCheckpointAndCloseopenLocalStateprepareLocalStateopenLocalStateFromprepareLocalStateFromcreateLocalArchive tableListtablecrc16catchIOversionbindirlibdirdatadir libexecdir getBinDir getLibDir getDataDir getLibexecDirgetDataFileNamegetLazyByteString_fastEntriesFailNextDoneEntry 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 memoryQuerycreateMemoryCheckpointcreateMemoryArchivecloseMemoryState localCore localCopyscheduleMemoryColdUpdatememoryQueryCold toAcidState localMethods localStatehandleToCommChannelbaseGHC.IO.Handle.TypesHandlesocketToCommChannelnetwork-2.4.1.2Network.Socket.TypesSocketcontainers-0.5.0.0 Data.Set.BaseSetNetwork UnixSocket RemoteStateResponseConnectionErrorAcknowledgementResultCommand CreateArchiveCreateCheckpoint RunUpdateRunQuery debugStrLnPortID remoteQueryremoteQueryColdscheduleRemoteUpdatescheduleRemoteColdUpdatecloseRemoteStatecreateRemoteCheckpointcreateRemoteArchive$fSerializeResponse$fSerializeCommand$fExceptionAcidRemoteException LocalStatescheduleLocalUpdate localQuerycreateLocalCheckpointcloseLocalState Checkpoint localEventslocalCheckpoints localLockscheduleLocalColdUpdatelocalQueryColdresumeLocalStateFromcheckpointRestoreError$fSafeCopyCheckpoint