úÎkÍ`™       ! " # $ % &'()*+,-./0123456789:;<=>?@ABCDEFGHIJ K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b cdefghijklmnop q r s t u v w xyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜Safe+       Safe!"+™™None+Nš›œžŸ Ą˘Ł¤ĽŚ§¨ š›œžŸ Ą˘Ł¤ĽŚ§¨Safe+ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂ Š˛ł´ľśˇ¸šşťŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂSafe+ÄÄNone+Open a backend database.ĹĆÇlocator (eg. "zookeeper:/localhost:2181"myapp", "sqlite3://myapp.sqlite3")backendČĹĆÇČ Safe+ Unit classDefine the priority of a unit. $Define the recovery state of a unit.!'Define the logging necessity of a unit."Description class#!Define the description of a unit.$'Define the short description of a unit.%Environment class !"#$% !"#$%%"#$ ! !"#$%None +357>CL%&'É()*+,-Ę./0123456789:;<=>?@ABCËĚÍÎĎ( !&'()*+,-./0123456789:;<=>?@ABC*/01-.&'(2)*+, !3456789:;<=>?@A.(BC&'É()*+,-Ę./0123456789:;<=>?@ABCËĚÍÎĎNone+ĐDEFGHIDEFGHIDEFGHIĐDEFGHI None+J"Job control block Job consists of State, Unit, CTime, OnTime, Id, Group, and Priority.TState - takes one of 5 states (initialized, runnable, running, aborted and finished)WUnit - an instance of Unit class, which is specified by type parameter of Job data typeCTime - creation time*OnTime - the time at which this job startsId - Identifier of this jobGroup - Group ID of this job#Priority - the priority of this jobJKLMNOPQRSTUVWXYZ[\]^JKLMNOPQRSTUVWXYZ[\]^TUVWXYJKSLMNOPQRZ[\]^J KSLMNOPQRTUVWXYZ[\]^ None+_`ab_`ab_`ab_`abNone+ eGet environment in action.f›Do a dirty I/O action with a side effect to the external system. If it doesn't change the state of the external system, you should use liftIO instead.gYield executionh)Create a job with a unit and schedule it.i<Create a job with a unit and schedule it at a specific time.jCCreate a job with a unit and schedule it after a few micro seconds.k˙<Move to the next state immediately. After the execution of the action the job being processed will be moved to the given state. The next action will be invoked immediately and can continue to work without being interrupted by another job. NOTE: This overrides the next state if it is already set.l’Move to the next state immediately. This is different from "next" function because this doesn't override if the next job is already set.m Finish a job.nzIf the unit passed by the job queue system cannot be processed by the action function, the function should call this.o˜Abort the execution of a state machine. If a critical problem is found and there is a need to switch to the failure state, call this function.Ń0Set the result of the action. (for internal use)cdŇÓefgha unitiabsolute time in UTCa unitjkthe next statelthe next statemnoŃÔ/cdefghijklmno/cdeklmnhjiofgcdŇÓefghijklmnoŃÔ None +357>CLs Environment with a parameter setunGet a parameter value with a key from the environment in action. This is a special function for ParamEnv. pqrstuŐÖ×ŘŮpqrstustpqrupqrstuŐÖ×ŘŮ None+wQDeclare a function which accepts a unit and execute the action of it if possible.vwÚJ !&'()*+,-./0123456789:;<=>?@ABCJLMNOPQRSTUVWXYZ[\cdefghijklmnovwJSLMNOPQRTUVWXYvwZ[\vwÚNone!"+xyz{|}~€‚ƒ„…†xyz{|}~€‚ƒ„…†|}~xyz{€‚ƒ„…† xyz{|}~€‚ƒ„…†None+N‡A session handleriA session usually represents a database session to access job queues stored in the backend database.ˆ,Open a queue session with a resource locator‰-Create a queue session with a backend handlerŠClose a queue session if needed‹ Open a job queue with a session.ŒClose a job queue./Count the number of jobs queued in a job queue.ŽResume a job queueSuspend a job queue1Execute an action of the head job in a job queue.‘Schedule a job.’Delete a job from a job queue.“ Clear all jobs from a job queue.”Peek a job form a job queue.‡Űˆa resource locatora session handler‰a resource locator (dummy)a session handlerŠ‹a session handler a queue namea state machine definitionŒŽ‘ a job queuea unit’ a job queuea job identifier“ a job queue” a job queue|‡ˆ‰Š‹ŒŽ‘’“”|‡ˆ‰Š‹ŒŽ‘’“”‡ۈ‰Š‹ŒŽ‘’“”None+•–Ü•–•–•–Ü(c) Gree, Inc. 2013 MIT-style*Kiyoshi Ikehara <kiyoshi.ikehara@gree.net> experimentalportableNone+N—)Build a function that takes a function ((| a -> Ý& ()) -> IO ()) as its first parameter.CThe following code executes jobs as long as the queue is not empty. ˙ˆ main' loc name = do let withJobQueue = buildJobQueue loc name $ do process $ \WorldStep -> commitIO (putStrLn "world") >> fin process $ \HelloStep -> commitIO (putStr "hello, ") >> next WorldStep withJobQueue $ loop (initJobEnv loc name []) where loop env jq = do executeJob jq env count <- countJobQueue jq when (count > 0) $ loop env jq6The following code registers a job with initial state. ˙ main' loc name = do let withJobQueue = buildJobQueue loc name $ do process $ \WorldStep -> commitIO (putStrLn "world") >> fin process $ \HelloStep -> commitIO (putStr "hello, ") >> next WorldStep withJobQueue $ \jq -> scheduleJob jq HelloStep˜=Run a job queue while there is at least one job in the queue.—,locator (ex."zookeeper://192.168.0.1/myapp")queue name (ex. "/jobqueue")job construction functionjob queue executor˜,locator (ex."zookeeper://192.168.0.1/myapp")queue name (ex. "/jobqueue")job construction functionF !"#$%&-/DEFGHIJLMNOPQRSTUVWXYZ_`abefghijklmnopuw|‡ˆ‰Š‹ŒŽ‘’“”—˜(—˜JSLMNOPQRTUVWXY !&-/wZmnklghjioepuf—˜Ţ !"#$%&'()*+,-../012345 6 7 8 9 : ; < =>?@AABCDEFFGHIJKLMNOPQRSTUVWXYZ[\]^_ ` ` a b c d e f g h i j k l m n o p q r s t u v wxyz{|}~€‚ƒ„ … † ‡ ˆ ‰ Š ‹ ŒŽ‘‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŽŻ°ą˛ł´ľśˇ¸šşťźź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚ?DŰÜÝŢßŕáâăä ĺ ć ç č é ę›ëěíîďjobqu_G3y2SbnogSm8lTuHpv2RvLNetwork.JobQueue.TypesNetwork.JobQueue.ActionNetwork.JobQueue.LoggerNetwork.JobQueue.Backend.ClassNetwork.JobQueue.Backend.Types Network.JobQueue.Backend.Sqlite3"Network.JobQueue.Backend.ZookeeperNetwork.JobQueue.BackendNetwork.JobQueue.ClassNetwork.JobQueue.Job.InternalNetwork.JobQueue.AuxClassNetwork.JobQueue.ParamNetwork.JobQueue.Job"Network.JobQueue.JobQueue.InternalNetwork.JobQueue.JobQueueNetwork.JobQueue.UtilNetwork.JobQueue1Network.JobQueue.Backend.Zookeeper.ZookeeperQueuemonad_3wbQEppROtKEa2SQNm1HkxControl.Monad.Logger LevelOther LevelError LevelWarn LevelInfo LevelDebugLogLeveltrans_3eG64VdP2vzGjP6wJiCp5XControl.Monad.IO.ClassliftIOtextf_0elQFAqEs2rDJbelclxvN2Data.Text.Format.Types.InternalOnly BackendQueue readQueue peekQueue updateQueue deleteQueue writeQueue listQueue itemsQueue countQueue closeQueue BackendErrorNotFound SessionErrorBackend bOpenQueuebCloseopenSqlite3BackendnewSqlite3BackendopenZookeeperBackendnewZookeeperBackend openBackendUnit getPriority getRecovery toBeLoggedDescdesc shortDescEnvActionMActionTrunAM ActionEnv getJobEnv getJobUnitJobMrunSJobActionState jobActionsActionFn RuntimeStateRS rsNextJob rsNextForks rsCommitsBreak UnhandledFailure Retriable setNextJobsetNextJobIfEmpty emptyNextJob addForkJobincrementCommits getCommits addAction setResultlogDebuglogInfologWarnlogError logNotice logCriticalJobjobStatejobUnitjobCTime jobOnTimejobIdjobGroup jobPriority StopTheWorldJobState InitializedRunnableRunningAbortedFinished createJobcreateOnTimeJobprintJob defaultId defaultGroupAux auxLoggerauxHandleFailureauxHandleAfterExecuterunActionState runActiongetEnvcommitIOyieldfork forkOnTime forkInTimenextorNextfinnoneabortParam decodeParam encodeParamParamEnv envParametersparambuildActionStateprocess ActionForJobExecuteDeleteSkipJobQueuejqBackendQueue jqActionState actionForJobpeekJob' executeJob'afterExecuteJob rescheduleJob updateJobpackSession openSession newSession closeSession openJobQueue closeJobQueue countJobQueueresumeJobQueuesuspendJobQueue executeJob scheduleJob deleteJob clearJobspeekJobwaitForAllJobswaitUntilMatch buildJobQueue runJobQueue$fExceptionBackendError Sqlite3Queueconn queueNamemlock readDBQueue peekDBQueue writeDBQueue deleteDBQueue updateDBQueue countDBQueue itemsDBQueue listDBQueuewithLock$fBackendQueueSqlite3QueueZookeeperQueuezqHandle zqBasePath zqNodeNamezqAclsmaxPriominPrioqnPrefix initZQueue readZQueue peekZQueue updateZQueue deleteZQueue writeZQueue destroyZQueue listZQueue itemsZQueue countZQueue getChildren sortChildrenfullPath nodePrefix throwZKErrorcreateZnodeRecursivelycreateZnodeRecursively'$fBackendQueueZookeeperQueuebasePathLocator ZookeeperSqlite3 parseLocator$fMonadBaseControlbaseActionT$fMonadTransControlActionT$fMonadTransActionT$fDefaultJobActionState$fDefaultRuntimeStatelogTHresulthandlePatternMatchFail handleSomeforkWith $fParamValue $fParamDouble$fParamInteger $fParamInt $fParam[]eval waitWhileghc-prim GHC.TypesIO